xres: Fix size estimation for <8bpp pixmaps (#69057)
authorAdam Jackson <ajax@redhat.com>
Thu, 10 Apr 2014 15:45:37 +0000 (11:45 -0400)
committerKeith Packard <keithp@keithp.com>
Tue, 22 Apr 2014 04:39:43 +0000 (21:39 -0700)
Just use floats, it's not like this is a performance path.

Signed-off-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
Xext/xres.c

index b26cbb5..546b942 100644 (file)
@@ -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,