[Pixman] [PATCH 6/7] Add some new FAST_PATH flags

Søren Sandmann sandmann at daimi.au.dk
Thu Jul 29 07:12:47 PDT 2010


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

The flags are:

 *  AFFINE_TRANSFORM, for affine transforms

 *  Y_UNIT_ZERO, for when the 10 entry in the transformation is zero

 *  FILTER_BILINEAR, for when the image has a bilinear filter

 *  NO_NORMAL_REPEAT, for when the repeat mode is not NORMAL

 *  HAS_TRANSFORM, for when the transform is not NULL

Also add some new FAST_PATH_REPEAT_* macros. These are just shorthands
for the image not having any of the other repeat modes. For example
REPEAT_NORMAL is (NO_NONE | NO_PAD | NO_REFLECT).
---
 pixman/pixman-bits-image.c |    1 -
 pixman/pixman-fast-path.c  |    9 +++------
 pixman/pixman-image.c      |   36 +++++++++++++++++++++++++++---------
 pixman/pixman-private.h    |   25 +++++++++++++++++++++++++
 4 files changed, 55 insertions(+), 16 deletions(-)

diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c
index d27256d..7129e86 100644
--- a/pixman/pixman-bits-image.c
+++ b/pixman/pixman-bits-image.c
@@ -954,7 +954,6 @@ bits_image_property_changed (pixman_image_t *image)
 	     bits->common.transform->matrix[2][0] == 0			&&
 	     bits->common.transform->matrix[2][1] == 0			&&
 	     bits->common.transform->matrix[2][2] == pixman_fixed_1)
-	     
     {
 	image->common.get_scanline_64 = _pixman_image_get_scanline_generic_64;
 	image->common.get_scanline_32 = bits_image_fetch_affine_no_alpha;
diff --git a/pixman/pixman-fast-path.c b/pixman/pixman-fast-path.c
index 9cc8529..f03752f 100644
--- a/pixman/pixman-fast-path.c
+++ b/pixman/pixman-fast-path.c
@@ -1866,15 +1866,12 @@ static const pixman_fast_path_t c_fast_paths[] =
      FAST_PATH_NO_ACCESSORS	|					\
      FAST_PATH_NO_WIDE_FORMAT)
 
