aboutsummaryrefslogtreecommitdiff
path: root/fiv-thumbnail.c
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-03-09 17:58:19 +0100
committerPřemysl Eric Janouch <p@janouch.name>2022-03-09 18:04:36 +0100
commit5c34a6846ac874ada6b64eec9e140cb4e9b04291 (patch)
treee515e7b99f4fbd088f21451e168001a7698b23f3 /fiv-thumbnail.c
parentda507edd055e39fa4f9f703371b8c857031cef8c (diff)
downloadfiv-5c34a6846ac874ada6b64eec9e140cb4e9b04291.tar.gz
fiv-5c34a6846ac874ada6b64eec9e140cb4e9b04291.tar.xz
fiv-5c34a6846ac874ada6b64eec9e140cb4e9b04291.zip
Fix loading huge JPEGs
They fell back to gdk-pixbuf, then misrendered in the thumbnailer, and crashed the program when loaded directly. The second best we can do is scale them down, right after tiling, which is a complex feature to add.
Diffstat (limited to 'fiv-thumbnail.c')
-rw-r--r--fiv-thumbnail.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/fiv-thumbnail.c b/fiv-thumbnail.c
index 7bbfc92..d1d67c4 100644
--- a/fiv-thumbnail.c
+++ b/fiv-thumbnail.c
@@ -163,6 +163,15 @@ adjust_thumbnail(cairo_surface_t *thumbnail, double row_height)
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
cairo_paint(cr);
+
+ // Note that this doesn't get triggered with oversize input surfaces,
+ // even though nothing will be rendered.
+ if (cairo_surface_status(thumbnail) != CAIRO_STATUS_SUCCESS ||
+ cairo_surface_status(scaled) != CAIRO_STATUS_SUCCESS ||
+ cairo_pattern_status(pattern) != CAIRO_STATUS_SUCCESS ||
+ cairo_status(cr) != CAIRO_STATUS_SUCCESS)
+ g_warning("thumbnail scaling failed");
+
cairo_destroy(cr);
return scaled;
}