Compare commits

...

2 Commits

2 changed files with 23 additions and 6 deletions

View File

@ -1281,18 +1281,35 @@ load_libwebp_nonanimated(WebPDecoderConfig *config, const WebPData *wd,
}
VP8StatusCode err = WebPIUpdate(idec, wd->bytes, wd->size);
cairo_surface_mark_dirty(surface);
int x = 0, y = 0, w = 0, h = 0;
(void) WebPIDecodedArea(idec, &x, &y, &w, &h);
WebPIDelete(idec);
if (err == VP8_STATUS_SUSPENDED) {
g_warning("partial WebP");
} else if (err) {
if (err == VP8_STATUS_OK)
return surface;
if (err != VP8_STATUS_SUSPENDED) {
g_set_error(error, FIV_IO_ERROR, FIV_IO_ERROR_OPEN, "%s: %s",
"WebP decoding error", load_libwebp_error(err));
cairo_surface_destroy(surface);
return NULL;
}
cairo_surface_mark_dirty(surface);
return surface;
g_warning("partial WebP");
if (config->input.has_alpha)
return surface;
// Always use transparent black, rather than opaque black.
cairo_surface_t *masked = cairo_image_surface_create(
CAIRO_FORMAT_ARGB32, config->input.width, config->input.height);
cairo_t *cr = cairo_create(masked);
cairo_set_source_surface(cr, surface, 0, 0);
cairo_rectangle(cr, x, y, w, h);
cairo_clip(cr);
cairo_paint(cr);
cairo_destroy(cr);
cairo_surface_destroy(surface);
return masked;
}
static cairo_surface_t *

View File

@ -26,7 +26,7 @@
// TODO(p): Make it possible to use Skia's skcms,
// which also supports premultiplied alpha.
// NOTE: Little CMS will probably start supporting premultiplied alpha in 2022.
// NOTE: Little CMS 2.13 will support premultiplied alpha in 2022.
typedef void *FivIoProfile;
FivIoProfile fiv_io_profile_new(const void *data, size_t len);
FivIoProfile fiv_io_profile_new_sRGB(void);