From 4f8868e37fabb804d4557db9f9bf9dc53f72bbe4 Mon Sep 17 00:00:00 2001 From: Søren Sandmann Pedersen Date: Sat, 19 Sep 2009 06:14:38 -0400 Subject: Use the destination buffer directly in more cases instead of fetching. When the destination buffer is either a8r8g8b8 or x8r8g8b8, we can use it directly instead of fetching into a temporary buffer. When the format is x8r8g8b8, we require the operator to not make use of destination alpha, but when it is a8r8g8b8, there are no restrictions. This is approximately a 5% speedup on the poppler cairo benchmark: [ # ] backend test min(s) median(s) stddev. count Before: [ 0] image poppler 6.661 6.709 0.59% 6/6 After: [ 0] image poppler 6.307 6.320 0.12% 5/6 --- pixman/pixman-general.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c index 3ead3dac..c96a3f97 100644 --- a/pixman/pixman-general.c +++ b/pixman/pixman-general.c @@ -133,15 +133,27 @@ general_composite_rect (pixman_implementation_t *imp, /* Skip the store step and composite directly into the * destination if the output format of the compose func matches * the destination format. + * + * If the destination format is a8r8g8b8 then we can always do + * this. If it is x8r8g8b8, then we can only do it if the + * operator doesn't make use of destination alpha. */ - if (!wide && - !dest->common.alpha_map && - !dest->bits.write_func && - (op == PIXMAN_OP_ADD || op == PIXMAN_OP_OVER) && - (dest->bits.format == PIXMAN_a8r8g8b8 || - dest->bits.format == PIXMAN_x8r8g8b8)) + if ((dest->bits.format == PIXMAN_a8r8g8b8) || + (dest->bits.format == PIXMAN_x8r8g8b8 && + (op == PIXMAN_OP_OVER || + op == PIXMAN_OP_ADD || + op == PIXMAN_OP_SRC || + op == PIXMAN_OP_CLEAR || + op == PIXMAN_OP_IN_REVERSE || + op == PIXMAN_OP_OUT_REVERSE || + op == PIXMAN_OP_DST))) { - store = NULL; + if (!wide && + !dest->common.alpha_map && + !dest->bits.write_func) + { + store = NULL; + } } if (!store) -- cgit v1.2.3