summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@redhat.com>2010-03-15 11:51:09 -0400
committerSøren Sandmann Pedersen <ssp@redhat.com>2010-03-15 12:02:28 -0400
commit705b30c7129358463c4853591ac8ec1b5fa9e8e9 (patch)
tree270c4757c8daa69f86789ef435ee7e7bb5a16a5c
parent7a5dc747852d46fa382ef885bb6299723ef6ed00 (diff)
Ensture that only the low 4 bit of 4 bit pixels are stored.bigendian-g4
In some cases we end up trying to use the STORE_4 macro with an 8 bit values, which resulted in other pixels getting overwritten. Fix this by always masking off the low 4 bits.
-rw-r--r--pixman/pixman-access.c22
-rw-r--r--test/blitters-test.c2
2 files changed, 15 insertions, 9 deletions
diff --git a/pixman/pixman-access.c b/pixman/pixman-access.c
index 389cf2a7..fa0a2679 100644
--- a/pixman/pixman-access.c
+++ b/pixman/pixman-access.c
@@ -2445,9 +2445,12 @@ store_scanline_x4a4 (bits_image_t * image,
do \
{ \
int bo = 4 * (o); \
- STORE_8 (img, l, bo, (bo & 4 ? \
- (FETCH_8 (img, l, bo) & 0xf0) | (v) : \
- (FETCH_8 (img, l, bo) & 0x0f) | ((v) << 4))); \
+ int v4 = (v) & 0x0f; \
+ \
+ STORE_8 (img, l, bo, ( \
+ bo & 4 ? \
+ (FETCH_8 (img, l, bo) & 0xf0) | (v4) : \
+ (FETCH_8 (img, l, bo) & 0x0f) | (v4 << 4))); \
} while (0)
#else
@@ -2455,9 +2458,12 @@ store_scanline_x4a4 (bits_image_t * image,
do \
{ \
int bo = 4 * (o); \
- STORE_8 (img, l, bo, (bo & 4 ? \
- (FETCH_8 (img, l, bo) & 0x0f) | ((v) << 4) : \
- (FETCH_8 (img, l, bo) & 0xf0) | (v))); \
+ int v4 = (v) & 0x0f; \
+ \
+ STORE_8 (img, l, bo, ( \
+ bo & 4 ? \
+ (FETCH_8 (img, l, bo) & 0x0f) | (v4 << 4) : \
+ (FETCH_8 (img, l, bo) & 0xf0) | (v4))); \
} while (0)
#endif
@@ -2484,11 +2490,11 @@ store_scanline_r1g2b1 (bits_image_t * image,
{
uint32_t *bits = image->bits + image->rowstride * y;
int i;
-
+
for (i = 0; i < width; ++i)
{
uint32_t pixel;
-
+
SPLIT (values[i]);
pixel = (((r >> 4) & 0x8) |
((g >> 5) & 0x6) |
diff --git a/test/blitters-test.c b/test/blitters-test.c
index c11917d2..5e33031e 100644
--- a/test/blitters-test.c
+++ b/test/blitters-test.c
@@ -482,7 +482,7 @@ main (int argc, char *argv[])
/* Predefined value for running with all the fastpath functions
disabled. It needs to be updated every time when changes are
introduced to this program or behavior of pixman changes! */
- if (crc == 0xEF7A1179)
+ if (crc == 0xA058F792)
{
printf ("blitters test passed\n");
}