sna: Fix 2-color to ARGB cursor conversion

It helps to remember to advance through the source/mask images after
each row.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2014-03-27 23:06:15 +00:00
parent e501aa6676
commit e07f8e2e62
1 changed files with 14 additions and 12 deletions

View File

@ -3147,6 +3147,7 @@ static struct sna_cursor *__sna_get_cursor(struct sna *sna, xf86CrtcPtr crtc)
if (src == NULL) {
const uint8_t *source = sna->cursor.ref->bits->source;
const uint8_t *mask = sna->cursor.ref->bits->mask;
int pitch = BitmapBytePad(width);
uint32_t *p;
__DBG(("%s: converting from 2-color to ARGB\n", __FUNCTION__));
@ -3157,20 +3158,21 @@ static struct sna_cursor *__sna_get_cursor(struct sna *sna, xf86CrtcPtr crtc)
p = src;
for (y = 0; y < height; y++) {
for (x = 0; x < width / 8; x++) {
for (x = 0; x < width; x++) {
int byte = x / 8;
int bit = x & 7;
uint32_t pixel;
for (i = 0; i < 8; i++) {
if (mask[x] & (1 << i)) {
if (source[x] & (1 << i))
pixel = sna->cursor.fg;
else
pixel = sna->cursor.bg;
} else
pixel = 0;
*p++ = pixel;
}
if (mask[byte] & (1 << bit)) {
if (source[byte] & (1 << bit))
pixel = sna->cursor.fg;
else
pixel = sna->cursor.bg;
} else
pixel = 0;
*p++ = pixel;
}
mask += pitch;
source += pitch;
}
}