mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-16 00:12:51 +00:00
(svn r6302) -Codechange: Remove dead code paths, because the lowest bit of Sprite::info is never unset
This commit is contained in:
parent
8ba55322c1
commit
27b8ad2b58
48
gfx.c
48
gfx.c
@ -663,7 +663,6 @@ typedef struct BlitterParams {
|
|||||||
int width_org;
|
int width_org;
|
||||||
int height_org;
|
int height_org;
|
||||||
int pitch;
|
int pitch;
|
||||||
byte info;
|
|
||||||
} BlitterParams;
|
} BlitterParams;
|
||||||
|
|
||||||
static void GfxBlitTileZoomIn(BlitterParams *bp)
|
static void GfxBlitTileZoomIn(BlitterParams *bp)
|
||||||
@ -813,8 +812,7 @@ static void GfxBlitZoomInUncomp(BlitterParams *bp)
|
|||||||
assert(width > 0);
|
assert(width > 0);
|
||||||
|
|
||||||
switch (bp->mode) {
|
switch (bp->mode) {
|
||||||
case 1:
|
case 1: {
|
||||||
if (bp->info & 1) {
|
|
||||||
const byte *ctab = _color_remap_ptr;
|
const byte *ctab = _color_remap_ptr;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
@ -826,11 +824,10 @@ static void GfxBlitZoomInUncomp(BlitterParams *bp)
|
|||||||
src += bp->width_org;
|
src += bp->width_org;
|
||||||
dst += bp->pitch;
|
dst += bp->pitch;
|
||||||
} while (--height != 0);
|
} while (--height != 0);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 2:
|
case 2: {
|
||||||
if (bp->info & 1) {
|
|
||||||
const byte *ctab = _color_remap_ptr;
|
const byte *ctab = _color_remap_ptr;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
@ -839,17 +836,10 @@ static void GfxBlitZoomInUncomp(BlitterParams *bp)
|
|||||||
src += bp->width_org;
|
src += bp->width_org;
|
||||||
dst += bp->pitch;
|
dst += bp->pitch;
|
||||||
} while (--height != 0);
|
} while (--height != 0);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (!(bp->info & 1)) {
|
|
||||||
do {
|
|
||||||
memcpy(dst, src, width);
|
|
||||||
src += bp->width_org;
|
|
||||||
dst += bp->pitch;
|
|
||||||
} while (--height != 0);
|
|
||||||
} else {
|
|
||||||
do {
|
do {
|
||||||
int n = width;
|
int n = width;
|
||||||
|
|
||||||
@ -872,7 +862,6 @@ static void GfxBlitZoomInUncomp(BlitterParams *bp)
|
|||||||
src += bp->width_org - width;
|
src += bp->width_org - width;
|
||||||
dst += bp->pitch - width;
|
dst += bp->pitch - width;
|
||||||
} while (--height != 0);
|
} while (--height != 0);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1050,8 +1039,7 @@ static void GfxBlitZoomMediumUncomp(BlitterParams *bp)
|
|||||||
assert(width > 0);
|
assert(width > 0);
|
||||||
|
|
||||||
switch (bp->mode) {
|
switch (bp->mode) {
|
||||||
case 1:
|
case 1: {
|
||||||
if (bp->info & 1) {
|
|
||||||
const byte *ctab = _color_remap_ptr;
|
const byte *ctab = _color_remap_ptr;
|
||||||
|
|
||||||
for (height >>= 1; height != 0; height--) {
|
for (height >>= 1; height != 0; height--) {
|
||||||
@ -1063,11 +1051,10 @@ static void GfxBlitZoomMediumUncomp(BlitterParams *bp)
|
|||||||
src += bp->width_org * 2;
|
src += bp->width_org * 2;
|
||||||
dst += bp->pitch;
|
dst += bp->pitch;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 2:
|
case 2: {
|
||||||
if (bp->info & 1) {
|
|
||||||
const byte *ctab = _color_remap_ptr;
|
const byte *ctab = _color_remap_ptr;
|
||||||
|
|
||||||
for (height >>= 1; height != 0; height--) {
|
for (height >>= 1; height != 0; height--) {
|
||||||
@ -1076,18 +1063,16 @@ static void GfxBlitZoomMediumUncomp(BlitterParams *bp)
|
|||||||
src += bp->width_org * 2;
|
src += bp->width_org * 2;
|
||||||
dst += bp->pitch;
|
dst += bp->pitch;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (bp->info & 1) {
|
|
||||||
for (height >>= 1; height != 0; height--) {
|
for (height >>= 1; height != 0; height--) {
|
||||||
for (i = 0; i != width >> 1; i++)
|
for (i = 0; i != width >> 1; i++)
|
||||||
if (src[i * 2] != 0) dst[i] = src[i * 2];
|
if (src[i * 2] != 0) dst[i] = src[i * 2];
|
||||||
src += bp->width_org * 2;
|
src += bp->width_org * 2;
|
||||||
dst += bp->pitch;
|
dst += bp->pitch;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1324,8 +1309,7 @@ static void GfxBlitZoomOutUncomp(BlitterParams *bp)
|
|||||||
assert(width > 0);
|
assert(width > 0);
|
||||||
|
|
||||||
switch (bp->mode) {
|
switch (bp->mode) {
|
||||||
case 1:
|
case 1: {
|
||||||
if (bp->info & 1) {
|
|
||||||
const byte *ctab = _color_remap_ptr;
|
const byte *ctab = _color_remap_ptr;
|
||||||
|
|
||||||
for (height >>= 2; height != 0; height--) {
|
for (height >>= 2; height != 0; height--) {
|
||||||
@ -1337,11 +1321,10 @@ static void GfxBlitZoomOutUncomp(BlitterParams *bp)
|
|||||||
src += bp->width_org * 4;
|
src += bp->width_org * 4;
|
||||||
dst += bp->pitch;
|
dst += bp->pitch;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 2:
|
case 2: {
|
||||||
if (bp->info & 1) {
|
|
||||||
const byte *ctab = _color_remap_ptr;
|
const byte *ctab = _color_remap_ptr;
|
||||||
|
|
||||||
for (height >>= 2; height != 0; height--) {
|
for (height >>= 2; height != 0; height--) {
|
||||||
@ -1350,18 +1333,16 @@ static void GfxBlitZoomOutUncomp(BlitterParams *bp)
|
|||||||
src += bp->width_org * 4;
|
src += bp->width_org * 4;
|
||||||
dst += bp->pitch;
|
dst += bp->pitch;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (bp->info & 1) {
|
|
||||||
for (height >>= 2; height != 0; height--) {
|
for (height >>= 2; height != 0; height--) {
|
||||||
for (i = 0; i != width >> 2; i++)
|
for (i = 0; i != width >> 2; i++)
|
||||||
if (src[i * 4] != 0) dst[i] = src[i * 4];
|
if (src[i * 4] != 0) dst[i] = src[i * 4];
|
||||||
src += bp->width_org * 4;
|
src += bp->width_org * 4;
|
||||||
dst += bp->pitch;
|
dst += bp->pitch;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1371,7 +1352,6 @@ static void GfxMainBlitter(const Sprite *sprite, int x, int y, int mode)
|
|||||||
{
|
{
|
||||||
const DrawPixelInfo *dpi = _cur_dpi;
|
const DrawPixelInfo *dpi = _cur_dpi;
|
||||||
int start_x, start_y;
|
int start_x, start_y;
|
||||||
byte info;
|
|
||||||
BlitterParams bp;
|
BlitterParams bp;
|
||||||
int zoom_mask = ~((1 << dpi->zoom) - 1);
|
int zoom_mask = ~((1 << dpi->zoom) - 1);
|
||||||
|
|
||||||
@ -1380,8 +1360,6 @@ static void GfxMainBlitter(const Sprite *sprite, int x, int y, int mode)
|
|||||||
y += sprite->y_offs;
|
y += sprite->y_offs;
|
||||||
bp.width_org = bp.width = sprite->width;
|
bp.width_org = bp.width = sprite->width;
|
||||||
bp.height_org = bp.height = sprite->height;
|
bp.height_org = bp.height = sprite->height;
|
||||||
info = sprite->info;
|
|
||||||
bp.info = info;
|
|
||||||
bp.sprite_org = bp.sprite = sprite->data;
|
bp.sprite_org = bp.sprite = sprite->data;
|
||||||
bp.dst = dpi->dst_ptr;
|
bp.dst = dpi->dst_ptr;
|
||||||
bp.mode = mode;
|
bp.mode = mode;
|
||||||
@ -1390,7 +1368,7 @@ static void GfxMainBlitter(const Sprite *sprite, int x, int y, int mode)
|
|||||||
assert(bp.height > 0);
|
assert(bp.height > 0);
|
||||||
assert(bp.width > 0);
|
assert(bp.width > 0);
|
||||||
|
|
||||||
if (info & 8) {
|
if (sprite->info & 8) {
|
||||||
/* tile blit */
|
/* tile blit */
|
||||||
start_y = 0;
|
start_y = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user