summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-12-25 00:21:21 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2011-12-25 00:21:21 +0000
commit7b69dc88094ee2bb017364cd4356f3ae69cbc1f1 (patch)
treea957a5f768f96521d398b4b1d294cbb09aaacffc
parentb117f65520919f4ba36010cfe913a8c53166bf23 (diff)
sna: Inline the common portion of sna_get_pixel_from_rgba()
The function overhead completely dominates for the common case. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_blt.c16
-rw-r--r--src/sna/sna_render.h27
2 files changed, 27 insertions, 16 deletions
diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c
index 053b3571..220b900f 100644
--- a/src/sna/sna_blt.c
+++ b/src/sna/sna_blt.c
@@ -455,7 +455,7 @@ get_rgba_from_pixel(uint32_t pixel,
}
Bool
-sna_get_pixel_from_rgba(uint32_t * pixel,
+_sna_get_pixel_from_rgba(uint32_t * pixel,
uint16_t red,
uint16_t green,
uint16_t blue,
@@ -465,20 +465,6 @@ 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);
diff --git a/src/sna/sna_render.h b/src/sna/sna_render.h
index bebbed26..d5c7b2e5 100644
--- a/src/sna/sna_render.h
+++ b/src/sna/sna_render.h
@@ -527,13 +527,38 @@ Bool sna_blt_copy_boxes_fallback(struct sna *sna, uint8_t alu,
PixmapPtr dst, struct kgem_bo *dst_bo, int16_t dst_dx, int16_t dst_dy,
const BoxRec *box, int nbox);
-Bool sna_get_pixel_from_rgba(uint32_t *pixel,
+Bool _sna_get_pixel_from_rgba(uint32_t *pixel,
uint16_t red,
uint16_t green,
uint16_t blue,
uint16_t alpha,
uint32_t format);
+static inline Bool
+sna_get_pixel_from_rgba(uint32_t * pixel,
+ uint16_t red,
+ uint16_t green,
+ uint16_t blue,
+ uint16_t alpha,
+ uint32_t format)
+{
+ 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;
+ }
+
+ return _sna_get_pixel_from_rgba(pixel, red, green, blue, alpha, format);
+}
+
int
sna_render_pixmap_bo(struct sna *sna,
struct sna_composite_channel *channel,