Bump Wuffs, support partial PNGs through it
This commit is contained in:
parent
8bba456b14
commit
ac6b606ccc
21
fiv-io.c
21
fiv-io.c
|
@ -589,7 +589,6 @@ load_wuffs_frame(struct load_wuffs_frame_context *ctx, GError **error)
|
||||||
WUFFS_BASE__PIXEL_FORMAT__BGRA_NONPREMUL)
|
WUFFS_BASE__PIXEL_FORMAT__BGRA_NONPREMUL)
|
||||||
decode_format = CAIRO_FORMAT_ARGB32;
|
decode_format = CAIRO_FORMAT_ARGB32;
|
||||||
|
|
||||||
bool success = false;
|
|
||||||
unsigned char *targetbuf = NULL;
|
unsigned char *targetbuf = NULL;
|
||||||
cairo_surface_t *surface =
|
cairo_surface_t *surface =
|
||||||
cairo_image_surface_create(decode_format, ctx->width, ctx->height);
|
cairo_image_surface_create(decode_format, ctx->width, ctx->height);
|
||||||
|
@ -627,7 +626,10 @@ load_wuffs_frame(struct load_wuffs_frame_context *ctx, GError **error)
|
||||||
WUFFS_BASE__PIXEL_BLEND__SRC, ctx->workbuf, NULL);
|
WUFFS_BASE__PIXEL_BLEND__SRC, ctx->workbuf, NULL);
|
||||||
if (!wuffs_base__status__is_ok(&status)) {
|
if (!wuffs_base__status__is_ok(&status)) {
|
||||||
set_error(error, wuffs_base__status__message(&status));
|
set_error(error, wuffs_base__status__message(&status));
|
||||||
goto fail;
|
|
||||||
|
// The PNG decoder, at minimum, will flush any pixel data, so use them.
|
||||||
|
if (status.repr != wuffs_base__suspension__short_read)
|
||||||
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->target) {
|
if (ctx->target) {
|
||||||
|
@ -760,19 +762,17 @@ load_wuffs_frame(struct load_wuffs_frame_context *ctx, GError **error)
|
||||||
else
|
else
|
||||||
ctx->result = surface;
|
ctx->result = surface;
|
||||||
|
|
||||||
success = true;
|
|
||||||
ctx->result_tail = surface;
|
ctx->result_tail = surface;
|
||||||
ctx->last_fc = fc;
|
ctx->last_fc = fc;
|
||||||
|
g_free(targetbuf);
|
||||||
|
return wuffs_base__status__is_ok(&status);
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
if (!success) {
|
cairo_surface_destroy(surface);
|
||||||
cairo_surface_destroy(surface);
|
g_clear_pointer(&ctx->result, cairo_surface_destroy);
|
||||||
g_clear_pointer(&ctx->result, cairo_surface_destroy);
|
ctx->result_tail = NULL;
|
||||||
ctx->result_tail = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free(targetbuf);
|
g_free(targetbuf);
|
||||||
return success;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://github.com/google/wuffs/blob/main/example/gifplayer/gifplayer.c
|
// https://github.com/google/wuffs/blob/main/example/gifplayer/gifplayer.c
|
||||||
|
@ -2695,7 +2695,6 @@ fiv_io_open_from_data(
|
||||||
|
|
||||||
#ifdef HAVE_GDKPIXBUF // ------------------------------------------------------
|
#ifdef HAVE_GDKPIXBUF // ------------------------------------------------------
|
||||||
// This is used as a last resort, the rest above is special-cased.
|
// This is used as a last resort, the rest above is special-cased.
|
||||||
// Wuffs #71 and similar concerns make us default to it in all cases.
|
|
||||||
if (!surface) {
|
if (!surface) {
|
||||||
GError *err = NULL;
|
GError *err = NULL;
|
||||||
if ((surface = open_gdkpixbuf(data, len, ctx, &err))) {
|
if ((surface = open_gdkpixbuf(data, len, ctx, &err))) {
|
||||||
|
|
|
@ -425,8 +425,10 @@ read_wide_thumbnail(
|
||||||
bool sRGB = false;
|
bool sRGB = false;
|
||||||
GBytes *thum = cairo_surface_get_user_data(surface, &fiv_io_key_thum);
|
GBytes *thum = cairo_surface_get_user_data(surface, &fiv_io_key_thum);
|
||||||
if (!thum) {
|
if (!thum) {
|
||||||
|
g_clear_error(error);
|
||||||
set_error(error, "not a thumbnail");
|
set_error(error, "not a thumbnail");
|
||||||
} else if (!check_wide_thumbnail_texts(thum, uri, mtime, &sRGB)) {
|
} else if (!check_wide_thumbnail_texts(thum, uri, mtime, &sRGB)) {
|
||||||
|
g_clear_error(error);
|
||||||
set_error(error, "mismatch");
|
set_error(error, "mismatch");
|
||||||
} else {
|
} else {
|
||||||
// TODO(p): Add a function or a non-valueless define to check
|
// TODO(p): Add a function or a non-valueless define to check
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit cc74cb4d30f48c3f5e312e48a8ed87e009f62d9b
|
Subproject commit 123a5c6ede3c052aaf9bbef59afb9410baa2b40a
|
Loading…
Reference in New Issue