[Pixman] [PATCH 3/5] Rename FAST_PATH_NO_WIDE_FORMAT to FAST_PATH_NARROW_FORMAT

Søren Sandmann sandmann at daimi.au.dk
Tue Sep 14 06:18:20 PDT 2010


From: Søren Sandmann Pedersen <ssp at redhat.com>

This avoids a negative in the name. Also, by renaming the "wide"
variable in pixman-general.c to "narrow" and fixing up the logic
correspondingly, the code there reads a lot more straightforwardly.
---
 pixman/pixman-fast-path.c |    2 +-
 pixman/pixman-general.c   |   46 ++++++++++++++++++++++----------------------
 pixman/pixman-image.c     |    4 +-
 pixman/pixman-private.h   |    6 ++--
 4 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/pixman/pixman-fast-path.c b/pixman/pixman-fast-path.c
index f03752f..6dee472 100644
--- a/pixman/pixman-fast-path.c
+++ b/pixman/pixman-fast-path.c
@@ -1864,7 +1864,7 @@ static const pixman_fast_path_t c_fast_paths[] =
      FAST_PATH_NO_ALPHA_MAP	|					\
      FAST_PATH_NEAREST_FILTER	|					\
      FAST_PATH_NO_ACCESSORS	|					\
-     FAST_PATH_NO_WIDE_FORMAT)
+     FAST_PATH_NARROW_FORMAT)
 
 #define SIMPLE_NEAREST_FAST_PATH(op,s,d,func)				\
     {   PIXMAN_OP_ ## op,						\
diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index fc742c0..fc276bd 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -63,11 +63,11 @@ general_composite_rect  (pixman_implementation_t *imp,
 	mask && mask->type == BITS ? mask->bits.format : 0;
     const pixman_format_code_t dest_format =
 	dest->type == BITS ? dest->bits.format : 0;
-    const int src_wide = PIXMAN_FORMAT_IS_WIDE (src_format);
-    const int mask_wide = mask && PIXMAN_FORMAT_IS_WIDE (mask_format);
-    const int dest_wide = PIXMAN_FORMAT_IS_WIDE (dest_format);
-    const int wide = src_wide || mask_wide || dest_wide;
-    const int Bpp = wide ? 8 : 4;
+    const int src_narrow = !PIXMAN_FORMAT_IS_WIDE (src_format);
+    const int mask_narrow = !mask || !PIXMAN_FORMAT_IS_WIDE (mask_format);
+    const int dest_narrow = !PIXMAN_FORMAT_IS_WIDE (dest_format);
+    const int narrow = src_narrow && mask_narrow && dest_narrow;
+    const int Bpp = narrow ? 4 : 8;
     uint8_t *scanline_buffer = stack_scanline_buffer;
     uint8_t *src_buffer, *mask_buffer, *dest_buffer;
     fetch_scanline_t fetch_src = NULL, fetch_mask = NULL, fetch_dest = NULL;
@@ -106,29 +106,29 @@ general_composite_rect  (pixman_implementation_t *imp,
 
     if (op == PIXMAN_OP_CLEAR)
 	fetch_src = NULL;
-    else if (wide)
-	fetch_src = _pixman_image_get_scanline_64;
-    else
+    else if (narrow)
 	fetch_src = _pixman_image_get_scanline_32;
+    else
+	fetch_src = _pixman_image_get_scanline_64;
 
     if (!mask || op == PIXMAN_OP_CLEAR)
 	fetch_mask = NULL;
-    else if (wide)
-	fetch_mask = _pixman_image_get_scanline_64;
-    else
+    else if (narrow)
 	fetch_mask = _pixman_image_get_scanline_32;
+    else
+	fetch_mask = _pixman_image_get_scanline_64;
 
     if (op == PIXMAN_OP_CLEAR || op == PIXMAN_OP_SRC)
 	fetch_dest = NULL;
-    else if (wide)
-	fetch_dest = _pixman_image_get_scanline_64;
-    else
+    else if (narrow)
 	fetch_dest = _pixman_image_get_scanline_32;
-
-    if (wide)
-	store = _pixman_image_store_scanline_64;
     else
+	fetch_dest = _pixman_image_get_scanline_64;
+
+    if (narrow)
 	store = _pixman_image_store_scanline_32;
+    else
+	store = _pixman_image_store_scanline_64;
 
     /* Skip the store step and composite directly into the
      * destination if the output format of the compose func matches
@@ -148,7 +148,7 @@ general_composite_rect  (pixman_implementation_t *imp,
 	  op == PIXMAN_OP_OUT_REVERSE	||
 	  op == PIXMAN_OP_DST)))
     {
-	if (!wide &&
+	if (narrow &&
 	    !dest->common.alpha_map &&
 	    !dest->bits.write_func)
 	{
@@ -175,19 +175,19 @@ general_composite_rect  (pixman_implementation_t *imp,
         mask->common.component_alpha    &&
         PIXMAN_FORMAT_RGB (mask->bits.format);
 
-    if (wide)
+    if (narrow)
     {
 	if (component_alpha)
-	    compose = (pixman_combine_32_func_t)_pixman_implementation_combine_64_ca;
+	    compose = _pixman_implementation_combine_32_ca;
 	else
-	    compose = (pixman_combine_32_func_t)_pixman_implementation_combine_64;
+	    compose = _pixman_implementation_combine_32;
     }
     else
     {
 	if (component_alpha)
-	    compose = _pixman_implementation_combine_32_ca;
+	    compose = (pixman_combine_32_func_t)_pixman_implementation_combine_64_ca;
 	else
-	    compose = _pixman_implementation_combine_32;
+	    compose = (pixman_combine_32_func_t)_pixman_implementation_combine_64;
     }
 
     if (!compose)
diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c
index cfee865..102df6c 100644
--- a/pixman/pixman-image.c
+++ b/pixman/pixman-image.c
@@ -379,7 +379,7 @@ compute_image_info (pixman_image_t *image)
     else
 	flags |= FAST_PATH_UNIFIED_ALPHA;
 
-    flags |= (FAST_PATH_NO_ACCESSORS | FAST_PATH_NO_WIDE_FORMAT);
+    flags |= (FAST_PATH_NO_ACCESSORS | FAST_PATH_NARROW_FORMAT);
 
     /* Type specific checks */
     switch (image->type)
@@ -426,7 +426,7 @@ compute_image_info (pixman_image_t *image)
 	    flags &= ~FAST_PATH_NO_ACCESSORS;
 
 	if (PIXMAN_FORMAT_IS_WIDE (image->bits.format))
-	    flags &= ~FAST_PATH_NO_WIDE_FORMAT;
+	    flags &= ~FAST_PATH_NARROW_FORMAT;
 	break;
 
     case LINEAR:
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 36b9d91..d85868f 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -554,7 +554,7 @@ _pixman_choose_implementation (void);
 #define FAST_PATH_NO_PAD_REPEAT			(1 <<  3)
 #define FAST_PATH_NO_REFLECT_REPEAT		(1 <<  4)
 #define FAST_PATH_NO_ACCESSORS			(1 <<  5)
-#define FAST_PATH_NO_WIDE_FORMAT		(1 <<  6)
+#define FAST_PATH_NARROW_FORMAT		(1 <<  6)
 #define FAST_PATH_COVERS_CLIP			(1 <<  7)
 #define FAST_PATH_COMPONENT_ALPHA		(1 <<  8)
 #define FAST_PATH_UNIFIED_ALPHA			(1 <<  9)
@@ -600,7 +600,7 @@ _pixman_choose_implementation (void);
      FAST_PATH_NO_PAD_REPEAT		|				\
      FAST_PATH_NO_REFLECT_REPEAT	|				\
      FAST_PATH_NO_ACCESSORS		|				\
-     FAST_PATH_NO_WIDE_FORMAT		|				\
+     FAST_PATH_NARROW_FORMAT		|				\
      FAST_PATH_COVERS_CLIP)
 
 #define FAST_PATH_STD_SRC_FLAGS						\
@@ -614,7 +614,7 @@ _pixman_choose_implementation (void);
 #define FAST_PATH_STD_DEST_FLAGS					\
     (FAST_PATH_NO_ACCESSORS		|				\
      FAST_PATH_NO_ALPHA_MAP		|				\
-     FAST_PATH_NO_WIDE_FORMAT)
+     FAST_PATH_NARROW_FORMAT)
 
 #define FAST_PATH(op, src, src_flags, mask, mask_flags, dest, dest_flags, func) \
     PIXMAN_OP_ ## op,							\
-- 
1.7.1.1



More information about the Pixman mailing list