summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaekyun Kim <tkq.kim@samsung.com>2011-08-24 20:20:43 +0900
committerTaekyun Kim <tkq.kim@samsung.com>2011-08-24 20:25:47 +0900
commit70eed65318efd3751034505234c4c44fcb9c7a84 (patch)
tree7aca5c9c3ebf62e2a2cab470cc0fd8cd26c6f3d8
parent1f09d055bcc3dd4887a7b0771833bf6e18ed205c (diff)
Move utility inline functions to pixman-inlilnes.h
Those inline functions can be used in other files and it is more proper location of those functions.
-rw-r--r--pixman/pixman-fast-path.c71
-rw-r--r--pixman/pixman-inlines.h72
2 files changed, 72 insertions, 71 deletions
diff --git a/pixman/pixman-fast-path.c b/pixman/pixman-fast-path.c
index 0cf143d..4e78605 100644
--- a/pixman/pixman-fast-path.c
+++ b/pixman/pixman-fast-path.c
@@ -29,79 +29,8 @@
#include <string.h>
#include <stdlib.h>
#include "pixman-private.h"
-#include "pixman-combine32.h"
#include "pixman-inlines.h"
-static force_inline uint32_t
-fetch_24 (uint8_t *a)
-{
- if (((unsigned long)a) & 1)
- {
-#ifdef WORDS_BIGENDIAN
- return (*a << 16) | (*(uint16_t *)(a + 1));
-#else
- return *a | (*(uint16_t *)(a + 1) << 8);
-#endif
- }
- else
- {
-#ifdef WORDS_BIGENDIAN
- return (*(uint16_t *)a << 8) | *(a + 2);
-#else
- return *(uint16_t *)a | (*(a + 2) << 16);
-#endif
- }
-}
-
-static force_inline void
-store_24 (uint8_t *a,
- uint32_t v)
-{
- if (((unsigned long)a) & 1)
- {
-#ifdef WORDS_BIGENDIAN
- *a = (uint8_t) (v >> 16);
- *(uint16_t *)(a + 1) = (uint16_t) (v);
-#else
- *a = (uint8_t) (v);
- *(uint16_t *)(a + 1) = (uint16_t) (v >> 8);
-#endif
- }
- else
- {
-#ifdef WORDS_BIGENDIAN
- *(uint16_t *)a = (uint16_t)(v >> 8);
- *(a + 2) = (uint8_t)v;
-#else
- *(uint16_t *)a = (uint16_t)v;
- *(a + 2) = (uint8_t)(v >> 16);
-#endif
- }
-}
-
-static force_inline uint32_t
-over (uint32_t src,
- uint32_t dest)
-{
- uint32_t a = ~src >> 24;
-
- UN8x4_MUL_UN8_ADD_UN8x4 (dest, a, src);
-
- return dest;
-}
-
-static force_inline uint32_t
-in (uint32_t x,
- uint8_t y)
-{
- if (y != 0xff) {
- uint16_t a = y;
- UN8x4_MUL_UN8 (x, a);
- }
-
- return x;
-}
-
/*
* Naming convention:
*
diff --git a/pixman/pixman-inlines.h b/pixman/pixman-inlines.h
index f3b5888..0db6252 100644
--- a/pixman/pixman-inlines.h
+++ b/pixman/pixman-inlines.h
@@ -27,6 +27,78 @@
#define PIXMAN_FAST_PATH_H__
#include "pixman-private.h"
+#include "pixman-combine32.h"
+
+/* Primitive pixel helper functions. */
+static force_inline uint32_t
+fetch_24 (uint8_t *a)
+{
+ if (((unsigned long)a) & 1)
+ {
+#ifdef WORDS_BIGENDIAN
+ return (*a << 16) | (*(uint16_t *)(a + 1));
+#else
+ return *a | (*(uint16_t *)(a + 1) << 8);
+#endif
+ }
+ else
+ {
+#ifdef WORDS_BIGENDIAN
+ return (*(uint16_t *)a << 8) | *(a + 2);
+#else
+ return *(uint16_t *)a | (*(a + 2) << 16);
+#endif
+ }
+}
+
+static force_inline void
+store_24 (uint8_t *a,
+ uint32_t v)
+{
+ if (((unsigned long)a) & 1)
+ {
+#ifdef WORDS_BIGENDIAN
+ *a = (uint8_t) (v >> 16);
+ *(uint16_t *)(a + 1) = (uint16_t) (v);
+#else
+ *a = (uint8_t) (v);
+ *(uint16_t *)(a + 1) = (uint16_t) (v >> 8);
+#endif
+ }
+ else
+ {
+#ifdef WORDS_BIGENDIAN
+ *(uint16_t *)a = (uint16_t)(v >> 8);
+ *(a + 2) = (uint8_t)v;
+#else
+ *(uint16_t *)a = (uint16_t)v;
+ *(a + 2) = (uint8_t)(v >> 16);
+#endif
+ }
+}
+
+static force_inline uint32_t
+over (uint32_t src,
+ uint32_t dest)
+{
+ uint32_t a = ~src >> 24;
+
+ UN8x4_MUL_UN8_ADD_UN8x4 (dest, a, src);
+
+ return dest;
+}
+
+static force_inline uint32_t
+in (uint32_t x,
+ uint8_t y)
+{
+ if (y != 0xff) {
+ uint16_t a = y;
+ UN8x4_MUL_UN8 (x, a);
+ }
+
+ return x;
+}
#define PIXMAN_REPEAT_COVER -1