Set bits within visual->depth that aren't used for color to 1s, in case

Thu May 27 16:36:22 2004  Owen Taylor  <otaylor@redhat.com>

        * gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc_colors): Set
        bits within visual->depth that aren't used for color to
        1s, in case they are alpha.
This commit is contained in:
Owen Taylor 2004-05-27 20:46:58 +00:00 committed by Owen Taylor
parent 0edc5cc877
commit ac8b3dc1ae
5 changed files with 31 additions and 1 deletions

View File

@ -1,3 +1,9 @@
Thu May 27 16:36:22 2004 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc_colors): Set
bits within visual->depth that aren't used for color to
1s, in case they are alpha.
2004-05-27 Anders Carlsson <andersca@gnome.org>
* gtk/gtkfilechooserdefault.c (save_folder_combo_create):

View File

@ -1,3 +1,9 @@
Thu May 27 16:36:22 2004 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc_colors): Set
bits within visual->depth that aren't used for color to
1s, in case they are alpha.
2004-05-27 Anders Carlsson <andersca@gnome.org>
* gtk/gtkfilechooserdefault.c (save_folder_combo_create):

View File

@ -1,3 +1,9 @@
Thu May 27 16:36:22 2004 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc_colors): Set
bits within visual->depth that aren't used for color to
1s, in case they are alpha.
2004-05-27 Anders Carlsson <andersca@gnome.org>
* gtk/gtkfilechooserdefault.c (save_folder_combo_create):

View File

@ -1,3 +1,9 @@
Thu May 27 16:36:22 2004 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkcolor-x11.c (gdk_colormap_alloc_colors): Set
bits within visual->depth that aren't used for color to
1s, in case they are alpha.
2004-05-27 Anders Carlsson <andersca@gnome.org>
* gtk/gtkfilechooserdefault.c (save_folder_combo_create):

View File

@ -1126,7 +1126,13 @@ gdk_colormap_alloc_colors (GdkColormap *colormap,
for (i = 0; i < ncolors; i++)
{
colors[i].pixel = (((colors[i].red >> (16 - visual->red_prec)) << visual->red_shift) +
/* If bits not used for color are used for something other than padding,
* it's likely alpha, so we set them to 1s.
*/
guint32 unused = ~ (visual->red_mask | visual->green_mask | visual->blue_mask |
(((~(guint32)0)) << visual->depth));
colors[i].pixel = (unused +
((colors[i].red >> (16 - visual->red_prec)) << visual->red_shift) +
((colors[i].green >> (16 - visual->green_prec)) << visual->green_shift) +
((colors[i].blue >> (16 - visual->blue_prec)) << visual->blue_shift));
success[i] = TRUE;