mirror of https://github.com/OpenTTD/OpenTTD
(svn r6180) Use a switch instead of function pointers to choose the blitter
parent
1299f0b00d
commit
f5e70b67b5
27
gfx.c
27
gfx.c
|
@ -1380,19 +1380,6 @@ static void GfxMainBlitter(const Sprite *sprite, int x, int y, int mode)
|
||||||
BlitterParams bp;
|
BlitterParams bp;
|
||||||
int zoom_mask = ~((1 << dpi->zoom) - 1);
|
int zoom_mask = ~((1 << dpi->zoom) - 1);
|
||||||
|
|
||||||
static const BlitZoomFunc zf_tile[3] =
|
|
||||||
{
|
|
||||||
GfxBlitTileZoomIn,
|
|
||||||
GfxBlitTileZoomMedium,
|
|
||||||
GfxBlitTileZoomOut
|
|
||||||
};
|
|
||||||
static const BlitZoomFunc zf_uncomp[3] =
|
|
||||||
{
|
|
||||||
GfxBlitZoomInUncomp,
|
|
||||||
GfxBlitZoomMediumUncomp,
|
|
||||||
GfxBlitZoomOutUncomp
|
|
||||||
};
|
|
||||||
|
|
||||||
/* decode sprite header */
|
/* decode sprite header */
|
||||||
x += sprite->x_offs;
|
x += sprite->x_offs;
|
||||||
y += sprite->y_offs;
|
y += sprite->y_offs;
|
||||||
|
@ -1450,7 +1437,12 @@ static void GfxMainBlitter(const Sprite *sprite, int x, int y, int mode)
|
||||||
if (bp.width <= 0) return;
|
if (bp.width <= 0) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
zf_tile[dpi->zoom](&bp);
|
switch (dpi->zoom) {
|
||||||
|
default: NOT_REACHED();
|
||||||
|
case 0: GfxBlitTileZoomIn(&bp); break;
|
||||||
|
case 1: GfxBlitTileZoomMedium(&bp); break;
|
||||||
|
case 2: GfxBlitTileZoomOut(&bp); break;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
bp.sprite += bp.width * (bp.height & ~zoom_mask);
|
bp.sprite += bp.width * (bp.height & ~zoom_mask);
|
||||||
bp.height &= zoom_mask;
|
bp.height &= zoom_mask;
|
||||||
|
@ -1487,7 +1479,12 @@ static void GfxMainBlitter(const Sprite *sprite, int x, int y, int mode)
|
||||||
if (bp.width <= 0) return;
|
if (bp.width <= 0) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
zf_uncomp[dpi->zoom](&bp);
|
switch (dpi->zoom) {
|
||||||
|
default: NOT_REACHED();
|
||||||
|
case 0: GfxBlitZoomInUncomp(&bp); break;
|
||||||
|
case 1: GfxBlitZoomMediumUncomp(&bp); break;
|
||||||
|
case 2: GfxBlitZoomOutUncomp(&bp); break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue