Use a macro to append _accessors to things.
authorAaron Plattner <aplattner@nvidia.com>
Fri, 4 Apr 2008 00:27:08 +0000 (17:27 -0700)
committerSøren Sandmann <sandmann@redhat.com>
Sat, 12 Apr 2008 00:01:45 +0000 (20:01 -0400)
Signed-off-by: Søren Sandmann <sandmann@redhat.com>
pixman/pixman-access.c
pixman/pixman-compose.c
pixman/pixman-private.h
pixman/pixman-transformed.c

index 6c909de..5d91fca 100644 (file)
 
 #include "pixman-private.h"
 
-#ifdef PIXMAN_FB_ACCESSORS
-#define FETCH_PROC_FOR_PICTURE pixman_fetchProcForPicture_accessors
-#define FETCH_PIXEL_PROC_FOR_PICTURE pixman_fetchPixelProcForPicture_accessors
-#define STORE_PROC_FOR_PICTURE pixman_storeProcForPicture_accessors
-#else
-#define FETCH_PROC_FOR_PICTURE pixman_fetchProcForPicture
-#define FETCH_PIXEL_PROC_FOR_PICTURE pixman_fetchPixelProcForPicture
-#define STORE_PROC_FOR_PICTURE pixman_storeProcForPicture
-#endif
-
 /*
  * YV12 setup and access macros
  */
@@ -643,7 +633,7 @@ fbFetch_yv12 (bits_image_t *pict, int x, int line, int width, uint32_t *buffer)
     }
 }
 
