[eog] EogScrollView: Clip SVGs to the visible image area



commit 3fb558e1861d3d75bca23946fcf3f62c80daeeec
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 516ab3b..91a3f36 100644
--- a/src/eog-scroll-view.c
+++ b/src/eog-scroll-view.c
@@ -1819,6 +1819,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;
@@ -1865,8 +1872,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]