mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 00:32:11 +01:00
Rename wuffs_gif__quirk_background_is_opaque
This commit is contained in:
1 parent
5cdf3197bd
commit
73fcd7e502
3 files changed
+26
-23
No files matched your search
+17
-14
@@ -88,18 +88,21 @@ pub const quirk_ignore_too_much_pixel_data base.u32 = (0xF8586 << 10) | 1
|
||||
// https://github.com/google/wuffs/blob/master/test/data/artificial/gif-frame-out-of-bounds.gif.make-artificial.txt
|
||||
pub const quirk_image_bounds_are_strict base.u32 = (0xF8586 << 10) | 2
|
||||
|
||||
// When this quirk is enabled, the background color is opaque instead of always
|
||||
// being transparent black. If the background color index in the GIF header is
|
||||
// non-zero but less than the global palette's size, the background color is
|
||||
// that global palette's entry. Otherwise, it is opaque black.
|
||||
// When this quirk is enabled, the background color is taken from the GIF
|
||||
// instead of always being transparent black. If the background color index in
|
||||
// the GIF header is non-zero but less than the global palette's size, the
|
||||
// global background color is that global palette's entry. Otherwise, it is
|
||||
// opaque black. A frame's background color is transparent if the frame palette
|
||||
// contains a transparent color. Otherwise, it is the global background color.
|
||||
// Note that different frames can have different background colors.
|
||||
//
|
||||
// Specifically, if the initial frame bounds is smaller than the image bounds,
|
||||
// those pixels outside the initial frame bounds are assumed to start as that
|
||||
// opaque background color. The same color should be used when processing
|
||||
// WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_BACKGROUND. In both cases, the
|
||||
// caller of Wuffs, not Wuffs itself, is responsible for filling the pixel
|
||||
// buffer with that color.
|
||||
pub const quirk_background_is_opaque base.u32 = (0xF8586 << 10) | 3
|
||||
// frame background color. The frame background color should also be used when
|
||||
// processing WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_BACKGROUND. In both
|
||||
// cases, the caller of Wuffs, not Wuffs itself, is responsible for filling the
|
||||
// pixel buffer with that color.
|
||||
pub const quirk_honor_background_color base.u32 = (0xF8586 << 10) | 3
|
||||
|
||||
// When this quirk is enabled, a frame with zero width or height is rejected
|
||||
// during decode_frame (but accepted during decode_frame_config).
|
||||
@@ -178,7 +181,7 @@ pub struct decoder?(
|
||||
quirk_enabled_delay_num_decoded_frames base.bool,
|
||||
quirk_enabled_ignore_too_much_pixel_data base.bool,
|
||||
quirk_enabled_image_bounds_are_strict base.bool,
|
||||
quirk_enabled_background_is_opaque base.bool,
|
||||
quirk_enabled_honor_background_color base.bool,
|
||||
quirk_enabled_reject_empty_frame base.bool,
|
||||
quirk_enabled_reject_empty_palette base.bool,
|
||||
|
||||
@@ -244,8 +247,8 @@ pub func decoder.set_quirk_enabled!(quirk base.u32, enabled base.bool) {
|
||||
this.quirk_enabled_ignore_too_much_pixel_data = args.enabled
|
||||
} else if args.quirk == quirk_image_bounds_are_strict {
|
||||
this.quirk_enabled_image_bounds_are_strict = args.enabled
|
||||
} else if args.quirk == quirk_background_is_opaque {
|
||||
this.quirk_enabled_background_is_opaque = args.enabled
|
||||
} else if args.quirk == quirk_honor_background_color {
|
||||
this.quirk_enabled_honor_background_color = args.enabled
|
||||
} else if args.quirk == quirk_reject_empty_frame {
|
||||
this.quirk_enabled_reject_empty_frame = args.enabled
|
||||
} else if args.quirk == quirk_reject_empty_palette {
|
||||
@@ -269,7 +272,7 @@ pub func decoder.decode_image_config?(dst nptr base.image_config, src base.io_re
|
||||
// TODO: if this.end_of_data, return an error and/or set dst to zero?
|
||||
|
||||
ffio = not this.gc_has_transparent_index
|
||||
if not this.quirk_enabled_background_is_opaque {
|
||||
if not this.quirk_enabled_honor_background_color {
|
||||
ffio = ffio and
|
||||
(this.frame_rect_x0 == 0) and
|
||||
(this.frame_rect_y0 == 0) and
|
||||
@@ -588,7 +591,7 @@ pri func decoder.decode_lsd?(src base.io_reader) {
|
||||
i += 1
|
||||
}
|
||||
|
||||
if this.quirk_enabled_background_is_opaque {
|
||||
if this.quirk_enabled_honor_background_color {
|
||||
if (background_color_index <> 0) and
|
||||
((background_color_index as base.u32) < num_palette_entries) {
|
||||
|
||||
|
||||
Reference in new issue
Block a user