mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-26 13:48:21 +01:00
gif2webp: If aligning to even offsets, extra pixels should be transparent
This is to ensure that the output WebP image is consistent with original GIF when displayed against any background color. Change-Id: I14218848153eb40358aa4ce331b2543d2fc2e86c
This commit is contained in:
parent
0bcf5ce39a
commit
54b65108ad
@ -36,11 +36,11 @@
|
||||
|
||||
static int transparent_index = -1; // No transparency by default.
|
||||
|
||||
static void ClearPicture(WebPPicture* const picture, uint32_t color) {
|
||||
static void ClearPicture(WebPPicture* const picture) {
|
||||
int x, y;
|
||||
for (y = 0; y < picture->height; ++y) {
|
||||
uint32_t* const dst = picture->argb + y * picture->argb_stride;
|
||||
for (x = 0; x < picture->width; ++x) dst[x] = color;
|
||||
for (x = 0; x < picture->width; ++x) dst[x] = TRANSPARENT_COLOR;
|
||||
}
|
||||
}
|
||||
|
||||
@ -296,7 +296,7 @@ int main(int argc, const char *argv[]) {
|
||||
WebPMemoryWriter memory;
|
||||
|
||||
if (frame.dispose_method == WEBP_MUX_DISPOSE_BACKGROUND) {
|
||||
ClearPicture(&picture, anim.bgcolor);
|
||||
ClearPicture(&picture);
|
||||
}
|
||||
|
||||
if (!DGifGetImageDesc(gif)) goto End;
|
||||
@ -380,7 +380,7 @@ int main(int argc, const char *argv[]) {
|
||||
fprintf(stderr, "GIF decode warning: invalid background color "
|
||||
"index. Assuming white background.\n");
|
||||
}
|
||||
ClearPicture(&picture, anim.bgcolor);
|
||||
ClearPicture(&picture);
|
||||
is_first_frame = 0;
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user