summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-07-24 16:14:10 +0200
committerinfirit <[email protected]>2014-07-24 20:17:47 +0200
commit04687fe9975fc1115d9bb1304a80529a130a7c43 (patch)
tree581be9e739ff61f73c8bf278dc76fbd322ce03b7
parente748dd5e7e1214841be5cc08b74fde0ea7801870 (diff)
downloadeom-04687fe9975fc1115d9bb1304a80529a130a7c43.tar.bz2
eom-04687fe9975fc1115d9bb1304a80529a130a7c43.tar.xz
Improve the rendering of scaled images
Based on eog commit 2be68aaee33e3e6732e512a22d9ee5b681e95cc5 From Claudio Saavedra <[email protected]>
-rw-r--r--src/eom-scroll-view.c13
1 files 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);