(svn r6301) -Codechange: if () cascades -> switch ()

This commit is contained in:
tron 2006-09-02 06:36:30 +00:00
parent 04745c2d66
commit 8ba55322c1

80
gfx.c
View File

@ -675,9 +675,9 @@ static void GfxBlitTileZoomIn(BlitterParams *bp)
Pixel *dst;
const byte *ctab;
if (bp->mode & 1) {
src_o += ReadLE16Aligned(src_o + bp->start_y * 2);
switch (bp->mode) {
case 1:
do {
do {
done = src_o[0];
@ -718,8 +718,9 @@ static void GfxBlitTileZoomIn(BlitterParams *bp)
bp->dst += bp->pitch;
} while (--bp->height != 0);
} else if (bp->mode & 2) {
src_o += ReadLE16Aligned(src_o + bp->start_y * 2);
break;
case 2:
do {
do {
done = src_o[0];
@ -752,8 +753,9 @@ static void GfxBlitTileZoomIn(BlitterParams *bp)
bp->dst += bp->pitch;
} while (--bp->height != 0);
} else {
src_o += ReadLE16Aligned(src_o + bp->start_y * 2);
break;
default:
do {
do {
done = src_o[0];
@ -795,6 +797,7 @@ static void GfxBlitTileZoomIn(BlitterParams *bp)
bp->dst += bp->pitch;
} while (--bp->height != 0);
break;
}
}
@ -809,7 +812,8 @@ static void GfxBlitZoomInUncomp(BlitterParams *bp)
assert(height > 0);
assert(width > 0);
if (bp->mode & 1) {
switch (bp->mode) {
case 1:
if (bp->info & 1) {
const byte *ctab = _color_remap_ptr;
@ -823,7 +827,9 @@ static void GfxBlitZoomInUncomp(BlitterParams *bp)
dst += bp->pitch;
} while (--height != 0);
}
} else if (bp->mode & 2) {
break;
case 2:
if (bp->info & 1) {
const byte *ctab = _color_remap_ptr;
@ -834,7 +840,9 @@ static void GfxBlitZoomInUncomp(BlitterParams *bp)
dst += bp->pitch;
} while (--height != 0);
}
} else {
break;
default:
if (!(bp->info & 1)) {
do {
memcpy(dst, src, width);
@ -865,6 +873,7 @@ static void GfxBlitZoomInUncomp(BlitterParams *bp)
dst += bp->pitch - width;
} while (--height != 0);
}
break;
}
}
@ -877,8 +886,9 @@ static void GfxBlitTileZoomMedium(BlitterParams *bp)
Pixel *dst;
const byte *ctab;
if (bp->mode & 1) {
src_o += ReadLE16Aligned(src_o + bp->start_y * 2);
switch (bp->mode) {
case 1:
do {
do {
done = src_o[0];
@ -926,8 +936,9 @@ static void GfxBlitTileZoomMedium(BlitterParams *bp)
src_o += (done & 0x7F) + 2;
} while (!(done & 0x80));
} while (--bp->height != 0);
} else if (bp->mode & 2) {
src_o += ReadLE16Aligned(src_o + bp->start_y * 2);
break;
case 2:
do {
do {
done = src_o[0];
@ -971,8 +982,9 @@ static void GfxBlitTileZoomMedium(BlitterParams *bp)
src_o += (done & 0x7F) + 2;
} while (!(done & 0x80));
} while (--bp->height != 0);
} else {
src_o += ReadLE16Aligned(src_o + bp->start_y * 2);
break;
default:
do {
do {
done = src_o[0];
@ -1022,6 +1034,7 @@ static void GfxBlitTileZoomMedium(BlitterParams *bp)
src_o += (done & 0x7F) + 2;
} while (!(done & 0x80));
} while (--bp->height != 0);
break;
}
}
@ -1036,7 +1049,8 @@ static void GfxBlitZoomMediumUncomp(BlitterParams *bp)
assert(height > 0);
assert(width > 0);
if (bp->mode & 1) {
switch (bp->mode) {
case 1:
if (bp->info & 1) {
const byte *ctab = _color_remap_ptr;
@ -1050,7 +1064,9 @@ static void GfxBlitZoomMediumUncomp(BlitterParams *bp)
dst += bp->pitch;
}
}
} else if (bp->mode & 2) {
break;
case 2:
if (bp->info & 1) {
const byte *ctab = _color_remap_ptr;
@ -1061,7 +1077,9 @@ static void GfxBlitZoomMediumUncomp(BlitterParams *bp)
dst += bp->pitch;
}
}
} else {
break;
default:
if (bp->info & 1) {
for (height >>= 1; height != 0; height--) {
for (i = 0; i != width >> 1; i++)
@ -1070,6 +1088,7 @@ static void GfxBlitZoomMediumUncomp(BlitterParams *bp)
dst += bp->pitch;
}
}
break;
}
}
@ -1082,8 +1101,9 @@ static void GfxBlitTileZoomOut(BlitterParams *bp)
Pixel *dst;
const byte *ctab;
if (bp->mode & 1) {
src_o += ReadLE16Aligned(src_o + bp->start_y * 2);
switch (bp->mode) {
case 1:
for (;;) {
do {
done = src_o[0];
@ -1151,8 +1171,9 @@ static void GfxBlitTileZoomOut(BlitterParams *bp)
} while (!(done & 0x80));
if (--bp->height == 0) return;
}
} else if (bp->mode & 2) {
src_o += ReadLE16Aligned(src_o + bp->start_y * 2);
break;
case 2:
for (;;) {
do {
done = src_o[0];
@ -1216,8 +1237,9 @@ static void GfxBlitTileZoomOut(BlitterParams *bp)
} while (!(done & 0x80));
if (--bp->height == 0) return;
}
} else {
src_o += ReadLE16Aligned(src_o + bp->start_y * 2);
break;
default:
for (;;) {
do {
done = src_o[0];
@ -1286,6 +1308,7 @@ static void GfxBlitTileZoomOut(BlitterParams *bp)
} while (!(done & 0x80));
if (--bp->height == 0) return;
}
break;
}
}
@ -1300,7 +1323,8 @@ static void GfxBlitZoomOutUncomp(BlitterParams *bp)
assert(height > 0);
assert(width > 0);
if (bp->mode & 1) {
switch (bp->mode) {
case 1:
if (bp->info & 1) {
const byte *ctab = _color_remap_ptr;
@ -1314,7 +1338,9 @@ static void GfxBlitZoomOutUncomp(BlitterParams *bp)
dst += bp->pitch;
}
}
} else if (bp->mode & 2) {
break;
case 2:
if (bp->info & 1) {
const byte *ctab = _color_remap_ptr;
@ -1325,7 +1351,9 @@ static void GfxBlitZoomOutUncomp(BlitterParams *bp)
dst += bp->pitch;
}
}
} else {
break;
default:
if (bp->info & 1) {
for (height >>= 2; height != 0; height--) {
for (i = 0; i != width >> 2; i++)
@ -1334,10 +1362,10 @@ static void GfxBlitZoomOutUncomp(BlitterParams *bp)
dst += bp->pitch;
}
}
break;
}
}
typedef void (*BlitZoomFunc)(BlitterParams *bp);
static void GfxMainBlitter(const Sprite *sprite, int x, int y, int mode)
{