mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r13602) -Codechange: little speedup for 8bpp-optimized blitter
This commit is contained in:
parent
2ca4b8b2e4
commit
37b8e87454
|
@ -71,24 +71,28 @@ void Blitter_8bppOptimized::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Z
|
||||||
/* Skip transparent pixels */
|
/* Skip transparent pixels */
|
||||||
dst += trans;
|
dst += trans;
|
||||||
width -= trans;
|
width -= trans;
|
||||||
if (width <= 0) continue;
|
if (width <= 0 || pixels == 0) continue;
|
||||||
pixels = min<uint>(pixels, (uint)width);
|
pixels = min<uint>(pixels, (uint)width);
|
||||||
width -= pixels;
|
width -= pixels;
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case BM_COLOUR_REMAP:
|
case BM_COLOUR_REMAP: {
|
||||||
for (uint x = 0; x < pixels; x++) {
|
const uint8 *remap = bp->remap;
|
||||||
if (bp->remap[*src] != 0) *dst = bp->remap[*src];
|
do {
|
||||||
|
uint m = remap[*src];
|
||||||
|
if (m != 0) *dst = m;
|
||||||
dst++; src++;
|
dst++; src++;
|
||||||
}
|
} while (--pixels != 0);
|
||||||
break;
|
} break;
|
||||||
|
|
||||||
case BM_TRANSPARENT:
|
case BM_TRANSPARENT: {
|
||||||
for (uint x = 0; x < pixels; x++) {
|
const uint8 *remap = bp->remap;
|
||||||
*dst = bp->remap[*dst];
|
src += pixels;
|
||||||
dst++; src++;
|
do {
|
||||||
}
|
*dst = remap[*dst];
|
||||||
break;
|
dst++;
|
||||||
|
} while (--pixels != 0);
|
||||||
|
} break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
memcpy(dst, src, pixels);
|
memcpy(dst, src, pixels);
|
||||||
|
|
Loading…
Reference in New Issue