From 04687fe9975fc1115d9bb1304a80529a130a7c43 Mon Sep 17 00:00:00 2001 From: infirit Date: Thu, 24 Jul 2014 16:14:10 +0200 Subject: Improve the rendering of scaled images Based on eog commit 2be68aaee33e3e6732e512a22d9ee5b681e95cc5 From Claudio Saavedra --- src/eom-scroll-view.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/eom-scroll-view.c b/src/eom-scroll-view.c index 0d634c0..dda4d36 100644 --- a/src/eom-scroll-view.c +++ b/src/eom-scroll-view.c @@ -181,14 +181,8 @@ create_surface_from_pixbuf (EomScrollView *view, GdkPixbuf *pixbuf) cairo_format_t format; cairo_content_t content; - if (gdk_pixbuf_get_has_alpha (pixbuf)) { - format = CAIRO_FORMAT_ARGB32; - content = CAIRO_CONTENT_COLOR | CAIRO_CONTENT_ALPHA; - } else { - format = CAIRO_FORMAT_RGB24; - content = CAIRO_CONTENT_COLOR; - } - + format = CAIRO_FORMAT_ARGB32; + content = CAIRO_CONTENT_COLOR | CAIRO_CONTENT_ALPHA; surface = gdk_window_create_similar_surface (gtk_widget_get_window (view->priv->display), content, gdk_pixbuf_get_width (pixbuf), @@ -1882,8 +1876,11 @@ display_expose_event (GtkWidget *widget, GdkEventExpose *event, 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); if ((is_zoomed_in (view) && priv->interp_type_in == CAIRO_FILTER_NEAREST) || (is_zoomed_out (view) && priv->interp_type_out == CAIRO_FILTER_NEAREST)) cairo_pattern_set_filter (cairo_get_source (cr), CAIRO_FILTER_NEAREST); -- cgit v1.2.1