diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/eom-scroll-view.c | 54 |
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; } |