-#define HAS_NORMAL_REPEAT_FLAGS						\
-    (FAST_PATH_NO_REFLECT_REPEAT |					\
-     FAST_PATH_NO_PAD_REPEAT     |					\
-     FAST_PATH_NO_NONE_REPEAT)
-
 #define SIMPLE_NEAREST_FAST_PATH(op,s,d,func)				\
     {   PIXMAN_OP_ ## op,						\
 	PIXMAN_ ## s,							\
-	SCALED_NEAREST_FLAGS | HAS_NORMAL_REPEAT_FLAGS | FAST_PATH_X_UNIT_POSITIVE, \
+	(SCALED_NEAREST_FLAGS		|				\
+	 FAST_PATH_NORMAL_REPEAT	|				\
+	 FAST_PATH_X_UNIT_POSITIVE),					\
 	PIXMAN_null, 0,							\
 	PIXMAN_ ## d, FAST_PATH_STD_DEST_FLAGS,				\
 	fast_composite_scaled_nearest_ ## func ## _normal ## _ ## op,	\
diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c
index 5c6d415..269c3c1 100644
--- a/pixman/pixman-image.c
+++ b/pixman/pixman-image.c
@@ -297,21 +297,33 @@ compute_image_info (pixman_image_t *image)
     /* Transform */
     if (!image->common.transform)
     {
-	flags |= (FAST_PATH_ID_TRANSFORM | FAST_PATH_X_UNIT_POSITIVE);
+	flags |= (FAST_PATH_ID_TRANSFORM	|
+		  FAST_PATH_X_UNIT_POSITIVE	|
+		  FAST_PATH_Y_UNIT_ZERO		|
+		  FAST_PATH_AFFINE_TRANSFORM);
     }
     else
     {
-	if (image->common.transform->matrix[0][1] == 0 &&
-	    image->common.transform->matrix[1][0] == 0 &&
-	    image->common.transform->matrix[2][0] == 0 &&
-	    image->common.transform->matrix[2][1] == 0 &&
+	flags |= FAST_PATH_HAS_TRANSFORM;
+
+	if (image->common.transform->matrix[2][0] == 0			&&
+	    image->common.transform->matrix[2][1] == 0			&&
 	    image->common.transform->matrix[2][2] == pixman_fixed_1)
 	{
-	    flags |= FAST_PATH_SCALE_TRANSFORM;
+	    flags |= FAST_PATH_AFFINE_TRANSFORM;
+
+	    if (image->common.transform->matrix[0][1] == 0 &&
+		image->common.transform->matrix[1][0] == 0)
+	    {
+		flags |= FAST_PATH_SCALE_TRANSFORM;
+	    }
 	}
 
 	if (image->common.transform->matrix[0][0] > 0)
 	    flags |= FAST_PATH_X_UNIT_POSITIVE;
+
+	if (image->common.transform->matrix[1][0] == 0)
+	    flags |= FAST_PATH_Y_UNIT_ZERO;
     }
 
     /* Alpha map */
@@ -326,6 +338,12 @@ compute_image_info (pixman_image_t *image)
 	flags |= (FAST_PATH_NEAREST_FILTER | FAST_PATH_NO_CONVOLUTION_FILTER);
 	break;
 
+    case PIXMAN_FILTER_BILINEAR:
+    case PIXMAN_FILTER_GOOD:
+    case PIXMAN_FILTER_BEST:
+	flags |= (FAST_PATH_BILINEAR_FILTER | FAST_PATH_NO_CONVOLUTION_FILTER);
+	break;
+
     case PIXMAN_FILTER_CONVOLUTION:
 	break;
 
@@ -338,15 +356,15 @@ compute_image_info (pixman_image_t *image)
     switch (image->common.repeat)
     {
     case PIXMAN_REPEAT_NONE:
-	flags |= FAST_PATH_NO_REFLECT_REPEAT | FAST_PATH_NO_PAD_REPEAT;
+	flags |= FAST_PATH_NO_REFLECT_REPEAT | FAST_PATH_NO_PAD_REPEAT | FAST_PATH_NO_NORMAL_REPEAT;
 	break;
 
     case PIXMAN_REPEAT_REFLECT:
-	flags |= FAST_PATH_NO_PAD_REPEAT | FAST_PATH_NO_NONE_REPEAT;
+	flags |= FAST_PATH_NO_PAD_REPEAT | FAST_PATH_NO_NONE_REPEAT | FAST_PATH_NO_NORMAL_REPEAT;
 	break;
 
     case PIXMAN_REPEAT_PAD:
-	flags |= FAST_PATH_NO_REFLECT_REPEAT | FAST_PATH_NO_NONE_REPEAT;
+	flags |= FAST_PATH_NO_REFLECT_REPEAT | FAST_PATH_NO_NONE_REPEAT | FAST_PATH_NO_NORMAL_REPEAT;
 	break;
 
     default:
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index a2736d7..0629c42 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -565,6 +565,31 @@ _pixman_choose_implementation (void);
 #define FAST_PATH_NO_NONE_REPEAT		(1 << 15)
 #define FAST_PATH_SAMPLES_COVER_CLIP		(1 << 16)
 #define FAST_PATH_X_UNIT_POSITIVE		(1 << 17)
+#define FAST_PATH_AFFINE_TRANSFORM		(1 << 18)
+#define FAST_PATH_Y_UNIT_ZERO			(1 << 19)
+#define FAST_PATH_BILINEAR_FILTER		(1 << 20)
+#define FAST_PATH_NO_NORMAL_REPEAT		(1 << 21)
+#define FAST_PATH_HAS_TRANSFORM			(1 << 22)
+
+#define FAST_PATH_PAD_REPEAT						\
+    (FAST_PATH_NO_NONE_REPEAT		|				\
+     FAST_PATH_NO_NORMAL_REPEAT		|				\
+     FAST_PATH_NO_REFLECT_REPEAT)
+
+#define FAST_PATH_NORMAL_REPEAT						\
+    (FAST_PATH_NO_NONE_REPEAT		|				\
+     FAST_PATH_NO_PAD_REPEAT		|				\
+     FAST_PATH_NO_REFLECT_REPEAT)
+
+#define FAST_PATH_NONE_REPEAT						\
+    (FAST_PATH_NO_NORMAL_REPEAT		|				\
+     FAST_PATH_NO_PAD_REPEAT		|				\
+     FAST_PATH_NO_REFLECT_REPEAT)
+
+#define FAST_PATH_REFLECT_REPEAT					\
+    (FAST_PATH_NO_NONE_REPEAT		|				\
+     FAST_PATH_NO_NORMAL_REPEAT		|				\
+     FAST_PATH_NO_PAD_REPEAT)
 
 #define _FAST_PATH_STANDARD_FLAGS					\
     (FAST_PATH_ID_TRANSFORM		|				\
-- 
1.7.1.1



More information about the Pixman mailing list