From 9752b8f03baac58a82d5ded704d4046b344bb343 Mon Sep 17 00:00:00 2001 From: Jeremie Knuesel Date: Wed, 24 Jan 2018 20:56:18 +0100 Subject: [PATCH] HiDPI: fix initial-zooming artifact --- zathura/page-widget.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/zathura/page-widget.c b/zathura/page-widget.c index 3e5875f..ebb41f5 100644 --- a/zathura/page-widget.c +++ b/zathura/page-widget.c @@ -654,8 +654,14 @@ draw_thumbnail_image(cairo_surface_t* surface, size_t max_size) width = width * scale; height = height * scale; + /* note: this always returns 1 and 1 if Cairo too old for device scale API */ + zathura_device_factors_t device = get_safe_device_factors(surface); + const unsigned int user_width = width / device.x; + const unsigned int user_height = height / device.y; + + /* create thumbnail surface, taking width and height as device sizes */ cairo_surface_t *thumbnail; - thumbnail = cairo_surface_create_similar(surface, CAIRO_CONTENT_COLOR, width, height); + thumbnail = cairo_surface_create_similar(surface, CAIRO_CONTENT_COLOR, user_width, user_height); if (thumbnail == NULL) { return NULL; }