[Pixman] [PATCH 02/11] Add ITER_WIDE iter flag

Søren Sandmann Pedersen soren.sandmann at gmail.com
Wed May 22 06:45:11 PDT 2013


This will be useful for putting iterators into tables where they can
be looked up by iterator flags. Without this flag, wide iterators can
only be recognized by the absence of ITER_NARROW, which makes testing
for a match difficult.
---
 pixman/pixman-general.c | 20 +++++++++-----------
 pixman/pixman-private.h | 13 +++++++------
 2 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index a4935c7..c674ffa 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -116,7 +116,7 @@ general_composite_rect  (pixman_implementation_t *imp,
     pixman_iter_t src_iter, mask_iter, dest_iter;
     pixman_combine_32_func_t compose;
     pixman_bool_t component_alpha;
-    iter_flags_t narrow, src_iter_flags;
+    iter_flags_t width_flag, src_iter_flags;
     int Bpp;
     int i;
 
@@ -124,12 +124,12 @@ general_composite_rect  (pixman_implementation_t *imp,
 	(!mask_image || mask_image->common.flags & FAST_PATH_NARROW_FORMAT) &&
 	(dest_image->common.flags & FAST_PATH_NARROW_FORMAT))
     {
-	narrow = ITER_NARROW;
+	width_flag = ITER_NARROW;
 	Bpp = 4;
     }
     else
     {
-	narrow = 0;
+	width_flag = ITER_WIDE;
 	Bpp = 16;
     }
 
@@ -145,7 +145,7 @@ general_composite_rect  (pixman_implementation_t *imp,
     mask_buffer = src_buffer + width * Bpp;
     dest_buffer = mask_buffer + width * Bpp;
 
-    if (!narrow)
+    if (width_flag == ITER_WIDE)
     {
 	/* To make sure there aren't any NANs in the buffers */
 	memset (src_buffer, 0, width * Bpp);
@@ -154,7 +154,7 @@ general_composite_rect  (pixman_implementation_t *imp,
     }
     
     /* src iter */
-    src_iter_flags = narrow | op_flags[op].src | ITER_SRC;
+    src_iter_flags = width_flag | op_flags[op].src | ITER_SRC;
 
     _pixman_implementation_src_iter_init (imp->toplevel, &src_iter, src_image,
 					  src_x, src_y, width, height,
@@ -179,18 +179,16 @@ general_composite_rect  (pixman_implementation_t *imp,
     _pixman_implementation_src_iter_init (
 	imp->toplevel, &mask_iter,
 	mask_image, mask_x, mask_y, width, height, mask_buffer,
-	ITER_SRC | narrow | (component_alpha? 0 : ITER_IGNORE_RGB),
+	ITER_SRC | width_flag | (component_alpha? 0 : ITER_IGNORE_RGB),
 	info->mask_flags);
 
     /* dest iter */
     _pixman_implementation_dest_iter_init (
-	imp->toplevel, &dest_iter,
-	dest_image, dest_x, dest_y, width, height, dest_buffer,
-	ITER_DEST | narrow | op_flags[op].dst,
-	info->dest_flags);
+	imp->toplevel, &dest_iter, dest_image, dest_x, dest_y, width, height,
+	dest_buffer, ITER_DEST | width_flag | op_flags[op].dst, info->dest_flags);
 
     compose = _pixman_implementation_lookup_combiner (
-	imp->toplevel, op, component_alpha, narrow);
+	imp->toplevel, op, component_alpha, width_flag != ITER_WIDE);
 
     for (i = 0; i < height; ++i)
     {
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 9b6353e..0fe86ca 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -212,7 +212,8 @@ typedef void      (* pixman_iter_write_back_t)   (pixman_iter_t *iter);
 
 typedef enum
 {
-    ITER_NARROW =		(1 << 0),
+    ITER_NARROW =               (1 << 0),
+    ITER_WIDE =                 (1 << 1),
 
     /* "Localized alpha" is when the alpha channel is used only to compute
      * the alpha value of the destination. This means that the computation
@@ -229,15 +230,15 @@ typedef enum
      * we can treat it as if it were ARGB, which means in some cases we can
      * avoid copying it to a temporary buffer.
      */
-    ITER_LOCALIZED_ALPHA =	(1 << 1),
-    ITER_IGNORE_ALPHA =		(1 << 2),
-    ITER_IGNORE_RGB =		(1 << 3),
+    ITER_LOCALIZED_ALPHA =	(1 << 2),
+    ITER_IGNORE_ALPHA =		(1 << 3),
+    ITER_IGNORE_RGB =		(1 << 4),
 
     /* These indicate whether the iterator is for a source
      * or a destination image
      */
-    ITER_SRC =			(1 << 4),
-    ITER_DEST =			(1 << 5)
+    ITER_SRC =			(1 << 5),
+    ITER_DEST =			(1 << 6)
 } iter_flags_t;
 
 struct pixman_iter_t
-- 
1.7.11.7



More information about the Pixman mailing list