summaryrefslogtreecommitdiff
path: root/pixman
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <sandmann@redhat.com>2009-09-18 09:11:04 -0400
committerSøren Sandmann Pedersen <sandmann@redhat.com>2009-09-24 06:49:56 -0400
commit48ba7d946146ea7b0e33e963942bedde22a3b806 (patch)
tree06cc7385048c254c475bebe83f259c4a36fbf82e /pixman
parentc673c83e070ed2392c00716fe20a80a798588b39 (diff)
Fix alpha handling for 10 bpc formats.
These generally extracted the 2 bits of alpha, then shifted them 62 bits and replicated across 16 bits. Then they were shifted another 48 bits, making the resulting alpha channel 0.
Diffstat (limited to 'pixman')
-rw-r--r--pixman/pixman-access.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/pixman/pixman-access.c b/pixman/pixman-access.c
index 532aa2ef..d9fd38c1 100644
--- a/pixman/pixman-access.c
+++ b/pixman/pixman-access.c
@@ -230,7 +230,7 @@ fetch_scanline_a2r10g10b10 (pixman_image_t *image,
const uint32_t *pixel = bits + x;
const uint32_t *end = pixel + width;
uint64_t *buffer = (uint64_t *)b;
-
+
while (pixel < end)
{
uint32_t p = READ (image, pixel++);
@@ -238,16 +238,16 @@ fetch_scanline_a2r10g10b10 (pixman_image_t *image,
uint64_t r = (p >> 20) & 0x3ff;
uint64_t g = (p >> 10) & 0x3ff;
uint64_t b = p & 0x3ff;
-
+
r = r << 6 | r >> 4;
g = g << 6 | g >> 4;
b = b << 6 | b >> 4;
-
- a <<= 62;
+
+ a <<= 14;
a |= a >> 2;
a |= a >> 4;
a |= a >> 8;
-
+
*buffer++ = a << 48 | r << 32 | g << 16 | b;
}
}
@@ -309,11 +309,11 @@ fetch_scanline_a2b10g10r10 (pixman_image_t *image,
g = g << 6 | g >> 4;
b = b << 6 | b >> 4;
- a <<= 62;
+ a <<= 14;
a |= a >> 2;
a |= a >> 4;
a |= a >> 8;
-
+
*buffer++ = a << 48 | r << 32 | g << 16 | b;
}
}
@@ -1115,18 +1115,18 @@ fetch_scanline_yv12 (pixman_image_t *image,
{
int16_t y, u, v;
int32_t r, g, b;
-
+
y = y_line[x + i] - 16;
u = u_line[(x + i) >> 1] - 128;
v = v_line[(x + i) >> 1] - 128;
-
+
/* R = 1.164(Y - 16) + 1.596(V - 128) */
r = 0x012b27 * y + 0x019a2e * v;
/* G = 1.164(Y - 16) - 0.813(V - 128) - 0.391(U - 128) */
g = 0x012b27 * y - 0x00d0f2 * v - 0x00647e * u;
/* B = 1.164(Y - 16) + 2.018(U - 128) */
b = 0x012b27 * y + 0x0206a2 * u;
-
+
*buffer++ = 0xff000000 |
(r >= 0 ? r < 0x1000000 ? r & 0xff0000 : 0xff0000 : 0) |
(g >= 0 ? g < 0x1000000 ? (g >> 8) & 0x00ff00 : 0x00ff00 : 0) |
@@ -1148,16 +1148,16 @@ fetch_pixel_a2r10g10b10 (bits_image_t *image,
uint64_t r = (p >> 20) & 0x3ff;
uint64_t g = (p >> 10) & 0x3ff;
uint64_t b = p & 0x3ff;
-
+
r = r << 6 | r >> 4;
g = g << 6 | g >> 4;
b = b << 6 | b >> 4;
-
- a <<= 62;
+
+ a <<= 14;
a |= a >> 2;
a |= a >> 4;
a |= a >> 8;
-
+
return a << 48 | r << 32 | g << 16 | b;
}
@@ -1197,7 +1197,7 @@ fetch_pixel_a2b10g10r10 (bits_image_t *image,
g = g << 6 | g >> 4;
b = b << 6 | b >> 4;
- a <<= 62;
+ a <<= 14;
a |= a >> 2;
a |= a >> 4;
a |= a >> 8;