diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-04-03 12:34:24 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-04-03 12:36:22 +0100 |
commit | 04851e4210d2d71542359c14d4b68d0851b36326 (patch) | |
tree | 6b905b56e82f8b70eac86e9b059db75eb3f02f96 /src/sna/sna_blt.c | |
parent | 87a672dafd9d6f47f31b77b406b7f0fb2b4030ac (diff) |
sna/gen3: Convert the clear-color from picture->format to a8r8g8b8
The shaders treat colours as an argb value, however the clear color is
stored in the pixmap's native format (a8, r5g6b5, x8r8g8b8 etc). So
before using the value of the clear color as a solid we need to convert
it into the a8r8g8b8 format.
Reported-by: Clemens Eisserer <linuxhippy@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=48204
Reported-by: Paul Neumann <paul104x@yahoo.de>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=47308
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_blt.c')
-rw-r--r-- | src/sna/sna_blt.c | 39 |
1 files changed, 7 insertions, 32 deletions
diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c index e7a6182f..a81a1454 100644 --- a/src/sna/sna_blt.c +++ b/src/sna/sna_blt.c @@ -476,13 +476,13 @@ static void sna_blt_copy_one(struct sna *sna, kgem->nbatch += 8; } -static Bool -get_rgba_from_pixel(uint32_t pixel, - uint16_t *red, - uint16_t *green, - uint16_t *blue, - uint16_t *alpha, - uint32_t format) +Bool +sna_get_rgba_from_pixel(uint32_t pixel, + uint16_t *red, + uint16_t *green, + uint16_t *blue, + uint16_t *alpha, + uint32_t format) { int rbits, bbits, gbits, abits; int rshift, bshift, gshift, ashift; @@ -607,31 +607,6 @@ _sna_get_pixel_from_rgba(uint32_t * pixel, return TRUE; } -static uint32_t -color_convert(uint32_t pixel, - uint32_t src_format, - uint32_t dst_format) -{ - DBG(("%s: src=%08x [%08x]\n", __FUNCTION__, pixel, src_format)); - - if (src_format != dst_format) { - uint16_t red, green, blue, alpha; - - if (!get_rgba_from_pixel(pixel, - &red, &green, &blue, &alpha, - src_format)) - return 0; - - if (!sna_get_pixel_from_rgba(&pixel, - red, green, blue, alpha, - dst_format)) - return 0; - } - - DBG(("%s: dst=%08x [%08x]\n", __FUNCTION__, pixel, dst_format)); - return pixel; -} - uint32_t sna_rgba_for_color(uint32_t color, int depth) { |