diff options
author | tron <tron@openttd.org> | 2006-09-02 06:36:30 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2006-09-02 06:36:30 +0000 |
commit | dcc25abeec65424018eb396b0580eaf521632310 (patch) | |
tree | 926ad15d0640e633cd700a8a8caeaaf80e93a601 | |
parent | 45eb7cb12aaff248b4d99b7d413ba6f412d95121 (diff) | |
download | openttd-dcc25abeec65424018eb396b0580eaf521632310.tar.xz |
(svn r6301) -Codechange: if () cascades -> switch ()
-rw-r--r-- | gfx.c | 1118 |
1 files changed, 573 insertions, 545 deletions
@@ -675,126 +675,129 @@ static void GfxBlitTileZoomIn(BlitterParams *bp) Pixel *dst; const byte *ctab; - if (bp->mode & 1) { - src_o += ReadLE16Aligned(src_o + bp->start_y * 2); - - do { + src_o += ReadLE16Aligned(src_o + bp->start_y * 2); + switch (bp->mode) { + case 1: do { - done = src_o[0]; - num = done & 0x7F; - skip = src_o[1]; - src = src_o + 2; - src_o += num + 2; - - dst = bp->dst; - - if ( (skip -= bp->start_x) > 0) { - dst += skip; - } else { - src -= skip; - num += skip; - if (num <= 0) continue; - skip = 0; - } - - skip = skip + num - bp->width; - if (skip > 0) { - num -= skip; - if (num <= 0) continue; - } - - ctab = _color_remap_ptr; + do { + done = src_o[0]; + num = done & 0x7F; + skip = src_o[1]; + src = src_o + 2; + src_o += num + 2; + + dst = bp->dst; + + if ( (skip -= bp->start_x) > 0) { + dst += skip; + } else { + src -= skip; + num += skip; + if (num <= 0) continue; + skip = 0; + } + + skip = skip + num - bp->width; + if (skip > 0) { + num -= skip; + if (num <= 0) continue; + } + + ctab = _color_remap_ptr; + + for (; num >= 4; num -=4) { + dst[3] = ctab[src[3]]; + dst[2] = ctab[src[2]]; + dst[1] = ctab[src[1]]; + dst[0] = ctab[src[0]]; + dst += 4; + src += 4; + } + for (; num != 0; num--) *dst++ = ctab[*src++]; + } while (!(done & 0x80)); - for (; num >= 4; num -=4) { - dst[3] = ctab[src[3]]; - dst[2] = ctab[src[2]]; - dst[1] = ctab[src[1]]; - dst[0] = ctab[src[0]]; - dst += 4; - src += 4; - } - for (; num != 0; num--) *dst++ = ctab[*src++]; - } while (!(done & 0x80)); + bp->dst += bp->pitch; + } while (--bp->height != 0); + break; - bp->dst += bp->pitch; - } while (--bp->height != 0); - } else if (bp->mode & 2) { - src_o += ReadLE16Aligned(src_o + bp->start_y * 2); - do { + case 2: do { - done = src_o[0]; - num = done & 0x7F; - skip = src_o[1]; - src_o += num + 2; - - dst = bp->dst; - - if ( (skip -= bp->start_x) > 0) { - dst += skip; - } else { - num += skip; - if (num <= 0) continue; - skip = 0; - } - - skip = skip + num - bp->width; - if (skip > 0) { - num -= skip; - if (num <= 0) continue; - } + do { + done = src_o[0]; + num = done & 0x7F; + skip = src_o[1]; + src_o += num + 2; + + dst = bp->dst; + + if ( (skip -= bp->start_x) > 0) { + dst += skip; + } else { + num += skip; + if (num <= 0) continue; + skip = 0; + } + + skip = skip + num - bp->width; + if (skip > 0) { + num -= skip; + if (num <= 0) continue; + } + + ctab = _color_remap_ptr; + for (; num != 0; num--) { + *dst = ctab[*dst]; + dst++; + } + } while (!(done & 0x80)); - ctab = _color_remap_ptr; - for (; num != 0; num--) { - *dst = ctab[*dst]; - dst++; - } - } while (!(done & 0x80)); + bp->dst += bp->pitch; + } while (--bp->height != 0); + break; - bp->dst += bp->pitch; - } while (--bp->height != 0); - } else { - src_o += ReadLE16Aligned(src_o + bp->start_y * 2); - do { + default: do { - done = src_o[0]; - num = done & 0x7F; - skip = src_o[1]; - src = src_o + 2; - src_o += num + 2; - - dst = bp->dst; - - if ( (skip -= bp->start_x) > 0) { - dst += skip; - } else { - src -= skip; - num += skip; - if (num <= 0) continue; - skip = 0; - } - - skip = skip + num - bp->width; - if (skip > 0) { - num -= skip; - if (num <= 0) continue; - } + do { + done = src_o[0]; + num = done & 0x7F; + skip = src_o[1]; + src = src_o + 2; + src_o += num + 2; + + dst = bp->dst; + + if ( (skip -= bp->start_x) > 0) { + dst += skip; + } else { + src -= skip; + num += skip; + if (num <= 0) continue; + skip = 0; + } + + skip = skip + num - bp->width; + if (skip > 0) { + num -= skip; + if (num <= 0) continue; + } #if defined(_WIN32) - if (num & 1) *dst++ = *src++; - if (num & 2) { *(uint16*)dst = *(uint16*)src; dst += 2; src += 2; } - if (num >>= 2) { - do { - *(uint32*)dst = *(uint32*)src; - dst += 4; - src += 4; - } while (--num != 0); - } + if (num & 1) *dst++ = *src++; + if (num & 2) { *(uint16*)dst = *(uint16*)src; dst += 2; src += 2; } + if (num >>= 2) { + do { + *(uint32*)dst = *(uint32*)src; + dst += 4; + src += 4; + } while (--num != 0); + } #else - memcpy(dst, src, num); + memcpy(dst, src, num); #endif - } while (!(done & 0x80)); + } while (!(done & 0x80)); - bp->dst += bp->pitch; - } while (--bp->height != 0); + bp->dst += bp->pitch; + } while (--bp->height != 0); + break; } } @@ -809,62 +812,68 @@ static void GfxBlitZoomInUncomp(BlitterParams *bp) assert(height > 0); assert(width > 0); - if (bp->mode & 1) { - if (bp->info & 1) { - const byte *ctab = _color_remap_ptr; + switch (bp->mode) { + case 1: + if (bp->info & 1) { + const byte *ctab = _color_remap_ptr; - do { - for (i = 0; i != width; i++) { - byte b = ctab[src[i]]; + do { + for (i = 0; i != width; i++) { + byte b = ctab[src[i]]; + + if (b != 0) dst[i] = b; + } + src += bp->width_org; + dst += bp->pitch; + } while (--height != 0); + } + break; - if (b != 0) dst[i] = b; - } - src += bp->width_org; - dst += bp->pitch; - } while (--height != 0); - } - } else if (bp->mode & 2) { - if (bp->info & 1) { - const byte *ctab = _color_remap_ptr; + case 2: + if (bp->info & 1) { + const byte *ctab = _color_remap_ptr; - do { - for (i = 0; i != width; i++) - if (src[i] != 0) dst[i] = ctab[dst[i]]; - src += bp->width_org; - dst += bp->pitch; - } while (--height != 0); - } - } else { - if (!(bp->info & 1)) { - do { - memcpy(dst, src, width); - src += bp->width_org; - dst += bp->pitch; - } while (--height != 0); - } else { - do { - int n = width; + do { + for (i = 0; i != width; i++) + if (src[i] != 0) dst[i] = ctab[dst[i]]; + src += bp->width_org; + dst += bp->pitch; + } while (--height != 0); + } + break; - for (; n >= 4; n -= 4) { - if (src[0] != 0) dst[0] = src[0]; - if (src[1] != 0) dst[1] = src[1]; - if (src[2] != 0) dst[2] = src[2]; - if (src[3] != 0) dst[3] = src[3]; + default: + if (!(bp->info & 1)) { + do { + memcpy(dst, src, width); + src += bp->width_org; + dst += bp->pitch; + } while (--height != 0); + } else { + do { + int n = width; - dst += 4; - src += 4; - } + for (; n >= 4; n -= 4) { + if (src[0] != 0) dst[0] = src[0]; + if (src[1] != 0) dst[1] = src[1]; + if (src[2] != 0) dst[2] = src[2]; + if (src[3] != 0) dst[3] = src[3]; - for (; n != 0; n--) { - if (src[0] != 0) dst[0] = src[0]; - src++; - dst++; - } + dst += 4; + src += 4; + } - src += bp->width_org - width; - dst += bp->pitch - width; - } while (--height != 0); - } + for (; n != 0; n--) { + if (src[0] != 0) dst[0] = src[0]; + src++; + dst++; + } + + src += bp->width_org - width; + dst += bp->pitch - width; + } while (--height != 0); + } + break; } } @@ -877,151 +886,155 @@ static void GfxBlitTileZoomMedium(BlitterParams *bp) Pixel *dst; const byte *ctab; - if (bp->mode & 1) { - src_o += ReadLE16Aligned(src_o + bp->start_y * 2); - do { + src_o += ReadLE16Aligned(src_o + bp->start_y * 2); + switch (bp->mode) { + case 1: do { - done = src_o[0]; - num = done & 0x7F; - skip = src_o[1]; - src = src_o + 2; - src_o += num + 2; - - dst = bp->dst; - - if (skip & 1) { - skip++; - src++; - if (--num == 0) continue; - } - - if ( (skip -= bp->start_x) > 0) { - dst += skip >> 1; - } else { - src -= skip; - num += skip; - if (num <= 0) continue; - skip = 0; - } - - skip = skip + num - bp->width; - if (skip > 0) { - num -= skip; - if (num <= 0) continue; - } + do { + done = src_o[0]; + num = done & 0x7F; + skip = src_o[1]; + src = src_o + 2; + src_o += num + 2; + + dst = bp->dst; + + if (skip & 1) { + skip++; + src++; + if (--num == 0) continue; + } + + if ( (skip -= bp->start_x) > 0) { + dst += skip >> 1; + } else { + src -= skip; + num += skip; + if (num <= 0) continue; + skip = 0; + } + + skip = skip + num - bp->width; + if (skip > 0) { + num -= skip; + if (num <= 0) continue; + } + + ctab = _color_remap_ptr; + num = (num + 1) >> 1; + for (; num != 0; num--) { + *dst = ctab[*src]; + dst++; + src += 2; + } + } while (!(done & 0x80)); + bp->dst += bp->pitch; + if (--bp->height == 0) return; - ctab = _color_remap_ptr; - num = (num + 1) >> 1; - for (; num != 0; num--) { - *dst = ctab[*src]; - dst++; - src += 2; - } - } while (!(done & 0x80)); - bp->dst += bp->pitch; - if (--bp->height == 0) return; + do { + done = src_o[0]; + src_o += (done & 0x7F) + 2; + } while (!(done & 0x80)); + } while (--bp->height != 0); + break; + case 2: do { - done = src_o[0]; - 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); - do { - do { - done = src_o[0]; - num = done & 0x7F; - skip = src_o[1]; - src_o += num + 2; - - dst = bp->dst; - - if (skip & 1) { - skip++; - if (--num == 0) continue; - } - - if ( (skip -= bp->start_x) > 0) { - dst += skip >> 1; - } else { - num += skip; - if (num <= 0) continue; - skip = 0; - } - - skip = skip + num - bp->width; - if (skip > 0) { - num -= skip; - if (num <= 0) continue; - } + do { + done = src_o[0]; + num = done & 0x7F; + skip = src_o[1]; + src_o += num + 2; + + dst = bp->dst; + + if (skip & 1) { + skip++; + if (--num == 0) continue; + } + + if ( (skip -= bp->start_x) > 0) { + dst += skip >> 1; + } else { + num += skip; + if (num <= 0) continue; + skip = 0; + } + + skip = skip + num - bp->width; + if (skip > 0) { + num -= skip; + if (num <= 0) continue; + } + + ctab = _color_remap_ptr; + num = (num + 1) >> 1; + for (; num != 0; num--) { + *dst = ctab[*dst]; + dst++; + } + } while (!(done & 0x80)); + bp->dst += bp->pitch; + if (--bp->height == 0) return; - ctab = _color_remap_ptr; - num = (num + 1) >> 1; - for (; num != 0; num--) { - *dst = ctab[*dst]; - dst++; - } - } while (!(done & 0x80)); - bp->dst += bp->pitch; - if (--bp->height == 0) return; + do { + done = src_o[0]; + src_o += (done & 0x7F) + 2; + } while (!(done & 0x80)); + } while (--bp->height != 0); + break; + default: do { - done = src_o[0]; - src_o += (done & 0x7F) + 2; - } while (!(done & 0x80)); - } while (--bp->height != 0); - } else { - src_o += ReadLE16Aligned(src_o + bp->start_y * 2); - do { - do { - done = src_o[0]; - num = done & 0x7F; - skip = src_o[1]; - src = src_o + 2; - src_o += num + 2; - - dst = bp->dst; - - if (skip & 1) { - skip++; - src++; - if (--num == 0) continue; - } - - if ( (skip -= bp->start_x) > 0) { - dst += skip >> 1; - } else { - src -= skip; - num += skip; - if (num <= 0) continue; - skip = 0; - } - - skip = skip + num - bp->width; - if (skip > 0) { - num -= skip; - if (num <= 0) continue; - } - - num = (num + 1) >> 1; - - for (; num != 0; num--) { - *dst = *src; - dst++; - src += 2; - } - - } while (!(done & 0x80)); - - bp->dst += bp->pitch; - if (--bp->height == 0) return; + do { + done = src_o[0]; + num = done & 0x7F; + skip = src_o[1]; + src = src_o + 2; + src_o += num + 2; + + dst = bp->dst; + + if (skip & 1) { + skip++; + src++; + if (--num == 0) continue; + } + + if ( (skip -= bp->start_x) > 0) { + dst += skip >> 1; + } else { + src -= skip; + num += skip; + if (num <= 0) continue; + skip = 0; + } + + skip = skip + num - bp->width; + if (skip > 0) { + num -= skip; + if (num <= 0) continue; + } + + num = (num + 1) >> 1; + + for (; num != 0; num--) { + *dst = *src; + dst++; + src += 2; + } + + } while (!(done & 0x80)); + + bp->dst += bp->pitch; + if (--bp->height == 0) return; - do { - done = src_o[0]; - src_o += (done & 0x7F) + 2; - } while (!(done & 0x80)); - } while (--bp->height != 0); + do { + done = src_o[0]; + src_o += (done & 0x7F) + 2; + } while (!(done & 0x80)); + } while (--bp->height != 0); + break; } } @@ -1036,40 +1049,46 @@ static void GfxBlitZoomMediumUncomp(BlitterParams *bp) assert(height > 0); assert(width > 0); - if (bp->mode & 1) { - if (bp->info & 1) { - const byte *ctab = _color_remap_ptr; + switch (bp->mode) { + case 1: + if (bp->info & 1) { + const byte *ctab = _color_remap_ptr; - for (height >>= 1; height != 0; height--) { - for (i = 0; i != width >> 1; i++) { - byte b = ctab[src[i * 2]]; + for (height >>= 1; height != 0; height--) { + for (i = 0; i != width >> 1; i++) { + byte b = ctab[src[i * 2]]; - if (b != 0) dst[i] = b; + if (b != 0) dst[i] = b; + } + src += bp->width_org * 2; + dst += bp->pitch; } - src += bp->width_org * 2; - dst += bp->pitch; } - } - } else if (bp->mode & 2) { - if (bp->info & 1) { - const byte *ctab = _color_remap_ptr; - - for (height >>= 1; height != 0; height--) { - for (i = 0; i != width >> 1; i++) - if (src[i * 2] != 0) dst[i] = ctab[dst[i]]; - src += bp->width_org * 2; - dst += bp->pitch; + break; + + case 2: + if (bp->info & 1) { + const byte *ctab = _color_remap_ptr; + + for (height >>= 1; height != 0; height--) { + for (i = 0; i != width >> 1; i++) + if (src[i * 2] != 0) dst[i] = ctab[dst[i]]; + src += bp->width_org * 2; + dst += bp->pitch; + } } - } - } else { - if (bp->info & 1) { - for (height >>= 1; height != 0; height--) { - for (i = 0; i != width >> 1; i++) - if (src[i * 2] != 0) dst[i] = src[i * 2]; - src += bp->width_org * 2; - dst += bp->pitch; + break; + + default: + if (bp->info & 1) { + for (height >>= 1; height != 0; height--) { + for (i = 0; i != width >> 1; i++) + if (src[i * 2] != 0) dst[i] = src[i * 2]; + src += bp->width_org * 2; + dst += bp->pitch; + } } - } + break; } } @@ -1082,210 +1101,214 @@ static void GfxBlitTileZoomOut(BlitterParams *bp) Pixel *dst; const byte *ctab; - if (bp->mode & 1) { - src_o += ReadLE16Aligned(src_o + bp->start_y * 2); - for (;;) { - do { - done = src_o[0]; - num = done & 0x7F; - skip = src_o[1]; - src = src_o + 2; - src_o += num + 2; - - dst = bp->dst; - - if (skip & 1) { - skip++; - src++; - if (--num == 0) continue; - } - - if (skip & 2) { - skip += 2; - src += 2; - num -= 2; - if (num <= 0) continue; - } - - if ( (skip -= bp->start_x) > 0) { - dst += skip >> 2; - } else { - src -= skip; - num += skip; - if (num <= 0) continue; - skip = 0; - } - - skip = skip + num - bp->width; - if (skip > 0) { - num -= skip; - if (num <= 0) continue; - } - - ctab = _color_remap_ptr; - num = (num + 3) >> 2; - for (; num != 0; num--) { - *dst = ctab[*src]; - dst++; - src += 4; - } - } while (!(done & 0x80)); - bp->dst += bp->pitch; - if (--bp->height == 0) return; - - do { - done = src_o[0]; - src_o += (done & 0x7F) + 2; - } while (!(done & 0x80)); - if (--bp->height == 0) return; - - do { - done = src_o[0]; - src_o += (done & 0x7F) + 2; - } while (!(done & 0x80)); - if (--bp->height == 0) return; - - do { - done = src_o[0]; - src_o += (done & 0x7F) + 2; - } while (!(done & 0x80)); - if (--bp->height == 0) return; - } - } else if (bp->mode & 2) { - src_o += ReadLE16Aligned(src_o + bp->start_y * 2); - for (;;) { - do { - done = src_o[0]; - num = done & 0x7F; - skip = src_o[1]; - src_o += num + 2; - - dst = bp->dst; - - if (skip & 1) { - skip++; - if (--num == 0) continue; - } - - if (skip & 2) { - skip += 2; - num -= 2; - if (num <= 0) continue; - } - - if ( (skip -= bp->start_x) > 0) { - dst += skip >> 2; - } else { - num += skip; - if (num <= 0) continue; - skip = 0; - } - - skip = skip + num - bp->width; - if (skip > 0) { - num -= skip; - if (num <= 0) continue; - } - - ctab = _color_remap_ptr; - num = (num + 3) >> 2; - for (; num != 0; num--) { - *dst = ctab[*dst]; - dst++; - } - - } while (!(done & 0x80)); - bp->dst += bp->pitch; - if (--bp->height == 0) return; - - do { - done = src_o[0]; - src_o += (done & 0x7F) + 2; - } while (!(done & 0x80)); - if (--bp->height == 0) return; + src_o += ReadLE16Aligned(src_o + bp->start_y * 2); + switch (bp->mode) { + case 1: + for (;;) { + do { + done = src_o[0]; + num = done & 0x7F; + skip = src_o[1]; + src = src_o + 2; + src_o += num + 2; + + dst = bp->dst; + + if (skip & 1) { + skip++; + src++; + if (--num == 0) continue; + } + + if (skip & 2) { + skip += 2; + src += 2; + num -= 2; + if (num <= 0) continue; + } + + if ( (skip -= bp->start_x) > 0) { + dst += skip >> 2; + } else { + src -= skip; + num += skip; + if (num <= 0) continue; + skip = 0; + } + + skip = skip + num - bp->width; + if (skip > 0) { + num -= skip; + if (num <= 0) continue; + } + + ctab = _color_remap_ptr; + num = (num + 3) >> 2; + for (; num != 0; num--) { + *dst = ctab[*src]; + dst++; + src += 4; + } + } while (!(done & 0x80)); + bp->dst += bp->pitch; + if (--bp->height == 0) return; - do { - done = src_o[0]; - src_o += (done & 0x7F) + 2; - } while (!(done & 0x80)); - if (--bp->height == 0) return; + do { + done = src_o[0]; + src_o += (done & 0x7F) + 2; + } while (!(done & 0x80)); + if (--bp->height == 0) return; - do { - done = src_o[0]; - src_o += (done & 0x7F) + 2; - } while (!(done & 0x80)); - if (--bp->height == 0) return; - } - } else { - src_o += ReadLE16Aligned(src_o + bp->start_y * 2); - for (;;) { - do { - done = src_o[0]; - num = done & 0x7F; - skip = src_o[1]; - src = src_o + 2; - src_o += num + 2; - - dst = bp->dst; - - if (skip & 1) { - skip++; - src++; - if (--num == 0) continue; - } + do { + done = src_o[0]; + src_o += (done & 0x7F) + 2; + } while (!(done & 0x80)); + if (--bp->height == 0) return; - if (skip & 2) { - skip += 2; - src += 2; - num -= 2; - if (num <= 0) continue; - } + do { + done = src_o[0]; + src_o += (done & 0x7F) + 2; + } while (!(done & 0x80)); + if (--bp->height == 0) return; + } + break; - if ( (skip -= bp->start_x) > 0) { - dst += skip >> 2; - } else { - src -= skip; - num += skip; - if (num <= 0) continue; - skip = 0; - } + case 2: + for (;;) { + do { + done = src_o[0]; + num = done & 0x7F; + skip = src_o[1]; + src_o += num + 2; + + dst = bp->dst; + + if (skip & 1) { + skip++; + if (--num == 0) continue; + } + + if (skip & 2) { + skip += 2; + num -= 2; + if (num <= 0) continue; + } + + if ( (skip -= bp->start_x) > 0) { + dst += skip >> 2; + } else { + num += skip; + if (num <= 0) continue; + skip = 0; + } + + skip = skip + num - bp->width; + if (skip > 0) { + num -= skip; + if (num <= 0) continue; + } + + ctab = _color_remap_ptr; + num = (num + 3) >> 2; + for (; num != 0; num--) { + *dst = ctab[*dst]; + dst++; + } + + } while (!(done & 0x80)); + bp->dst += bp->pitch; + if (--bp->height == 0) return; - skip = skip + num - bp->width; - if (skip > 0) { - num -= skip; - if (num <= 0) continue; - } + do { + done = src_o[0]; + src_o += (done & 0x7F) + 2; + } while (!(done & 0x80)); + if (--bp->height == 0) return; - num = (num + 3) >> 2; + do { + done = src_o[0]; + src_o += (done & 0x7F) + 2; + } while (!(done & 0x80)); + if (--bp->height == 0) return; - for (; num != 0; num--) { - *dst = *src; - dst++; - src += 4; - } - } while (!(done & 0x80)); + do { + done = src_o[0]; + src_o += (done & 0x7F) + 2; + } while (!(done & 0x80)); + if (--bp->height == 0) return; + } + break; - bp->dst += bp->pitch; - if (--bp->height == 0) return; + default: + for (;;) { + do { + done = src_o[0]; + num = done & 0x7F; + skip = src_o[1]; + src = src_o + 2; + src_o += num + 2; + + dst = bp->dst; + + if (skip & 1) { + skip++; + src++; + if (--num == 0) continue; + } + + if (skip & 2) { + skip += 2; + src += 2; + num -= 2; + if (num <= 0) continue; + } + + if ( (skip -= bp->start_x) > 0) { + dst += skip >> 2; + } else { + src -= skip; + num += skip; + if (num <= 0) continue; + skip = 0; + } + + skip = skip + num - bp->width; + if (skip > 0) { + num -= skip; + if (num <= 0) continue; + } + + num = (num + 3) >> 2; + + for (; num != 0; num--) { + *dst = *src; + dst++; + src += 4; + } + } while (!(done & 0x80)); + + bp->dst += bp->pitch; + if (--bp->height == 0) return; - do { - done = src_o[0]; - src_o += (done & 0x7F) + 2; - } while (!(done & 0x80)); - if (--bp->height == 0) return; + do { + done = src_o[0]; + src_o += (done & 0x7F) + 2; + } while (!(done & 0x80)); + if (--bp->height == 0) return; - do { - done = src_o[0]; - src_o += (done & 0x7F) + 2; - } while (!(done & 0x80)); - if (--bp->height == 0) return; + do { + done = src_o[0]; + src_o += (done & 0x7F) + 2; + } while (!(done & 0x80)); + if (--bp->height == 0) return; - do { - done = src_o[0]; - src_o += (done & 0x7F) + 2; - } while (!(done & 0x80)); - if (--bp->height == 0) return; - } + do { + done = src_o[0]; + src_o += (done & 0x7F) + 2; + } while (!(done & 0x80)); + if (--bp->height == 0) return; + } + break; } } @@ -1300,44 +1323,49 @@ static void GfxBlitZoomOutUncomp(BlitterParams *bp) assert(height > 0); assert(width > 0); - if (bp->mode & 1) { - if (bp->info & 1) { - const byte *ctab = _color_remap_ptr; + switch (bp->mode) { + case 1: + if (bp->info & 1) { + const byte *ctab = _color_remap_ptr; - for (height >>= 2; height != 0; height--) { - for (i = 0; i != width >> 2; i++) { - byte b = ctab[src[i * 4]]; + for (height >>= 2; height != 0; height--) { + for (i = 0; i != width >> 2; i++) { + byte b = ctab[src[i * 4]]; - if (b != 0) dst[i] = b; + if (b != 0) dst[i] = b; + } + src += bp->width_org * 4; + dst += bp->pitch; } - src += bp->width_org * 4; - dst += bp->pitch; } - } - } else if (bp->mode & 2) { - if (bp->info & 1) { - const byte *ctab = _color_remap_ptr; - - for (height >>= 2; height != 0; height--) { - for (i = 0; i != width >> 2; i++) - if (src[i * 4] != 0) dst[i] = ctab[dst[i]]; - src += bp->width_org * 4; - dst += bp->pitch; + break; + + case 2: + if (bp->info & 1) { + const byte *ctab = _color_remap_ptr; + + for (height >>= 2; height != 0; height--) { + for (i = 0; i != width >> 2; i++) + if (src[i * 4] != 0) dst[i] = ctab[dst[i]]; + src += bp->width_org * 4; + dst += bp->pitch; + } } - } - } else { - if (bp->info & 1) { - for (height >>= 2; height != 0; height--) { - for (i = 0; i != width >> 2; i++) - if (src[i * 4] != 0) dst[i] = src[i * 4]; - src += bp->width_org * 4; - dst += bp->pitch; + break; + + default: + if (bp->info & 1) { + for (height >>= 2; height != 0; height--) { + for (i = 0; i != width >> 2; i++) + if (src[i * 4] != 0) dst[i] = src[i * 4]; + src += bp->width_org * 4; + dst += bp->pitch; + } } - } + break; } } -typedef void (*BlitZoomFunc)(BlitterParams *bp); static void GfxMainBlitter(const Sprite *sprite, int x, int y, int mode) { |