-fetchProc FETCH_PROC_FOR_PICTURE (bits_image_t * pict)
+fetchProc ACCESS(pixman_fetchProcForPicture) (bits_image_t * pict)
 {
     switch(pict->format) {
     case PIXMAN_a8r8g8b8: return fbFetch_a8r8g8b8;
@@ -1154,7 +1144,7 @@ fbFetchPixel_yv12 (bits_image_t *pict, int offset, int line)
        (b >= 0 ? b < 0x1000000 ? (b >> 16) & 0x0000ff : 0x0000ff : 0);
 }
 
-fetchPixelProc FETCH_PIXEL_PROC_FOR_PICTURE (bits_image_t * pict)
+fetchPixelProc ACCESS(pixman_fetchPixelProcForPicture) (bits_image_t * pict)
 {
     switch(pict->format) {
     case PIXMAN_a8r8g8b8: return fbFetchPixel_a8r8g8b8;
@@ -1634,7 +1624,7 @@ fbStore_g1 (pixman_image_t *image,
 }
 
 
-storeProc STORE_PROC_FOR_PICTURE (bits_image_t * pict)
+storeProc ACCESS(pixman_storeProcForPicture) (bits_image_t * pict)
 {
     switch(pict->format) {
     case PIXMAN_a8r8g8b8: return fbStore_a8r8g8b8;
index 81b7b1a..09225c7 100644 (file)
 
 #ifdef PIXMAN_FB_ACCESSORS
 #define PIXMAN_COMPOSITE_RECT_GENERAL pixman_composite_rect_general_accessors
-
-#define FETCH_PROC_FOR_PICTURE pixman_fetchProcForPicture_accessors
-#define FETCH_PIXEL_PROC_FOR_PICTURE pixman_fetchPixelProcForPicture_accessors
-#define STORE_PROC_FOR_PICTURE pixman_storeProcForPicture_accessors
-
-#define FB_FETCH_TRANSFORMED fbFetchTransformed_accessors
-#define FB_FETCH_EXTERNAL_ALPHA fbFetchExternalAlpha_accessors
-#define FB_STORE_EXTERNAL_ALPHA fbStoreExternalAlpha_accessors
-
 #else
-
 #define PIXMAN_COMPOSITE_RECT_GENERAL pixman_composite_rect_general_no_accessors
-
-#define FETCH_PROC_FOR_PICTURE pixman_fetchProcForPicture
-#define FETCH_PIXEL_PROC_FOR_PICTURE pixman_fetchPixelProcForPicture
-#define STORE_PROC_FOR_PICTURE pixman_storeProcForPicture
-
-#define FB_FETCH_TRANSFORMED fbFetchTransformed
-#define FB_FETCH_EXTERNAL_ALPHA fbFetchExternalAlpha
-#define FB_STORE_EXTERNAL_ALPHA fbStoreExternalAlpha
-
 #endif
 
 static unsigned int
@@ -124,7 +105,7 @@ static void fbFetchSolid(bits_image_t * pict, int x, int y, int width, uint32_t
 {
     uint32_t color;
     uint32_t *end;
-    fetchPixelProc fetch = FETCH_PIXEL_PROC_FOR_PICTURE(pict);
+    fetchPixelProc fetch = ACCESS(pixman_fetchPixelProcForPicture)(pict);
 
     color = fetch(pict, 0, 0);
 
@@ -135,7 +116,7 @@ static void fbFetchSolid(bits_image_t * pict, int x, int y, int width, uint32_t
 
 static void fbFetch(bits_image_t * pict, int x, int y, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits)
 {
-    fetchProc fetch = FETCH_PROC_FOR_PICTURE(pict);
+    fetchProc fetch = ACCESS(pixman_fetchProcForPicture)(pict);
 
     fetch(pict, x, y, width, buffer);
 }
@@ -145,7 +126,7 @@ fbStore(bits_image_t * pict, int x, int y, int width, uint32_t *buffer)
 {
     uint32_t *bits;
     int32_t stride;
-    storeProc store = STORE_PROC_FOR_PICTURE(pict);
+    storeProc store = ACCESS(pixman_storeProcForPicture)(pict);
     const pixman_indexed_t * indexed = pict->indexed;
 
     bits = pict->bits;
@@ -191,7 +172,7 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data,
 
        if (bits->common.alpha_map)
        {
-           fetchSrc = (scanFetchProc)FB_FETCH_EXTERNAL_ALPHA;
+           fetchSrc = (scanFetchProc)ACCESS(fbFetchExternalAlpha);
        }
        else if ((bits->common.repeat == PIXMAN_REPEAT_NORMAL || bits->common.repeat == PIXMAN_REPEAT_PAD) &&
                 bits->width == 1 &&
@@ -207,7 +188,7 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data,
        }
        else
        {
-           fetchSrc = (scanFetchProc)FB_FETCH_TRANSFORMED;
+           fetchSrc = (scanFetchProc)ACCESS(fbFetchTransformed);
        }
     }
 
@@ -230,7 +211,7 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data,
 
            if (bits->common.alpha_map)
            {
-               fetchMask = (scanFetchProc)FB_FETCH_EXTERNAL_ALPHA;
+               fetchMask = (scanFetchProc)ACCESS(fbFetchExternalAlpha);
            }
            else if ((bits->common.repeat == PIXMAN_REPEAT_NORMAL || bits->common.repeat == PIXMAN_REPEAT_PAD) &&
                     bits->width == 1 && bits->height == 1)
@@ -242,14 +223,14 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data,
                     && bits->common.repeat != PIXMAN_REPEAT_PAD)
                fetchMask = (scanFetchProc)fbFetch;
            else
-               fetchMask = (scanFetchProc)FB_FETCH_TRANSFORMED;
+               fetchMask = (scanFetchProc)ACCESS(fbFetchTransformed);
        }
     }
 
     if (data->dest->common.alpha_map)
     {
-       fetchDest = (scanFetchProc)FB_FETCH_EXTERNAL_ALPHA;
-       store = (scanStoreProc)FB_STORE_EXTERNAL_ALPHA;
+       fetchDest = (scanFetchProc)ACCESS(fbFetchExternalAlpha);
+       store = (scanStoreProc)ACCESS(fbStoreExternalAlpha);
 
        if (data->op == PIXMAN_OP_CLEAR || data->op == PIXMAN_OP_SRC)
            fetchDest = NULL;
index b686770..869bc80 100644 (file)
@@ -510,6 +510,8 @@ union pixman_image
 
 #ifdef PIXMAN_FB_ACCESSORS
 
+#define ACCESS(sym) sym##_accessors
+
 #define READ(img, ptr)                                                 \
     ((img)->common.read_func ((ptr), sizeof(*(ptr))))
 #define WRITE(img, ptr,val)                                            \
@@ -535,6 +537,8 @@ union pixman_image
 
 #else
 
+#define ACCESS(sym) sym
+
 #define READ(img, ptr)         (*(ptr))
 #define WRITE(img, ptr, val)   (*(ptr) = (val))
 #define MEMCPY_WRAPPED(img, dst, src, size)                                    \
index 19085ca..e3ef17e 100644 (file)
 
 #include "pixman-private.h"
 
-#ifdef PIXMAN_FB_ACCESSORS
-#define FETCH_PROC_FOR_PICTURE pixman_fetchProcForPicture_accessors
-#define FETCH_PIXEL_PROC_FOR_PICTURE pixman_fetchPixelProcForPicture_accessors
-#define STORE_PROC_FOR_PICTURE pixman_storeProcForPicture_accessors
-
-#define FB_FETCH_TRANSFORMED fbFetchTransformed_accessors
-#define FB_FETCH_EXTERNAL_ALPHA fbFetchExternalAlpha_accessors
-#define FB_STORE_EXTERNAL_ALPHA fbStoreExternalAlpha_accessors
-
-#else
-
-#define FETCH_PROC_FOR_PICTURE pixman_fetchProcForPicture
-#define FETCH_PIXEL_PROC_FOR_PICTURE pixman_fetchPixelProcForPicture
-#define STORE_PROC_FOR_PICTURE pixman_storeProcForPicture
-
-#define FB_FETCH_TRANSFORMED fbFetchTransformed
-#define FB_FETCH_EXTERNAL_ALPHA fbFetchExternalAlpha
-#define FB_STORE_EXTERNAL_ALPHA fbStoreExternalAlpha
-
-#endif
-
 /*
  * Fetch from region strategies
  */
@@ -93,7 +72,7 @@ fbFetchTransformed_Nearest_Normal(bits_image_t * pict, int width, uint32_t *buff
     int x, y, i;
 
     /* initialize the two function pointers */
-    fetch = FETCH_PIXEL_PROC_FOR_PICTURE(pict);
+    fetch = ACCESS(pixman_fetchPixelProcForPicture)(pict);
 
     if(pixman_region_n_rects (pict->common.src_clip) == 1)
         fetchFromRegion = fbFetchFromNoRegion;
@@ -139,7 +118,7 @@ fbFetchTransformed_Nearest_Pad(bits_image_t * pict, int width, uint32_t *buffer,
     int x, y, i;
 
     /* initialize the two function pointers */
-    fetch = FETCH_PIXEL_PROC_FOR_PICTURE(pict);
+    fetch = ACCESS(pixman_fetchPixelProcForPicture)(pict);
 
     if(pixman_region_n_rects (pict->common.src_clip) == 1)
         fetchFromRegion = fbFetchFromNoRegion;
@@ -186,7 +165,7 @@ fbFetchTransformed_Nearest_General(bits_image_t * pict, int width, uint32_t *buf
     int x, y, i;
 
     /* initialize the two function pointers */
-    fetch = FETCH_PIXEL_PROC_FOR_PICTURE(pict);
+    fetch = ACCESS(pixman_fetchPixelProcForPicture)(pict);
 
     if(pixman_region_n_rects (pict->common.src_clip) == 1)
     {
@@ -229,7 +208,7 @@ fbFetchTransformed_Bilinear_Normal(bits_image_t * pict, int width, uint32_t *buf
     int i;
 
     /* initialize the two function pointers */
-    fetch = FETCH_PIXEL_PROC_FOR_PICTURE(pict);
+    fetch = ACCESS(pixman_fetchPixelProcForPicture)(pict);
 
     if(pixman_region_n_rects (pict->common.src_clip) == 1)
         fetchFromRegion = fbFetchFromNoRegion;
@@ -306,7 +285,7 @@ fbFetchTransformed_Bilinear_Pad(bits_image_t * pict, int width, uint32_t *buffer
     int i;
 
     /* initialize the two function pointers */
-    fetch = FETCH_PIXEL_PROC_FOR_PICTURE(pict);
+    fetch = ACCESS(pixman_fetchPixelProcForPicture)(pict);
 
     if(pixman_region_n_rects (pict->common.src_clip) == 1)
         fetchFromRegion = fbFetchFromNoRegion;
@@ -383,7 +362,7 @@ fbFetchTransformed_Bilinear_General(bits_image_t * pict, int width, uint32_t *bu
     int i;
 
     /* initialize the two function pointers */
-    fetch = FETCH_PIXEL_PROC_FOR_PICTURE(pict);
+    fetch = ACCESS(pixman_fetchPixelProcForPicture)(pict);
 
     if(pixman_region_n_rects (pict->common.src_clip) == 1)
     {
@@ -465,7 +444,7 @@ fbFetchTransformed_Convolution(bits_image_t * pict, int width, uint32_t *buffer,
     int32_t cheight = pixman_fixed_to_int(params[1]);
     int xoff = (params[0] - pixman_fixed_1) >> 1;
     int yoff = (params[1] - pixman_fixed_1) >> 1;
-    fetch = FETCH_PIXEL_PROC_FOR_PICTURE(pict);
+    fetch = ACCESS(pixman_fetchPixelProcForPicture)(pict);
 
     params += 2;
     for (i = 0; i < width; ++i) {
@@ -567,7 +546,8 @@ adjust (pixman_vector_t *v, pixman_vector_t *u, pixman_fixed_t adjustment)
 }
 
 void
-FB_FETCH_TRANSFORMED(bits_image_t * pict, int x, int y, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits)
+ACCESS(fbFetchTransformed)(bits_image_t * pict, int x, int y, int width,
+                           uint32_t *buffer, uint32_t *mask, uint32_t maskBits)
 {
     uint32_t     *bits;
     int32_t    stride;
@@ -650,24 +630,25 @@ FB_FETCH_TRANSFORMED(bits_image_t * pict, int x, int y, int width, uint32_t *buf
 #define SCANLINE_BUFFER_LENGTH 2048
 
 void
-FB_FETCH_EXTERNAL_ALPHA(bits_image_t * pict, int x, int y, int width,
-                        uint32_t *buffer, uint32_t *mask, uint32_t maskBits)
+ACCESS(fbFetchExternalAlpha)(bits_image_t * pict, int x, int y, int width,
+                             uint32_t *buffer, uint32_t *mask,
+                             uint32_t maskBits)
 {
     int i;
     uint32_t _alpha_buffer[SCANLINE_BUFFER_LENGTH];
     uint32_t *alpha_buffer = _alpha_buffer;
 
     if (!pict->common.alpha_map) {
-        FB_FETCH_TRANSFORMED (pict, x, y, width, buffer, mask, maskBits);
+        ACCESS(fbFetchTransformed) (pict, x, y, width, buffer, mask, maskBits);
        return;
     }
     if (width > SCANLINE_BUFFER_LENGTH)
         alpha_buffer = (uint32_t *) pixman_malloc_ab (width, sizeof(uint32_t));
 
-    FB_FETCH_TRANSFORMED(pict, x, y, width, buffer, mask, maskBits);
-    FB_FETCH_TRANSFORMED((bits_image_t *)pict->common.alpha_map, x - pict->common.alpha_origin.x,
-                        y - pict->common.alpha_origin.y, width, alpha_buffer,
-                        mask, maskBits);
+    ACCESS(fbFetchTransformed)(pict, x, y, width, buffer, mask, maskBits);
+    ACCESS(fbFetchTransformed)((bits_image_t *)pict->common.alpha_map, x - pict->common.alpha_origin.x,
+                               y - pict->common.alpha_origin.y, width,
+                               alpha_buffer, mask, maskBits);
     for (i = 0; i < width; ++i) {
         if (!mask || mask[i] & maskBits)
        {
@@ -684,8 +665,8 @@ FB_FETCH_EXTERNAL_ALPHA(bits_image_t * pict, int x, int y, int width,
 }
 
 void
-FB_STORE_EXTERNAL_ALPHA(bits_image_t * pict, int x, int y, int width,
-                        uint32_t *buffer)
+ACCESS(fbStoreExternalAlpha)(bits_image_t * pict, int x, int y, int width,
+                             uint32_t *buffer)
 {
     uint32_t *bits, *alpha_bits;
     int32_t stride, astride;
@@ -702,8 +683,8 @@ FB_STORE_EXTERNAL_ALPHA(bits_image_t * pict, int x, int y, int width,
        return;
     }
 
-    store = STORE_PROC_FOR_PICTURE(pict);
-    astore = STORE_PROC_FOR_PICTURE(pict->common.alpha_map);
+    store = ACCESS(pixman_storeProcForPicture)(pict);
+    astore = ACCESS(pixman_storeProcForPicture)(pict->common.alpha_map);
     aindexed = pict->common.alpha_map->indexed;
 
     ax = x;