summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-07-24 15:52:46 +0200
committerinfirit <[email protected]>2014-07-24 20:17:46 +0200
commitc0fcb721f2c8e951f6fd4138efe9d8cb7dd15a1f (patch)
tree8577b7d6ddb04e8c3443607f8266f123ec6f38bc
parentb51631c40b743d224cda4b7fd63e3d60b84218ae (diff)
downloadeom-c0fcb721f2c8e951f6fd4138efe9d8cb7dd15a1f.tar.bz2
eom-c0fcb721f2c8e951f6fd4138efe9d8cb7dd15a1f.tar.xz
Fix the SVG rendering
Based on eog commit 8654e7de549d8edf34c14f3f0a655d8773b1e433 From Claudio Saavedra <[email protected]>
-rw-r--r--src/eom-scroll-view.c54
1 files changed, 51 insertions, 3 deletions
diff --git a/src/eom-scroll-view.c b/src/eom-scroll-view.c
index 9edaaea..b3c7c9b 100644
--- a/src/eom-scroll-view.c
+++ b/src/eom-scroll-view.c
@@ -1829,9 +1829,57 @@ display_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer data)
cairo_fill (cr);
}
- cairo_scale (cr, priv->zoom, priv->zoom);
- cairo_set_source_surface (cr, priv->surface, xofs/priv->zoom, yofs/priv->zoom);
- cairo_paint (cr);
+#ifdef HAVE_RSVG
+ if (eom_image_is_svg (view->priv->image)) {
+ cairo_matrix_t matrix, translate, scale;
+ EomTransform *transform = eom_image_get_transform (priv->image);
+ cairo_matrix_init_identity (&matrix);
+ if (transform) {
+ cairo_matrix_t affine;
+ double image_offset_x = 0., image_offset_y = 0.;
+
+ eom_transform_get_affine (transform, &affine);
+ cairo_matrix_multiply (&matrix, &affine, &matrix);
+
+ 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);
+ break;
+ case EOM_TRANSFORM_ROT_270:
+ case EOM_TRANSFORM_FLIP_VERTICAL:
+ 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);
+ image_offset_y = (double) gdk_pixbuf_get_height (priv->pixbuf);
+ break;
+ case EOM_TRANSFORM_NONE:
+ default:
+ break;
+ }
+ 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);
+ cairo_matrix_multiply (&matrix, &matrix, &scale);
+ cairo_matrix_init_translate (&translate, xofs, yofs);
+ cairo_matrix_multiply (&matrix, &matrix, &translate);
+
+ cairo_set_matrix (cr, &matrix);
+
+ rsvg_handle_render_cairo (eom_image_get_svg (priv->image), cr);
+
+ } else
+#endif /* HAVE_RSVG */
+ {
+ cairo_scale (cr, priv->zoom, priv->zoom);
+ cairo_set_source_surface (cr, priv->surface, xofs/priv->zoom, yofs/priv->zoom);
+ cairo_paint (cr);
+ }
+
cairo_destroy (cr);
return TRUE;
}