diff options
author | George Sapountzis <gsap7@yahoo.gr> | 2008-05-23 22:39:35 +0300 |
---|---|---|
committer | George Sapountzis <gsap7@yahoo.gr> | 2008-05-23 22:40:26 +0300 |
commit | 6c72961d8fa1ab1543f1b3e2cc7d34ff6d254bf8 (patch) | |
tree | 6af02c4469d8f49e3bba50b35a07248c21b146b8 /glx/glxscreens.c | |
parent | 21a8052fdca2115668dfc747b0b58db437b4eb6d (diff) |
glx: fix memory corruption with r5g6b5
should cherry-pick to xserver-1.5
Diffstat (limited to 'glx/glxscreens.c')
-rw-r--r-- | glx/glxscreens.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/glx/glxscreens.c b/glx/glxscreens.c index 5859de0b1..cc7054a64 100644 --- a/glx/glxscreens.c +++ b/glx/glxscreens.c @@ -420,10 +420,13 @@ findFirstSet(unsigned int v) static void initGlxVisual(VisualPtr visual, __GLXconfig *config) { + int maxBits; + maxBits = max(config->redBits, max(config->greenBits, config->blueBits)); + config->visualID = visual->vid; visual->class = glxConvertToXVisualType(config->visualType); - visual->bitsPerRGBValue = config->redBits; - visual->ColormapEntries = 1 << config->redBits; + visual->bitsPerRGBValue = maxBits; + visual->ColormapEntries = 1 << maxBits; visual->nplanes = config->redBits + config->greenBits + config->blueBits; visual->redMask = config->redMask; |