Mercurial > hg > dmlib
diff lib64gfx.c @ 810:cbe263ad963c
Some work on charset conversion.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 15 May 2014 02:05:53 +0300 |
parents | 5d158c4321bb |
children | aebc2f8b2c2d |
line wrap: on
line diff
--- a/lib64gfx.c Wed May 14 21:28:14 2014 +0300 +++ b/lib64gfx.c Thu May 15 02:05:53 2014 +0300 @@ -703,9 +703,7 @@ int dmC64ConvertGenericBMP2Image(DMImage *dst, const DMC64Image *src, const BOOL doubleMC) { Uint8 *dp = dst->data; - int divisor = doubleMC ? 4 : 8, - wdivisor = doubleMC ? 2 : 1, - yc; + int yc; // Sanity check arguments if (dst == NULL || src == NULL) @@ -740,6 +738,10 @@ } else { + const int + wdivisor = doubleMC ? 2 : 1, + divisor = doubleMC ? 4 : 8; + for (xc = 0; xc < dst->width / wdivisor; xc++) { const int x = xc / divisor; @@ -765,19 +767,22 @@ } c = dmC64GetMCColor(src, (src->bitmap[0][bmoffs] >> v) & 3, 0, vbank, scroffs); *d++ = c; - *d++ = c; + if (doubleMC) + *d++ = c; } else if (src->type & D64_FMT_ILACE) { *d++ = dmC64GetMCColor(src, (src->bitmap[0][bmoffs] >> v) & 3, 0, src->laceBank1, scroffs); - *d++ = dmC64GetMCColor(src, (src->bitmap[1][bmoffs] >> v) & 3, 0, src->laceBank2, scroffs); + if (doubleMC) + *d++ = dmC64GetMCColor(src, (src->bitmap[1][bmoffs] >> v) & 3, 0, src->laceBank2, scroffs); } else { c = dmC64GetMCColor(src, (src->bitmap[0][bmoffs] >> v) & 3, 0, 0, scroffs); *d++ = c; - *d++ = c; + if (doubleMC) + *d++ = c; } } }