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.
This commit is contained in:
Neil Roberts 2008-11-06 12:03:05 +00:00
parent f7d447cfde
commit b6cc701930
2 changed files with 19 additions and 6 deletions

View File

@ -1,3 +1,16 @@
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):

View 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;