[PATCH 09/18] xwin: switch to byte counting functions

Peter Hutterer peter.hutterer at who-t.net
Wed Jul 8 17:05:07 PDT 2009


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 hw/xwin/wincursor.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/hw/xwin/wincursor.c b/hw/xwin/wincursor.c
index bda057b..1a5e456 100644
--- a/hw/xwin/wincursor.c
+++ b/hw/xwin/wincursor.c
@@ -43,8 +43,6 @@
 
 extern Bool	g_fSoftwareCursor;
 
-#define BYTE_COUNT(x) (((x) + 7) / 8)
-
 #define BRIGHTNESS(x) (x##Red * 0.299 + x##Green * 0.587 + x##Blue * 0.114)
 
 #if 0
@@ -199,7 +197,7 @@ winLoadCursor (ScreenPtr pScreen, CursorPtr pCursor, int screen)
   /* Get the number of bytes required to store the whole cursor image 
    * This is roughly (sm_cx * sm_cy) / 8 
    * round up to 8 pixel boundary so we can convert whole bytes */
-  nBytes = BYTE_COUNT(pScreenPriv->cursor.sm_cx) * pScreenPriv->cursor.sm_cy;
+  nBytes = num_bytes_for_bits(pScreenPriv->cursor.sm_cx) * pScreenPriv->cursor.sm_cy;
 
   /* Get the effective width and height */
   nCX = min(pScreenPriv->cursor.sm_cx, pCursor->bits->width);
@@ -214,11 +212,11 @@ winLoadCursor (ScreenPtr pScreen, CursorPtr pCursor, int screen)
    * The first is for an empty mask */
   if (pCursor->bits->emptyMask)
     {
-      int x, y, xmax = BYTE_COUNT(nCX);
+      int x, y, xmax = num_bytes_for_bits(nCX);
       for (y = 0; y < nCY; ++y)
 	for (x = 0; x < xmax; ++x)
 	  {
-	    int nWinPix = BYTE_COUNT(pScreenPriv->cursor.sm_cx) * y + x;
+	    int nWinPix = num_bytes_for_bits(pScreenPriv->cursor.sm_cx) * y + x;
 	    int nXPix = BitmapBytePad(pCursor->bits->width) * y + x;
 
 	    pAnd[nWinPix] = 0;
@@ -230,11 +228,11 @@ winLoadCursor (ScreenPtr pScreen, CursorPtr pCursor, int screen)
     }
   else
     {
-      int x, y, xmax = BYTE_COUNT(nCX);
+      int x, y, xmax = num_bytes_for_bits(nCX);
       for (y = 0; y < nCY; ++y)
 	for (x = 0; x < xmax; ++x)
 	  {
-	    int nWinPix = BYTE_COUNT(pScreenPriv->cursor.sm_cx) * y + x;
+	    int nWinPix = num_bytes_for_bits(pScreenPriv->cursor.sm_cx) * y + x;
 	    int nXPix = BitmapBytePad(pCursor->bits->width) * y + x;
 
 	    unsigned char mask = pCursor->bits->mask[nXPix];
@@ -323,7 +321,7 @@ winLoadCursor (ScreenPtr pScreen, CursorPtr pCursor, int screen)
 		    (*pCur++) = 0;
 		  else /* Within X11 icon bounds */
 		    {
-		      int nWinPix = BYTE_COUNT(pScreenPriv->cursor.sm_cx) * y + (x/8);
+		      int nWinPix = num_bytes_for_bits(pScreenPriv->cursor.sm_cx) * y + (x/8);
 
 		      bit = pAnd[nWinPix];
 		      bit = bit & (1<<(7-(x&7)));
-- 
1.6.3.rc1.2.g0164.dirty



More information about the xorg-devel mailing list