[Xfce4-commits] <ristretto:master> Pixelate the wallpaper-preview
Stephan Arts
noreply at xfce.org
Thu Sep 15 00:18:02 CEST 2011
Updating branch refs/heads/master
to 83047c105b90fb810235704662b3d80453130082 (commit)
from 8df3d10454f64247f56f5f8da33e70e1acc3ff2e (commit)
commit 83047c105b90fb810235704662b3d80453130082
Author: Stephan Arts <stephan at xfce.org>
Date: Thu Sep 15 00:10:55 2011 +0200
Pixelate the wallpaper-preview
Pixelate the wallpaper-preview when the style can not be rendered
in preview-mode.
src/monitor_chooser.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/src/monitor_chooser.c b/src/monitor_chooser.c
index c3c558f..cb3ab07 100644
--- a/src/monitor_chooser.c
+++ b/src/monitor_chooser.c
@@ -357,6 +357,8 @@ paint_monitor ( cairo_t *cr,
gdouble vscale = 1.0;
PangoLayout *layout;
PangoFontDescription *font_description;
+ GdkPixbuf *dst_pixbuf = NULL;
+
g_return_if_fail (NULL != monitor);
/*
@@ -455,12 +457,14 @@ paint_monitor ( cairo_t *cr,
y/vscale+((height/vscale)-gdk_pixbuf_get_height(monitor->pixbuf))/2);
break;
default:
+ dst_pixbuf = gdk_pixbuf_copy (monitor->pixbuf);
+ gdk_pixbuf_saturate_and_pixelate (monitor->pixbuf, dst_pixbuf, 0.0, TRUE);
hscale = width / (gdk_pixbuf_get_width(monitor->pixbuf));
vscale = hscale;
cairo_scale (cr, hscale, vscale);
gdk_cairo_set_source_pixbuf (cr,
- monitor->pixbuf,
+ dst_pixbuf,
x/hscale+((width/hscale)-gdk_pixbuf_get_width(monitor->pixbuf))/2,
y/vscale+((height/vscale)-gdk_pixbuf_get_height(monitor->pixbuf))/2);
break;
@@ -469,6 +473,11 @@ paint_monitor ( cairo_t *cr,
cairo_paint(cr);
cairo_reset_clip(cr);
cairo_scale (cr, 1/hscale, 1/vscale);
+ if (NULL != dst_pixbuf)
+ {
+ g_object_unref (dst_pixbuf);
+ dst_pixbuf = NULL;
+ }
if (FALSE == active)
{
More information about the Xfce4-commits
mailing list