[Pixman] [PATCH 02/19] Add nearest scaler for x888 on 8888

Søren Sandmann sandmann at daimi.au.dk
Thu Sep 16 07:53:42 PDT 2010


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

---
 pixman/pixman-fast-path.c |   10 +++++++++-
 pixman/pixman-private.h   |    5 ++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/pixman/pixman-fast-path.c b/pixman/pixman-fast-path.c
index 6dee472..64e69e5 100644
--- a/pixman/pixman-fast-path.c
+++ b/pixman/pixman-fast-path.c
@@ -1430,9 +1430,10 @@ repeat (pixman_repeat_t repeat, int *c, int size)
  */
 
 #define GET_8888_ALPHA(s) ((s) >> 24)
+#define GET_x888_ALPHA(s) (0xff)
  /* This is not actually used since we don't have an OVER with
     565 source, but it is needed to build. */
-#define GET_0565_ALPHA(s) 0xff
+#define GET_0565_ALPHA(s) (0xff)
 
 #define FAST_NEAREST(scale_func_name, SRC_FORMAT, DST_FORMAT,					\
 		     src_type_t, dst_type_t, OP, repeat_mode)					\
@@ -1623,6 +1624,10 @@ FAST_NEAREST (8888_8888_none, 8888, 8888, uint32_t, uint32_t, SRC, NONE);
 FAST_NEAREST (8888_8888_normal, 8888, 8888, uint32_t, uint32_t, SRC, NORMAL);
 FAST_NEAREST (8888_8888_none, 8888, 8888, uint32_t, uint32_t, OVER, NONE);
 FAST_NEAREST (8888_8888_normal, 8888, 8888, uint32_t, uint32_t, OVER, NORMAL);
+
+FAST_NEAREST (x888_8888_none, x888, 8888, uint32_t, uint32_t, SRC, NONE);
+FAST_NEAREST (x888_8888_normal, x888, 8888, uint32_t, uint32_t, SRC, NORMAL);
+
 FAST_NEAREST (8888_565_none, 8888, 0565, uint32_t, uint16_t, SRC, NONE);
 FAST_NEAREST (8888_565_normal, 8888, 0565, uint32_t, uint16_t, SRC, NORMAL);
 FAST_NEAREST (565_565_none, 0565, 0565, uint16_t, uint16_t, SRC, NONE);
@@ -1888,6 +1893,9 @@ static const pixman_fast_path_t c_fast_paths[] =
     SIMPLE_NEAREST_FAST_PATH (SRC, x8b8g8r8, x8b8g8r8, 8888_8888),
     SIMPLE_NEAREST_FAST_PATH (SRC, a8b8g8r8, x8b8g8r8, 8888_8888),
 
+    SIMPLE_NEAREST_FAST_PATH (SRC, x8r8g8b8, a8r8g8b8, x888_8888),
+    SIMPLE_NEAREST_FAST_PATH (SRC, x8b8g8r8, a8b8g8r8, x888_8888),
+
     SIMPLE_NEAREST_FAST_PATH (SRC, a8r8g8b8, a8r8g8b8, 8888_8888),
     SIMPLE_NEAREST_FAST_PATH (SRC, a8b8g8r8, a8b8g8r8, 8888_8888),
 
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index b05a68d..ef87678 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -707,7 +707,7 @@ pixman_region16_copy_from_region32 (pixman_region16_t *dst,
 
 #define CLIP(v, low, high) ((v) < (low) ? (low) : ((v) > (high) ? (high) : (v)))
 
-/* Conversion between 8888 and 0565 */
+/* Various conversion macros */
 
 #define CONVERT_8888_TO_0565(s)						\
     ((((s) >> 3) & 0x001f) |						\
@@ -721,6 +721,9 @@ pixman_region16_copy_from_region32 (pixman_region16_t *dst,
 
 #define CONVERT_0565_TO_8888(s) (CONVERT_0565_TO_0888(s) | 0xff000000)
 
+#define CONVERT_x888_TO_8888(s)						\
+    ((s) | 0xff000000)
+
 /* Trivial versions that are useful in macros */
 #define CONVERT_8888_TO_8888(s) (s)
 #define CONVERT_0565_TO_0565(s) (s)
-- 
1.7.1.1



More information about the Pixman mailing list