Compare commits

..

No commits in common. "c04c4063e4a4feabf0eb23b3a38630e4fce1456b" and "bae640a11600559f2dc54f8b7dbef50c3e49c6d5" have entirely different histories.

1 changed files with 3 additions and 10 deletions

View File

@ -1538,8 +1538,6 @@ load_libjpeg_turbo(const char *data, gsize len, const FivIoOpenContext *ctx,
jpeg_create_decompress(&cinfo); jpeg_create_decompress(&cinfo);
jpeg_mem_src(&cinfo, (const unsigned char *) data, len); jpeg_mem_src(&cinfo, (const unsigned char *) data, len);
(void) jpeg_read_header(&cinfo, true); (void) jpeg_read_header(&cinfo, true);
// TODO(p): With newer libjpeg-turbo, if cinfo.data_precision is 12 or 16,
// try to load it with higher precision.
bool use_cmyk = cinfo.jpeg_color_space == JCS_CMYK || bool use_cmyk = cinfo.jpeg_color_space == JCS_CMYK ||
cinfo.jpeg_color_space == JCS_YCCK; cinfo.jpeg_color_space == JCS_YCCK;
@ -1741,8 +1739,10 @@ load_libwebp_frame(WebPAnimDecoder *dec, const WebPAnimInfo *info,
return NULL; return NULL;
} }
bool is_opaque = (info->bgcolor & 0xFF) == 0xFF;
uint64_t area = info->canvas_width * info->canvas_height; uint64_t area = info->canvas_width * info->canvas_height;
FivIoImage *image = fiv_io_image_new(CAIRO_FORMAT_RGB24, FivIoImage *image = fiv_io_image_new(
is_opaque ? CAIRO_FORMAT_RGB24 : CAIRO_FORMAT_ARGB32,
info->canvas_width, info->canvas_height); info->canvas_width, info->canvas_height);
if (!image) { if (!image) {
set_error(error, "image allocation failure"); set_error(error, "image allocation failure");
@ -1758,13 +1758,6 @@ load_libwebp_frame(WebPAnimDecoder *dec, const WebPAnimInfo *info,
*dst++ = GUINT32_FROM_LE(*src++); *dst++ = GUINT32_FROM_LE(*src++);
} }
// info->bgcolor is not reliable.
for (const uint32_t *p = dst, *end = dst + area; p < end; p++)
if ((~*p & 0xff000000)) {
image->format = CAIRO_FORMAT_ARGB32;
break;
}
// This API is confusing and awkward. // This API is confusing and awkward.
image->frame_duration = timestamp - *last_timestamp; image->frame_duration = timestamp - *last_timestamp;
*last_timestamp = timestamp; *last_timestamp = timestamp;