gdkrgb: choose visuals by their color bits, 30-bit ones included
This commit is contained in:
parent
9c57bdb881
commit
7fb43ac250
1 changed files with 16 additions and 8 deletions
24
gdk/gdkrgb.c
24
gdk/gdkrgb.c
|
|
@ -390,17 +390,25 @@ gdk_rgb_score_visual (GdkVisual *visual)
|
|||
if (visual->type == GDK_VISUAL_TRUE_COLOR ||
|
||||
visual->type == GDK_VISUAL_DIRECT_COLOR)
|
||||
{
|
||||
if (visual->depth == 24)
|
||||
{
|
||||
quality = 9;
|
||||
/* Should test for MSB visual here, and set speed if so. */
|
||||
}
|
||||
else if (visual->depth == 16)
|
||||
/* Visuals with alpha (depth 32 with 24 color bits) are skipped */
|
||||
gint bits = visual->red_prec + visual->green_prec + visual->blue_prec;
|
||||
|
||||
if (bits != visual->depth)
|
||||
quality = 0;
|
||||
else if (bits > 24)
|
||||
quality = 10;
|
||||
else if (bits == 24)
|
||||
quality = 9;
|
||||
else if (bits == 16)
|
||||
quality = 8;
|
||||
else if (visual->depth == 15)
|
||||
else if (bits == 15)
|
||||
quality = 7;
|
||||
else if (visual->depth == 8)
|
||||
else if (bits > 8)
|
||||
quality = 5;
|
||||
else if (bits == 8)
|
||||
quality = 4;
|
||||
else if (bits >= 3)
|
||||
quality = 2;
|
||||
}
|
||||
else if (visual->type == GDK_VISUAL_PSEUDO_COLOR ||
|
||||
visual->type == GDK_VISUAL_STATIC_COLOR)
|
||||
|
|
|
|||
Loading…
Reference in a new issue