diff options
author | Victor Kareh <[email protected]> | 2018-05-02 13:43:06 -0400 |
---|---|---|
committer | raveit65 <[email protected]> | 2018-05-13 11:37:01 +0200 |
commit | 2f04a373158698e850489c3d9e268fc6783d9587 (patch) | |
tree | 8fd7b98e333e83d7b96346ca1be66e23cb7f7703 /src | |
parent | bca6a644d6f4f49be86630a356ba02146eae4bfe (diff) | |
download | eom-2f04a373158698e850489c3d9e268fc6783d9587.tar.bz2 eom-2f04a373158698e850489c3d9e268fc6783d9587.tar.xz |
svg: Fix offset coordinates when transforming SVG images on HiDPI displays
Diffstat (limited to 'src')
-rw-r--r-- | src/eom-scroll-view.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/eom-scroll-view.c b/src/eom-scroll-view.c index a461b67..7307368 100644 --- a/src/eom-scroll-view.c +++ b/src/eom-scroll-view.c @@ -1273,17 +1273,17 @@ display_draw (GtkWidget *widget, cairo_t *cr, gpointer data) switch (eom_transform_get_transform_type (transform)) { case EOM_TRANSFORM_ROT_90: case EOM_TRANSFORM_FLIP_HORIZONTAL: - image_offset_x = (double) gdk_pixbuf_get_width (priv->pixbuf) / priv->scale; + image_offset_x = (double) gdk_pixbuf_get_width (priv->pixbuf); break; case EOM_TRANSFORM_ROT_270: case EOM_TRANSFORM_FLIP_VERTICAL: - image_offset_y = (double) gdk_pixbuf_get_height (priv->pixbuf) / priv->scale; + image_offset_y = (double) gdk_pixbuf_get_height (priv->pixbuf); break; case EOM_TRANSFORM_ROT_180: case EOM_TRANSFORM_TRANSPOSE: case EOM_TRANSFORM_TRANSVERSE: - image_offset_x = (double) gdk_pixbuf_get_width (priv->pixbuf) / priv->scale; - image_offset_y = (double) gdk_pixbuf_get_height (priv->pixbuf) / priv->scale; + image_offset_x = (double) gdk_pixbuf_get_width (priv->pixbuf); + image_offset_y = (double) gdk_pixbuf_get_height (priv->pixbuf); break; case EOM_TRANSFORM_NONE: default: @@ -1292,7 +1292,8 @@ display_draw (GtkWidget *widget, cairo_t *cr, gpointer data) cairo_matrix_init_translate (&translate, image_offset_x, image_offset_y); cairo_matrix_multiply (&matrix, &matrix, &translate); } - cairo_matrix_init_scale (&scale, priv->zoom, priv->zoom); + /* Zoom factor for SVGs is already scaled, so scale back to application pixels. */ + cairo_matrix_init_scale (&scale, priv->zoom / priv->scale, priv->zoom / priv->scale); cairo_matrix_multiply (&matrix, &matrix, &scale); cairo_matrix_init_translate (&translate, xofs, yofs); cairo_matrix_multiply (&matrix, &matrix, &translate); |