Avoid division by zero (thanks to David Ronis).
This commit is contained in:
parent
d8a9244fc4
commit
332d62ba10
|
@ -301,13 +301,21 @@ Cursor X11DRV_GetCursor( Display *display, CURSORICONINFO *ptr )
|
||||||
rscale = 1 << (16 - rbits);
|
rscale = 1 << (16 - rbits);
|
||||||
gscale = 1 << (16 - gbits);
|
gscale = 1 << (16 - gbits);
|
||||||
bscale = 1 << (16 - bbits);
|
bscale = 1 << (16 - bbits);
|
||||||
fg.red = rfg * rscale / fgBits;
|
if (fgBits)
|
||||||
fg.green = gfg * gscale / fgBits;
|
{
|
||||||
fg.blue = bfg * bscale / fgBits;
|
fg.red = rfg * rscale / fgBits;
|
||||||
|
fg.green = gfg * gscale / fgBits;
|
||||||
|
fg.blue = bfg * bscale / fgBits;
|
||||||
|
}
|
||||||
|
else fg.red = fg.green = fg.blue = 0;
|
||||||
bgBits = xmax * ymax - fgBits;
|
bgBits = xmax * ymax - fgBits;
|
||||||
bg.red = rbg * rscale / bgBits;
|
if (bgBits)
|
||||||
bg.green = gbg * gscale / bgBits;
|
{
|
||||||
bg.blue = bbg * bscale / bgBits;
|
bg.red = rbg * rscale / bgBits;
|
||||||
|
bg.green = gbg * gscale / bgBits;
|
||||||
|
bg.blue = bbg * bscale / bgBits;
|
||||||
|
}
|
||||||
|
else bg.red = bg.green = bg.blue = 0;
|
||||||
pixmapBits = XCreateBitmapFromData( display, root_window, pXorBits, xmax, ymax );
|
pixmapBits = XCreateBitmapFromData( display, root_window, pXorBits, xmax, ymax );
|
||||||
if (!pixmapBits)
|
if (!pixmapBits)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue