Bug 1230 - Pick fails on low precision color buffers
authorNeil Roberts <neil@openedhand.com>
Thu, 6 Nov 2008 12:03:05 +0000 (12:03 +0000)
committerNeil Roberts <neil@openedhand.com>
Thu, 6 Nov 2008 12:03:05 +0000 (12:03 +0000)
* clutter/clutter-main.c (_clutter_id_to_color): When using fuzzy
picking to pick a color for an actor, it would previously set the
fuzzy bit and then all but the most significant of the remaining
unused bits. This meant that for 16-bit displays it would end up
with a strange pattern for the unused bits like 1011 which could
cause it to round up. Now it just sets all but the most
significant of all of the unused bits giving a pattern like
0111. Thanks to Guy Zadickario for the patch.

ChangeLog
clutter/clutter-main.c

index 8d0893f..febaa21 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2008-11-06  Neil Roberts  <neil@linux.intel.com>
 
+       Bug 1230 - Pick fails on low precision color buffers
+
+       * clutter/clutter-main.c (_clutter_id_to_color): When using fuzzy
+       picking to pick a color for an actor, it would previously set the
+       fuzzy bit and then all but the most significant of the remaining
+       unused bits. This meant that for 16-bit displays it would end up
+       with a strange pattern for the unused bits like 1011 which could
+       cause it to round up. Now it just sets all but the most
+       significant of all of the unused bits giving a pattern like
+       0111. Thanks to Guy Zadickario for the patch.
+
+2008-11-06  Neil Roberts  <neil@linux.intel.com>
+
        * clutter/cogl/gles/cogl.c (cogl_perspective): 
        * clutter/cogl/common/cogl-fixed.c (cogl_fixed_sin)
        (cogl_angle_sin, cogl_angle_tan, cogl_fixed_sqrt): Replaced uses
index 4b00fbd..f68e890 100644 (file)
@@ -298,16 +298,16 @@ _clutter_id_to_color (guint id, ClutterColor *col)
    * driver / hw implementation.
    */
   if (ctx->fb_r_mask_used != ctx->fb_r_mask)
-    red = red * 2 + 1;
+    red = red * 2;
   if (ctx->fb_g_mask_used != ctx->fb_g_mask)
-    green = green * 2 + 1;
+    green = green * 2;
   if (ctx->fb_b_mask_used != ctx->fb_b_mask)
-    blue  = blue  * 2 + 1;
+    blue  = blue  * 2;
 
   /* shift up to be full 8bit values */
-  red   = (red   << (8 - ctx->fb_r_mask)) | (0xff >> (ctx->fb_r_mask + 1));
-  green = (green << (8 - ctx->fb_g_mask)) | (0xff >> (ctx->fb_g_mask + 1));
-  blue  = (blue  << (8 - ctx->fb_b_mask)) | (0xff >> (ctx->fb_b_mask + 1));
+  red   = (red   << (8 - ctx->fb_r_mask)) | (0x7f >> (ctx->fb_r_mask_used));
+  green = (green << (8 - ctx->fb_g_mask)) | (0x7f >> (ctx->fb_g_mask_used));
+  blue  = (blue  << (8 - ctx->fb_b_mask)) | (0x7f >> (ctx->fb_b_mask_used));
 
   col->red   = red;
   col->green = green;