[evolution-patches] Fix for color shift in image toggle items.



This fixes a long standing bug in the color chosen for toggle items.

I'm pasting and attaching in case my evo is still broken.

--Larry

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/ChangeLog,v
retrieving revision 1.909
diff -u -p -r1.909 ChangeLog
--- ChangeLog   8 Aug 2003 09:24:35 -0000       1.909
+++ ChangeLog   12 Aug 2003 22:06:40 -0000
@@ -1,3 +1,8 @@
+2003-08-12  Larry Ewing  <lewing ximian com>
+
+       * e-cell-toggle.c (check_cache): actually chose the right color to
+       composite over when caching the pixmap.
+
 2003-08-08  Stanislav Brabec  <sbrabec suse cz>
                                                                                
        * Makefile.am: Removed trailing backslash on last line.
Index: e-cell-toggle.c
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/e-cell-toggle.c,v
retrieving revision 1.37
diff -u -p -r1.37 e-cell-toggle.c
--- e-cell-toggle.c     17 Nov 2002 00:02:52 -0000      1.37
+++ e-cell-toggle.c     12 Aug 2003 22:06:40 -0000
@@ -135,7 +135,7 @@ check_cache (ECellToggleView *toggle_vie
        if (PIXMAP_CACHE (toggle_view, cache_seq, image_seq) == NULL) {
                GdkPixbuf *image = etog->images[image_seq];
                GdkPixbuf *flat;
-               guint32 color = 0xffffff;
+               GdkColor  color;
                int width = gdk_pixbuf_get_width (image);
                int height = gdk_pixbuf_get_height (image);
                                                                                
@@ -146,35 +146,18 @@ check_cache (ECellToggleView *toggle_vie
                                                                                
                switch (cache_seq % 3) {
                case 0:
-                       color = RGB_COLOR (GTK_WIDGET (toggle_view->canvas)->style->bg [GTK_STATE_SELECTED]);
+                       color = GTK_WIDGET (toggle_view->canvas)->style->bg [GTK_STATE_SELECTED];
                        break;
                case 1:
-                       color = RGB_COLOR (GTK_WIDGET (toggle_view->canvas)->style->bg [GTK_STATE_ACTIVE]);
+                       color = GTK_WIDGET (toggle_view->canvas)->style->bg [GTK_STATE_ACTIVE];
                        break;
                case 2:
-                       color = RGB_COLOR (GTK_WIDGET (toggle_view->canvas)->style->base [GTK_STATE_NORMAL]);
+                       color = GTK_WIDGET (toggle_view->canvas)->style->base [GTK_STATE_NORMAL];
                        break;
                }
                                                                                
                if (cache_seq >= 3) {
-                       double r, g, b, h, s, v;
-                       r = ((color >> 16) & 0xff) / 255.0f;
-                       g = ((color >> 8) & 0xff) / 255.0f;
-                       b = (color & 0xff) / 255.0f;
-
-                       e_rgb_to_hsv (r, g, b, &h, &s, &v);
-
-                       if (v - 0.05f < 0) {
-                               v += 0.05f;
-                       } else {
-                               v -= 0.05f;
-                       }
-
-                       e_hsv_to_rgb (h, s, v, &r, &g, &b);
-
-                       color = ((((int)(r * 255.0f)) & 0xff) << 16) +
-                               ((((int)(g * 255.0f)) & 0xff) << 8) +
-                               (((int)(b * 255.0f)) & 0xff);
+                       e_hsv_tweak (&color, 0.0f, 0.0f, -0.07f);
                }
                                                                                
                flat = gdk_pixbuf_composite_color_simple (image,
@@ -182,7 +165,7 @@ check_cache (ECellToggleView *toggle_vie
                                                          GDK_INTERP_BILINEAR,
                                                          255,
                                                          1,
-                                                         color, color);
+                                                         RGB_COLOR (color), RGB_COLOR (color));
                                                                                
                gdk_pixbuf_render_to_drawable (flat, PIXMAP_CACHE (toggle_view, cache_seq, image_seq),
                                               toggle_view->gc,


SW5kZXg6IENoYW5nZUxvZw0KPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PQ0KUkNTIGZpbGU6IC9jdnMvZ25vbWUvZ2FsL2dh
bC9lLXRhYmxlL0NoYW5nZUxvZyx2DQpyZXRyaWV2aW5nIHJldmlzaW9uIDEuOTA5DQpkaWZmIC11
IC1wIC1yMS45MDkgQ2hhbmdlTG9nDQotLS0gQ2hhbmdlTG9nCTggQXVnIDIwMDMgMDk6MjQ6MzUg
LTAwMDAJMS45MDkNCisrKyBDaGFuZ2VMb2cJMTIgQXVnIDIwMDMgMjI6MDY6NDAgLTAwMDANCkBA
IC0xLDMgK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