cwebp: fix WebPPictureHasTransparency call

when near_lossless is < 100; previously the zeroed 'picture' would be
passed in the check rather than the original picture. this would result
in alpha never been kept in the decode.

Change-Id: I6af3aef7de2d672e044025d975d8180b12d5fa40
This commit is contained in:
James Zern 2022-08-08 16:42:00 -07:00
parent 866e349cef
commit c626e7d544

View File

@ -1140,9 +1140,10 @@ int main(int argc, const char* argv[]) {
}
picture.use_argb = 1;
if (!ReadWebP(memory_writer.mem, memory_writer.size, &picture,
/*keep_alpha=*/WebPPictureHasTransparency(&picture),
/*metadata=*/NULL)) {
if (!ReadWebP(
memory_writer.mem, memory_writer.size, &picture,
/*keep_alpha=*/WebPPictureHasTransparency(&original_picture),
/*metadata=*/NULL)) {
fprintf(stderr, "Error! Cannot decode encoded WebP bitstream\n");
fprintf(stderr, "Error code: %d (%s)\n", picture.error_code,
kErrorMessages[picture.error_code]);