[gnome-desktop] gnome-bg: Fix color conversion for solid backgrounds



commit 97ab041ef5fb120d152cd3d3d192f848b459961c
Author: Andrea Cimitan <andrea cimitan gmail com>
Date:   Mon Jun 11 10:39:36 2012 -0400

    gnome-bg: Fix color conversion for solid backgrounds
    
    gnome_bg_create_surface converts the primary background
    color of a background without a filename from a GdkColor
    to a GdkRGBA.  It does it incorrectly though.
    
    This commit divides each color component by 65535 instead
    of 255, since GdkColor uses 16-bit color values.

 libgnome-desktop/gnome-bg.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/libgnome-desktop/gnome-bg.c b/libgnome-desktop/gnome-bg.c
index 9a583a6..824438e 100644
--- a/libgnome-desktop/gnome-bg.c
+++ b/libgnome-desktop/gnome-bg.c
@@ -1101,9 +1101,9 @@ gnome_bg_create_surface (GnomeBG	    *bg,
 	cr = cairo_create (surface);
 	if (!bg->filename && bg->color_type == G_DESKTOP_BACKGROUND_SHADING_SOLID) {
 		gdk_cairo_set_source_color (cr, &(bg->primary));
-		average.red = bg->primary.red / 255.0;
-		average.green = bg->primary.green / 255.0;
-		average.blue = bg->primary.blue / 255.0;
+		average.red = bg->primary.red / 65535.0;
+		average.green = bg->primary.green / 65535.0;
+		average.blue = bg->primary.blue / 65535.0;
 		average.alpha = 1.0;
 	}
 	else {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]