diff options
author | Brian Paul <[email protected]> | 1999-10-14 18:47:37 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 1999-10-14 18:47:37 +0000 |
commit | 42f252fc06e6fd0bb8c95cb9d238c1416b5d50e7 (patch) | |
tree | d9cf8843457dac0684daa345cd9d927b71156365 /src/mesa/drivers/x11 | |
parent | 3df50407a31cee771aeeaa566a2a9b0f66d86300 (diff) |
fixed an RGB vs CI bug in overlay visual selection
Diffstat (limited to 'src/mesa/drivers/x11')
-rw-r--r-- | src/mesa/drivers/x11/fakeglx.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c index 3dd0f6c2501..c3334e78fe9 100644 --- a/src/mesa/drivers/x11/fakeglx.c +++ b/src/mesa/drivers/x11/fakeglx.c @@ -1,4 +1,4 @@ -/* $Id: fakeglx.c,v 1.9 1999/10/13 18:49:47 brianp Exp $ */ +/* $Id: fakeglx.c,v 1.10 1999/10/14 18:47:37 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -718,6 +718,7 @@ static XVisualInfo *choose_x_visual( Display *dpy, int screen, * Return: pointer to an XVisualInfo or NULL. */ static XVisualInfo *choose_x_overlay_visual( Display *dpy, int scr, + GLboolean rgbFlag, int level, int trans_type, int trans_value, int min_depth, @@ -809,6 +810,16 @@ static XVisualInfo *choose_x_overlay_visual( Display *dpy, int scr, continue; } + /* if RGB was requested, make sure we have True/DirectColor */ + if (rgbFlag && vislist->CLASS != TrueColor + && vislist->CLASS != DirectColor) + continue; + + /* if CI was requested, make sure we have a color indexed visual */ + if (!rgbFlag + && (vislist->CLASS == TrueColor || vislist->CLASS == DirectColor)) + continue; + if (deepvis==NULL || vislist->depth > deepest) { /* YES! found a satisfactory visual */ if (deepvis) { @@ -979,8 +990,21 @@ XVisualInfo *Fake_glXChooseVisual( Display *dpy, int screen, int *list ) } else { /* over/underlay planes */ - vis = choose_x_overlay_visual( dpy, screen, level, trans_type, - trans_value, min_ci, visual_type ); + if (rgb_flag) { + /* rgba overlay */ + int min_rgb = min_red + min_green + min_blue; + if (min_rgb>1 && min_rgb<8) { + /* a special case to be sure we can get a monochrome visual */ + min_rgb = 1; + } + vis = choose_x_overlay_visual( dpy, screen, rgb_flag, level, + trans_type, trans_value, min_rgb, visual_type ); + } + else { + /* color index overlay */ + vis = choose_x_overlay_visual( dpy, screen, rgb_flag, level, + trans_type, trans_value, min_ci, visual_type ); + } } if (vis) { |