From: Adam Jackson Date: Thu, 10 Apr 2014 15:45:37 +0000 (-0400) Subject: xres: Fix size estimation for <8bpp pixmaps (#69057) X-Git-Tag: upstream/1.16~96 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f466fb2432292d74123d701764c432d3aa75ef1d;p=platform%2Fupstream%2Fxorg-server.git xres: Fix size estimation for <8bpp pixmaps (#69057) Just use floats, it's not like this is a performance path. Signed-off-by: Adam Jackson Reviewed-by: Julien Cristau Signed-off-by: Keith Packard --- diff --git a/Xext/xres.c b/Xext/xres.c index b26cbb5..546b942 100644 --- a/Xext/xres.c +++ b/Xext/xres.c @@ -353,9 +353,9 @@ static unsigned long ResGetApproxPixmapBytes(PixmapPtr pix) { unsigned long nPixels; - int bytesPerPixel; + float bytesPerPixel; - bytesPerPixel = pix->drawable.bitsPerPixel >> 3; + bytesPerPixel = (float)pix->drawable.bitsPerPixel / 8.0; nPixels = pix->drawable.width * pix->drawable.height; /* Divide by refcnt as pixmap could be shared between clients,