aboutsummaryrefslogtreecommitdiff
path: root/xorg-server
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-09-29 15:59:48 +0000
committermarha <marha@users.sourceforge.net>2009-09-29 15:59:48 +0000
commit521eb2c71d882202bda107706835d099cc18617e (patch)
tree992fee03daffead9eac6dbf4226579f26504436a /xorg-server
parentd50d1454322ac3c1e46cf30df4822d4118034fa9 (diff)
downloadvcxsrv-521eb2c71d882202bda107706835d099cc18617e.tar.gz
vcxsrv-521eb2c71d882202bda107706835d099cc18617e.tar.bz2
vcxsrv-521eb2c71d882202bda107706835d099cc18617e.zip
Solved run-time downcast problem in debug version.
Diffstat (limited to 'xorg-server')
-rw-r--r--xorg-server/mi/micmap.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/xorg-server/mi/micmap.c b/xorg-server/mi/micmap.c
index 1d26a5232..f6d760b2f 100644
--- a/xorg-server/mi/micmap.c
+++ b/xorg-server/mi/micmap.c
@@ -134,18 +134,29 @@ miInitializeColormap(ColormapPtr pmap)
unsigned limr, limg, limb;
limr = pVisual->redMask >> pVisual->offsetRed;
- limg = pVisual->greenMask >> pVisual->offsetGreen;
- limb = pVisual->blueMask >> pVisual->offsetBlue;
- for(i = 0; i <= maxent; i++)
+ for(i = 0; i <= min(limr,maxent); i++)
{
/* rescale to [0..65535] then rgb bits */
pmap->red[i].co.local.red =
((((i * 65535) / limr) >> shift) * 65535) / lim;
+ }
+ for(; i <= maxent; i++) pmap->red[i].co.local.red = 65535;
+ limg = pVisual->greenMask >> pVisual->offsetGreen;
+ for(i = 0; i <= min(limg,maxent); i++)
+ {
+ /* rescale to [0..65535] then rgb bits */
pmap->green[i].co.local.green =
((((i * 65535) / limg) >> shift) * 65535) / lim;
+ }
+ for(; i <= maxent; i++) pmap->green[i].co.local.green = 65535;
+ limb = pVisual->blueMask >> pVisual->offsetBlue;
+ for(i = 0; i <= min(limb,maxent); i++)
+ {
+ /* rescale to [0..65535] then rgb bits */
pmap->blue[i].co.local.blue =
((((i * 65535) / limb) >> shift) * 65535) / lim;
}
+ for(; i <= maxent; i++) pmap->blue[i].co.local.blue = 65535;
}
else if (pVisual->class == StaticColor)
{