[eog/gnome-3-4] EogScrollView: Clip SVGs to the visible image area



commit df654e3b38bdfefaca3ade12f4fdb6843b8591cf
Author: Felix Riemann <friemann gnome org>
Date:   Fri Jun 8 18:40:20 2012 +0200

    EogScrollView: Clip SVGs to the visible image area
    
    This avoids showing image data present in those images but outside
    of the defined image boundaries. That could make the UI look like
    it is misbehaving (e.g. not showing scrollbars).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=676486

 src/eog-scroll-view.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/eog-scroll-view.c b/src/eog-scroll-view.c
index 335b42f..4fdab57 100644
--- a/src/eog-scroll-view.c
+++ b/src/eog-scroll-view.c
@@ -1828,6 +1828,13 @@ display_draw (GtkWidget *widget, cairo_t *cr, gpointer data)
 		cairo_fill (cr);
 	}
 
+	/* Make sure the image is only drawn as large as needed.
+	 * This is especially necessary for SVGs where there might
+	 * be more image data available outside the image boundaries.
+	 */
+	cairo_rectangle (cr, xofs, yofs, scaled_width, scaled_height);
+	cairo_clip (cr);
+
 #ifdef HAVE_RSVG
 	if (eog_image_is_svg (view->priv->image)) {
 		cairo_matrix_t matrix, translate, scale;
@@ -1874,8 +1881,6 @@ display_draw (GtkWidget *widget, cairo_t *cr, gpointer data)
 	} else
 #endif /* HAVE_RSVG */
 	{
-		cairo_rectangle (cr, xofs, yofs, scaled_width, scaled_height);
-		cairo_clip (cr);
 		cairo_scale (cr, priv->zoom, priv->zoom);
 		cairo_set_source_surface (cr, priv->surface, xofs/priv->zoom, yofs/priv->zoom);
 		cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_PAD);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]