aboutsummaryrefslogtreecommitdiff
path: root/fiv-thumbnail.c
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-01-23 02:22:35 +0100
committerPřemysl Eric Janouch <p@janouch.name>2022-01-23 04:12:11 +0100
commit07e7d39ea2706bcb8a054720457b597dba9e99ef (patch)
tree3d1f950c82687e984a34079662d56524b065beba /fiv-thumbnail.c
parent562e140a1e9908629ce37cc1aa2cff3b5464e496 (diff)
downloadfiv-07e7d39ea2706bcb8a054720457b597dba9e99ef.tar.gz
fiv-07e7d39ea2706bcb8a054720457b597dba9e99ef.tar.xz
fiv-07e7d39ea2706bcb8a054720457b597dba9e99ef.zip
Produce properly scaled SVG thumbnails
Diffstat (limited to 'fiv-thumbnail.c')
-rw-r--r--fiv-thumbnail.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/fiv-thumbnail.c b/fiv-thumbnail.c
index b69307d..c6a616b 100644
--- a/fiv-thumbnail.c
+++ b/fiv-thumbnail.c
@@ -126,6 +126,16 @@ adjust_thumbnail(cairo_surface_t *thumbnail, double row_height)
scale_x = round(scale_y * w) / w;
}
+ // Vector images should not have orientation, this should handle them all.
+ FivIoRenderClosure *closure =
+ cairo_surface_get_user_data(thumbnail, &fiv_io_key_render);
+ if (closure && orientation <= FivIoOrientation0) {
+ // This API doesn't accept non-uniform scaling; prefer a vertical fit.
+ cairo_surface_t *scaled = closure->render(closure, scale_y);
+ if (scaled)
+ return scaled;
+ }
+
// This will be CAIRO_FORMAT_INVALID with non-image surfaces, which is fine.
cairo_format_t format = cairo_image_surface_get_format(thumbnail);
if (format != CAIRO_FORMAT_INVALID &&