summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-03-09 10:57:15 +0100
committerBenjamin Otte <otte@redhat.com>2010-04-07 10:38:43 +0200
commit27f02c1c865dd48f5c6975e12e4fbf922e3c2752 (patch)
tree47f227311abb28aec385e25491379b084381077e
parente2551eca31f40d2fd116da83e9fa9defa9255225 (diff)
optimization: Allow fast paths for non-argb
The function _pixman_color_space_select_for_composite() selects the best colorspace for compositing operations. This is the destination's colorspace if the operator produces identical results as in ARGB or it is the ARGB colorspace. If dest, mask and source match the compositing colorspace, fast paths can be used even if that colorspace is not ARGB.
-rw-r--r--pixman/pixman-color-space-private.h4
-rw-r--r--pixman/pixman-color-space.c12
-rw-r--r--pixman/pixman-general.c12
-rw-r--r--pixman/pixman-utils.c1
-rw-r--r--pixman/pixman.c15
5 files changed, 29 insertions, 15 deletions
diff --git a/pixman/pixman-color-space-private.h b/pixman/pixman-color-space-private.h
index f283f69..c078d9a 100644
--- a/pixman/pixman-color-space-private.h
+++ b/pixman/pixman-color-space-private.h
@@ -44,4 +44,8 @@ _pixman_color_space_get_converter (pixman_color_space_t source,
color_space_convert_t *func,
void **data);
+pixman_color_space_t
+_pixman_color_space_select_for_composite (pixman_op_t op,
+ pixman_color_space_t dest);
+
#endif /* PIXMAN_COLOR_SPACE_PRIVATE_H */
diff --git a/pixman/pixman-color-space.c b/pixman/pixman-color-space.c
index 5b3e4e1..64273ed 100644
--- a/pixman/pixman-color-space.c
+++ b/pixman/pixman-color-space.c
@@ -332,3 +332,15 @@ _pixman_color_space_get_converter (pixman_color_space_t source,
*data = (void *) matrix;
}
+pixman_color_space_t
+_pixman_color_space_select_for_composite (pixman_op_t op,
+ pixman_color_space_t dest)
+{
+ /* XXX: This function can optimize a lot more cases. */
+ if (op == PIXMAN_OP_CLEAR ||
+ op == PIXMAN_OP_SRC)
+ return dest;
+
+ return PIXMAN_COLOR_SPACE_ARGB;
+}
+
diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index 80ea9da..cc00b0e 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -42,18 +42,6 @@
#define SCANLINE_BUFFER_LENGTH 8192
static pixman_color_space_t
-_pixman_color_space_select_for_composite (pixman_op_t op,
- pixman_color_space_t dest)
-{
- /* XXX: This function can optimize a lot more cases. */
- if (op == PIXMAN_OP_CLEAR ||
- op == PIXMAN_OP_SRC)
- return dest;
-
- return PIXMAN_COLOR_SPACE_ARGB;
-}
-
-static pixman_color_space_t
_pixman_image_get_color_space (pixman_image_t *image)
{
if (image->common.type == BITS)
diff --git a/pixman/pixman-utils.c b/pixman/pixman-utils.c
index 3ef88b7..4ea670e 100644
--- a/pixman/pixman-utils.c
+++ b/pixman/pixman-utils.c
@@ -29,6 +29,7 @@
#include <stdlib.h>
#include "pixman-private.h"
+#include "pixman-color-space-private.h"
pixman_bool_t
pixman_multiply_overflows_int (unsigned int a,
diff --git a/pixman/pixman.c b/pixman/pixman.c
index e98e31d..543beaf 100644
--- a/pixman/pixman.c
+++ b/pixman/pixman.c
@@ -27,6 +27,8 @@
#include <config.h>
#endif
#include "pixman-private.h"
+#include "pixman-color-space-private.h"
+#include "pixman-intermediate-private.h"
#include <stdlib.h>
@@ -586,6 +588,7 @@ do_composite (pixman_implementation_t *imp,
int dest_dx, dest_dy;
pixman_bool_t need_workaround;
const pixman_fast_path_t *info;
+ pixman_color_space_t color_space;
cache_t *cache;
int i;
pixman_bool_t is_argb;
@@ -655,9 +658,15 @@ do_composite (pixman_implementation_t *imp,
return;
/* check color spaces */
- is_argb = (dest->type != BITS || dest->bits.color_space == PIXMAN_COLOR_SPACE_ARGB) &&
- (!mask || mask->type != BITS || mask->bits.color_space == PIXMAN_COLOR_SPACE_ARGB) &&
- (src->type != BITS || src->bits.color_space == PIXMAN_COLOR_SPACE_ARGB);
+ color_space = _pixman_color_space_select_for_composite (op, dest->bits.color_space);
+ if (src->type == BITS)
+ is_argb = color_space == src->bits.color_space;
+ else
+ is_argb = color_space == PIXMAN_COLOR_SPACE_ARGB;
+ if (mask && mask->type == BITS)
+ is_argb &= color_space == mask->bits.color_space;
+ else if (mask)
+ is_argb &= color_space == PIXMAN_COLOR_SPACE_ARGB;
/* Check cache for fast paths */
cache = PIXMAN_GET_THREAD_LOCAL (fast_path_cache);