mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-17 16: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
@@ -3336,10 +3336,10 @@ static const uint32_t //
|
||||
wuffs_gif__quirk_image_bounds_are_strict //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = 1041635330;
|
||||
|
||||
#define WUFFS_GIF__QUIRK_BACKGROUND_IS_OPAQUE 1041635331
|
||||
#define WUFFS_GIF__QUIRK_HONOR_BACKGROUND_COLOR 1041635331
|
||||
|
||||
static const uint32_t //
|
||||
wuffs_gif__quirk_background_is_opaque //
|
||||
static const uint32_t //
|
||||
wuffs_gif__quirk_honor_background_color //
|
||||
WUFFS_BASE__POTENTIALLY_UNUSED = 1041635331;
|
||||
|
||||
#define WUFFS_GIF__QUIRK_REJECT_EMPTY_FRAME 1041635333
|
||||
@@ -3469,7 +3469,7 @@ struct wuffs_gif__decoder__struct {
|
||||
bool f_quirk_enabled_delay_num_decoded_frames;
|
||||
bool f_quirk_enabled_ignore_too_much_pixel_data;
|
||||
bool f_quirk_enabled_image_bounds_are_strict;
|
||||
bool f_quirk_enabled_background_is_opaque;
|
||||
bool f_quirk_enabled_honor_background_color;
|
||||
bool f_quirk_enabled_reject_empty_frame;
|
||||
bool f_quirk_enabled_reject_empty_palette;
|
||||
bool f_delayed_num_decoded_frames;
|
||||
@@ -8774,7 +8774,7 @@ wuffs_gif__decoder__set_quirk_enabled(wuffs_gif__decoder* self,
|
||||
} else if (a_quirk == 1041635330) {
|
||||
self->private_impl.f_quirk_enabled_image_bounds_are_strict = a_enabled;
|
||||
} else if (a_quirk == 1041635331) {
|
||||
self->private_impl.f_quirk_enabled_background_is_opaque = a_enabled;
|
||||
self->private_impl.f_quirk_enabled_honor_background_color = a_enabled;
|
||||
} else if (a_quirk == 1041635333) {
|
||||
self->private_impl.f_quirk_enabled_reject_empty_frame = a_enabled;
|
||||
} else if (a_quirk == 1041635332) {
|
||||
@@ -8835,7 +8835,7 @@ wuffs_gif__decoder__decode_image_config(wuffs_gif__decoder* self,
|
||||
goto suspend;
|
||||
}
|
||||
v_ffio = !self->private_impl.f_gc_has_transparent_index;
|
||||
if (!self->private_impl.f_quirk_enabled_background_is_opaque) {
|
||||
if (!self->private_impl.f_quirk_enabled_honor_background_color) {
|
||||
v_ffio =
|
||||
(v_ffio && (self->private_impl.f_frame_rect_x0 == 0) &&
|
||||
(self->private_impl.f_frame_rect_y0 == 0) &&
|
||||
@@ -9846,7 +9846,7 @@ wuffs_gif__decoder__decode_lsd(wuffs_gif__decoder* self,
|
||||
((uint8_t)(((v_argb >> 24) & 255)));
|
||||
v_i += 1;
|
||||
}
|
||||
if (self->private_impl.f_quirk_enabled_background_is_opaque) {
|
||||
if (self->private_impl.f_quirk_enabled_honor_background_color) {
|
||||
if ((v_background_color_index != 0) &&
|
||||
(((uint32_t)(v_background_color_index)) < v_num_palette_entries)) {
|
||||
v_j = (4 * ((uint32_t)(v_background_color_index)));
|
||||
|
||||
+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) {
|
||||
|
||||
|
||||
+2
-2
@@ -873,7 +873,7 @@ const char* test_wuffs_gif_decode_background_color() {
|
||||
RETURN_FAIL("q=%d: initialize: \"%s\"", q, status);
|
||||
}
|
||||
wuffs_gif__decoder__set_quirk_enabled(
|
||||
&dec, wuffs_gif__quirk_background_is_opaque, q);
|
||||
&dec, wuffs_gif__quirk_honor_background_color, q);
|
||||
|
||||
wuffs_base__image_config ic = ((wuffs_base__image_config){});
|
||||
wuffs_base__io_reader src_reader = wuffs_base__io_buffer__reader(&src);
|
||||
@@ -915,7 +915,7 @@ const char* test_wuffs_gif_decode_first_frame_is_opaque() {
|
||||
RETURN_FAIL("q=%d: initialize: \"%s\"", q, status);
|
||||
}
|
||||
wuffs_gif__decoder__set_quirk_enabled(
|
||||
&dec, wuffs_gif__quirk_background_is_opaque, q);
|
||||
&dec, wuffs_gif__quirk_honor_background_color, q);
|
||||
|
||||
wuffs_base__image_config ic = ((wuffs_base__image_config){});
|
||||
wuffs_base__io_reader src_reader = wuffs_base__io_buffer__reader(&src);
|
||||
|
||||
Reference in new issue
Block a user