mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-30 17:24:55 +01:00
HiDPI: fix thumbnail scaling
This commit is contained in:
parent
36d9ece978
commit
7f4acdb0f4
1 changed files with 12 additions and 2 deletions
|
@ -445,8 +445,18 @@ zathura_page_widget_draw(GtkWidget* widget, cairo_t* cairo)
|
||||||
} else {
|
} else {
|
||||||
const unsigned int height = cairo_image_surface_get_height(priv->thumbnail);
|
const unsigned int height = cairo_image_surface_get_height(priv->thumbnail);
|
||||||
const unsigned int width = cairo_image_surface_get_width(priv->thumbnail);
|
const unsigned int width = cairo_image_surface_get_width(priv->thumbnail);
|
||||||
const unsigned int pheight = (rotation % 180 ? page_width : page_height);
|
unsigned int pheight = (rotation % 180 ? page_width : page_height);
|
||||||
const unsigned int pwidth = (rotation % 180 ? page_height : page_width);
|
unsigned int pwidth = (rotation % 180 ? page_height : page_width);
|
||||||
|
|
||||||
|
#ifdef HAVE_HIDPI_SUPPORT
|
||||||
|
double device_scale_x;
|
||||||
|
double device_scale_y;
|
||||||
|
cairo_surface_get_device_scale(priv->thumbnail, &device_scale_x, &device_scale_y);
|
||||||
|
if (device_scale_x != 0.0 && device_scale_y != 0.0) {
|
||||||
|
pwidth *= device_scale_x;
|
||||||
|
pheight *= device_scale_y;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
cairo_scale(cairo, pwidth / (double)width, pheight / (double)height);
|
cairo_scale(cairo, pwidth / (double)width, pheight / (double)height);
|
||||||
cairo_set_source_surface(cairo, priv->thumbnail, 0, 0);
|
cairo_set_source_surface(cairo, priv->thumbnail, 0, 0);
|
||||||
|
|
Loading…
Reference in a new issue