mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-19 08:38:14 +01:00
86 lines
4.5 KiB
Plaintext
86 lines
4.5 KiB
Plaintext
// Copyright 2017 The Wuffs Authors.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// https://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
// --------
|
|
|
|
// Quirks are discussed in (/doc/note/quirks.md).
|
|
//
|
|
// The base38 encoding of "gif " is 0xF_8586.
|
|
|
|
// When this quirk is enabled, when skipping over frames, the number of frames
|
|
// visited isn't incremented when the last byte of the N'th frame is seen.
|
|
// Instead, it is incremented when the first byte of the N+1'th frame's header
|
|
// is seen. There may be zero or more GIF extensions between the N'th frame's
|
|
// payload and the N+1'th frame's header.
|
|
//
|
|
// For a well-formed GIF, this won't have much effect. For a malformed GIF,
|
|
// this can affect the number of valid frames, if there is an error detected in
|
|
// the extensions between one frame's payload and the next frame's header.
|
|
//
|
|
// Some other GIF decoders don't register the N'th frame as complete until they
|
|
// see the N+1'th frame's header (or the end-of-animation terminator), so that
|
|
// e.g. the API for visiting the N'th frame can also return whether it's the
|
|
// final frame. Enabling this quirk allows for matching that behavior.
|
|
pub const quirk_delay_num_decoded_frames base.u32 = (0xF_8586 << 10) | 0
|
|
|
|
// When this quirk is enabled, the background color of the first frame is set
|
|
// to black whenever that first frame has a local (frame-specific) palette.
|
|
// That black can be either opaque black or transparent black, depending on
|
|
// whether or not that first frame is opaque: whether that local palette
|
|
// contains a transparent color.
|
|
//
|
|
// This has no effect unless quirk_honor_background_color is also enabled.
|
|
//
|
|
// There isn't really much of a rationale for this, other than it matches the
|
|
// behavior of another GIF implementation.
|
|
pub const quirk_first_frame_local_palette_means_black_background base.u32 = (0xF_8586 << 10) | 1
|
|
|
|
// 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
|
|
// 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 = (0xF_8586 << 10) | 2
|
|
|
|
// When this quirk is enabled, silently ignore e.g. a frame that reports a
|
|
// width and height of 6 pixels each, followed by 50 pixel values. In that
|
|
// case, we process the first 36 pixel values and discard the excess 14.
|
|
pub const quirk_ignore_too_much_pixel_data base.u32 = (0xF_8586 << 10) | 3
|
|
|
|
// When this quirk is enabled, if the initial frame bounds extends beyond the
|
|
// image bounds, then the image bounds stay unchanged. By default (with this
|
|
// quirk disabled), the image bounds are adjusted to always contain the first
|
|
// frame's bounds (but not necessarily subsequent frame's bounds).
|
|
//
|
|
// For more discussion, see
|
|
// 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 = (0xF_8586 << 10) | 4
|
|
|
|
// When this quirk is enabled, a frame with zero width or height is rejected
|
|
// during decode_frame (but accepted during decode_frame_config).
|
|
pub const quirk_reject_empty_frame base.u32 = (0xF_8586 << 10) | 5
|
|
|
|
// When this quirk is enabled, a frame with no explicit palette is rejected,
|
|
// instead of implicitly having a palette with every entry being opaque black.
|
|
pub const quirk_reject_empty_palette base.u32 = (0xF_8586 << 10) | 6
|