[eog] Improve the rendering of scaled images
- From: Claudio Saavedra <csaavedra src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [eog] Improve the rendering of scaled images
- Date: Wed, 8 Sep 2010 16:43:41 +0000 (UTC)
commit 2be68aaee33e3e6732e512a22d9ee5b681e95cc5
Author: Claudio Saavedra <csaavedra igalia com>
Date: Wed Aug 25 12:32:31 2010 +0300
Improve the rendering of scaled images
Not using CAIRO_CONTENT_ALPHA added a black border to images, when
painted scaled. Also, a extend mode of CAIRO_EXTEND_PAD, clipped to
the image rectangle, prevents the image borders to be drawn blending
out with the background.
https://bugzilla.gnome.org/show_bug.cgi?id=626795
src/eog-scroll-view.c | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/src/eog-scroll-view.c b/src/eog-scroll-view.c
index 67f434f..bb886d3 100644
--- a/src/eog-scroll-view.c
+++ b/src/eog-scroll-view.c
@@ -194,13 +194,8 @@ create_surface_from_pixbuf (EogScrollView *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),
@@ -1892,8 +1887,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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]