mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-18 23:09:52 +02:00
Support for "Do not blend" in mux and demux libraries
Change-Id: I9566a8e2d059fe1ebd9ca99c7e13311bf3f8f281
This commit is contained in:
@ -426,6 +426,8 @@ static WebPMuxError MuxGetImageInternal(const WebPMuxImage* const wpi,
|
||||
info->x_offset = 0;
|
||||
info->y_offset = 0;
|
||||
info->duration = 1;
|
||||
info->dispose_method = WEBP_MUX_DISPOSE_NONE;
|
||||
info->blend_method = WEBP_MUX_BLEND;
|
||||
// Extract data for related fields.
|
||||
info->id = ChunkGetIdFromTag(wpi->img_->tag_);
|
||||
return SynthesizeBitstream(wpi, &info->bitstream);
|
||||
@ -446,10 +448,17 @@ static WebPMuxError MuxGetFrameFragmentInternal(const WebPMuxImage* const wpi,
|
||||
// Extract info.
|
||||
frame->x_offset = 2 * GetLE24(frame_frgm_data->bytes + 0);
|
||||
frame->y_offset = 2 * GetLE24(frame_frgm_data->bytes + 3);
|
||||
frame->duration = is_frame ? GetLE24(frame_frgm_data->bytes + 12) : 1;
|
||||
frame->dispose_method =
|
||||
is_frame ? (WebPMuxAnimDispose)(frame_frgm_data->bytes[15] & 1)
|
||||
: WEBP_MUX_DISPOSE_NONE;
|
||||
if (is_frame) {
|
||||
const uint8_t bits = frame_frgm_data->bytes[15];
|
||||
frame->duration = GetLE24(frame_frgm_data->bytes + 12);
|
||||
frame->dispose_method =
|
||||
(bits & 1) ? WEBP_MUX_DISPOSE_BACKGROUND : WEBP_MUX_DISPOSE_NONE;
|
||||
frame->blend_method = (bits & 2) ? WEBP_MUX_NO_BLEND : WEBP_MUX_BLEND;
|
||||
} else { // Defaults for unused values.
|
||||
frame->duration = 1;
|
||||
frame->dispose_method = WEBP_MUX_DISPOSE_NONE;
|
||||
frame->blend_method = WEBP_MUX_BLEND;
|
||||
}
|
||||
frame->id = ChunkGetIdFromTag(wpi->header_->tag_);
|
||||
return SynthesizeBitstream(wpi, &frame->bitstream);
|
||||
}
|
||||
|
Reference in New Issue
Block a user