summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-10-17 16:41:14 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2011-10-17 16:41:14 +0100
commit18aed47ba37ccfbcdd72ed251fc97222741c66a7 (patch)
tree84db0d50287fccb6b785aaf8a156b7101d739be7
parenta3466c8b69afeda95180fcdc97b56d31f7a1d1ad (diff)
sna: Fast path common colour conversions
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_blt.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c
index 9d847474..15b09bfc 100644
--- a/src/sna/sna_blt.c
+++ b/src/sna/sna_blt.c
@@ -433,6 +433,20 @@ sna_get_pixel_from_rgba(uint32_t * pixel,
int rbits, bbits, gbits, abits;
int rshift, bshift, gshift, ashift;
+ switch (format) {
+ case PICT_x8r8g8b8:
+ alpha = 0xffff;
+ case PICT_a8r8g8b8:
+ *pixel = ((alpha >> 8 << 24) |
+ (red >> 8 << 16) |
+ (green & 0xff00) |
+ (blue >> 8));
+ return TRUE;
+ case PICT_a8:
+ *pixel = alpha >> 8;
+ return TRUE;
+ }
+
rbits = PICT_FORMAT_R(format);
gbits = PICT_FORMAT_G(format);
bbits = PICT_FORMAT_B(format);