Author: kelnos
Date: 2007-02-25 01:37:08 +0000 (Sun, 25 Feb 2007)
New Revision: 25030
Modified:
xfdesktop/trunk/src/xfce-backdrop.c
Log:
use nearest-neighbor interpolation when compositing a backdrop image when the
image src is just centered or tiled onto dest. using bilinear or hyper interp
causes blurriness in those cases. (patch mostly from Henk Boom, bug 2939).
also, a minor optimisation: if the src and dest image sizes are equal, pretend
the image style is 'centered' regardless of whatever it is to avoid extra
scaling or pixbuf copying.
Modified: xfdesktop/trunk/src/xfce-backdrop.c
===================================================================
--- xfdesktop/trunk/src/xfce-backdrop.c 2007-02-24 23:03:30 UTC (rev 25029)
+++ xfdesktop/trunk/src/xfce-backdrop.c 2007-02-25 01:37:08 UTC (rev 25030)
@@ -575,11 +575,27 @@
} else
istyle = backdrop->priv->image_style;
- if(backdrop->priv->bpp < 24)
- interp = GDK_INTERP_HYPER;
- else
- interp = GDK_INTERP_BILINEAR;
+ /* if the image is the same as the screen size, there's no reason to do
+ * any scaling at all */
+ if(w == iw && h == ih)
+ istyle = XFCE_BACKDROP_IMAGE_CENTERED;
+ /* if we don't need to do any scaling, don't do any interpolation. this
+ * fixes a problem where hyper/bilinear filtering causes blurriness in
+ * some images. http://bugzilla.xfce.org/show_bug.cgi?id=2939 */
+ if(XFCE_BACKDROP_IMAGE_TILED == istyle
+ || XFCE_BACKDROP_IMAGE_CENTERED == istyle)
+ {
+ interp = GDK_INTERP_NEAREST;
+ } else {
+ /* if the screen has a bit depth of less than 24bpp, using bilinear
+ * filtering looks crappy (mainly with gradients). */
+ if(backdrop->priv->bpp < 24)
+ interp = GDK_INTERP_HYPER;
+ else
+ interp = GDK_INTERP_BILINEAR;
+ }
+
switch(istyle) {
case XFCE_BACKDROP_IMAGE_CENTERED:
dx = MAX((w - iw) / 2, 0);
_______________________________________________
Xfce4-commits mailing list
[email protected]
http://foo-projects.org/mailman/listinfo/xfce4-commits