[Pixman] [PATCHv3 1/3] New flags for 90/180/270 rotation

Siarhei Siamashka siarhei.siamashka at gmail.com
Fri Feb 4 02:52:32 PST 2011


From: Siarhei Siamashka <siarhei.siamashka at nokia.com>

These flags are set when the transform is a simple nonscaled 90/180/270
degrees rotation.
---
 pixman/pixman-image.c   |   17 +++++++++++++++++
 pixman/pixman-private.h |    3 +++
 2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c
index a72299b..e91d87c 100644
--- a/pixman/pixman-image.c
+++ b/pixman/pixman-image.c
@@ -211,8 +211,25 @@ compute_image_info (pixman_image_t *image)
 	    if (image->common.transform->matrix[0][1] == 0 &&
 		image->common.transform->matrix[1][0] == 0)
 	    {
+		if (image->common.transform->matrix[0][0] == -pixman_fixed_1 &&
+		    image->common.transform->matrix[1][1] == -pixman_fixed_1)
+		{
+		    flags |= FAST_PATH_ROTATE_180_TRANSFORM;
+		}
 		flags |= FAST_PATH_SCALE_TRANSFORM;
 	    }
+	    else if (image->common.transform->matrix[0][0] == 0 &&
+	             image->common.transform->matrix[1][1] == 0)
+	    {
+		pixman_fixed_t m01 = image->common.transform->matrix[0][1];
+		if (m01 == -image->common.transform->matrix[1][0])
+		{
+			if (m01 == -pixman_fixed_1)
+			    flags |= FAST_PATH_ROTATE_90_TRANSFORM;
+			else if (m01 == pixman_fixed_1)
+			    flags |= FAST_PATH_ROTATE_270_TRANSFORM;
+		}
+	    }
 	}
 
 	if (image->common.transform->matrix[0][0] > 0)
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index f5d0ba1..1473dc4 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -611,6 +611,9 @@ _pixman_iter_get_scanline_noop (pixman_iter_t *iter, const uint32_t *mask);
 #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_ROTATE_90_TRANSFORM		(1 << 21)
+#define FAST_PATH_ROTATE_180_TRANSFORM		(1 << 22)
+#define FAST_PATH_ROTATE_270_TRANSFORM		(1 << 23)
 
 #define FAST_PATH_PAD_REPEAT						\
     (FAST_PATH_NO_NONE_REPEAT		|				\
-- 
1.7.3.4



More information about the Pixman mailing list