diff options
Diffstat (limited to 'src/emu/drawgfxm.h')
-rw-r--r-- | src/emu/drawgfxm.h | 1668 |
1 files changed, 834 insertions, 834 deletions
diff --git a/src/emu/drawgfxm.h b/src/emu/drawgfxm.h index 5686f788882..05d67fe2e3a 100644 --- a/src/emu/drawgfxm.h +++ b/src/emu/drawgfxm.h @@ -63,9 +63,9 @@ extern bitmap_ind8 drawgfx_dummy_priority_bitmap; /* macros for using the optional priority */ -#define PRIORITY_VALID(x) (sizeof(x) != sizeof(NO_PRIORITY)) -#define PRIORITY_ADDR(p,t,y,x) (PRIORITY_VALID(t) ? (&(p).pixt<t>(y, x)) : NULL) -#define PRIORITY_ADVANCE(t,p,i) do { if (PRIORITY_VALID(t)) (p) += (i); } while (0) +#define PRIORITY_VALID(x) (sizeof(x) != sizeof(NO_PRIORITY)) +#define PRIORITY_ADDR(p,t,y,x) (PRIORITY_VALID(t) ? (&(p).pixt<t>(y, x)) : NULL) +#define PRIORITY_ADVANCE(t,p,i) do { if (PRIORITY_VALID(t)) (p) += (i); } while (0) /*************************************************************************** @@ -77,12 +77,12 @@ extern bitmap_ind8 drawgfx_dummy_priority_bitmap; regardless of pen, copying directly -------------------------------------------------*/ -#define PIXEL_OP_COPY_OPAQUE(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - (DEST) = SOURCE; \ -} \ -while (0) \ +#define PIXEL_OP_COPY_OPAQUE(DEST, PRIORITY, SOURCE) \ +do \ +{ \ + (DEST) = SOURCE; \ +} \ +while (0) \ /*------------------------------------------------- @@ -91,14 +91,14 @@ while (0) \ directly -------------------------------------------------*/ -#define PIXEL_OP_COPY_TRANSPEN(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - UINT32 srcdata = (SOURCE); \ - if (srcdata != transpen) \ - (DEST) = SOURCE; \ -} \ -while (0) \ +#define PIXEL_OP_COPY_TRANSPEN(DEST, PRIORITY, SOURCE) \ +do \ +{ \ + UINT32 srcdata = (SOURCE); \ + if (srcdata != transpen) \ + (DEST) = SOURCE; \ +} \ +while (0) \ /*------------------------------------------------- @@ -107,21 +107,21 @@ while (0) \ 'paldata' array -------------------------------------------------*/ -#define PIXEL_OP_REMAP_OPAQUE(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - (DEST) = paldata[SOURCE]; \ -} \ -while (0) \ +#define PIXEL_OP_REMAP_OPAQUE(DEST, PRIORITY, SOURCE) \ +do \ +{ \ + (DEST) = paldata[SOURCE]; \ +} \ +while (0) \ -#define PIXEL_OP_REMAP_OPAQUE_PRIORITY(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ - (DEST) = paldata[SOURCE]; \ - (PRIORITY) = 31; \ -} \ -while (0) \ +#define PIXEL_OP_REMAP_OPAQUE_PRIORITY(DEST, PRIORITY, SOURCE) \ +do \ +{ \ + if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ + (DEST) = paldata[SOURCE]; \ + (PRIORITY) = 31; \ +} \ +while (0) \ /*------------------------------------------------- @@ -130,27 +130,27 @@ while (0) \ pen via the 'paldata' array -------------------------------------------------*/ -#define PIXEL_OP_REMAP_TRANSPEN(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - UINT32 srcdata = (SOURCE); \ - if (srcdata != transpen) \ - (DEST) = paldata[srcdata]; \ -} \ -while (0) \ - -#define PIXEL_OP_REMAP_TRANSPEN_PRIORITY(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - UINT32 srcdata = (SOURCE); \ - if (srcdata != transpen) \ - { \ - if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ - (DEST) = paldata[srcdata]; \ - (PRIORITY) = 31; \ - } \ -} \ -while (0) \ +#define PIXEL_OP_REMAP_TRANSPEN(DEST, PRIORITY, SOURCE) \ +do \ +{ \ + UINT32 srcdata = (SOURCE); \ + if (srcdata != transpen) \ + (DEST) = paldata[srcdata]; \ +} \ +while (0) \ + +#define PIXEL_OP_REMAP_TRANSPEN_PRIORITY(DEST, PRIORITY, SOURCE) \ +do \ +{ \ + UINT32 srcdata = (SOURCE); \ + if (srcdata != transpen) \ + { \ + if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ + (DEST) = paldata[srcdata]; \ + (PRIORITY) = 31; \ + } \ +} \ +while (0) \ /*------------------------------------------------- @@ -159,27 +159,27 @@ while (0) \ 'color' to the pen value -------------------------------------------------*/ -#define PIXEL_OP_REBASE_TRANSPEN(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - UINT32 srcdata = (SOURCE); \ - if (srcdata != transpen) \ - (DEST) = color + srcdata; \ -} \ -while (0) \ - -#define PIXEL_OP_REBASE_TRANSPEN_PRIORITY(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - UINT32 srcdata = (SOURCE); \ - if (srcdata != transpen) \ - { \ - if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ - (DEST) = color + srcdata; \ - (PRIORITY) = 31; \ - } \ -} \ -while (0) \ +#define PIXEL_OP_REBASE_TRANSPEN(DEST, PRIORITY, SOURCE) \ +do \ +{ \ + UINT32 srcdata = (SOURCE); \ + if (srcdata != transpen) \ + (DEST) = color + srcdata; \ +} \ +while (0) \ + +#define PIXEL_OP_REBASE_TRANSPEN_PRIORITY(DEST, PRIORITY, SOURCE) \ +do \ +{ \ + UINT32 srcdata = (SOURCE); \ + if (srcdata != transpen) \ + { \ + if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ + (DEST) = color + srcdata; \ + (PRIORITY) = 31; \ + } \ +} \ +while (0) \ /*------------------------------------------------- @@ -188,27 +188,27 @@ while (0) \ pen via the 'paldata' array -------------------------------------------------*/ -#define PIXEL_OP_REMAP_TRANSMASK(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - UINT32 srcdata = (SOURCE); \ - if (((transmask >> srcdata) & 1) == 0) \ - (DEST) = paldata[srcdata]; \ -} \ -while (0) \ - -#define PIXEL_OP_REMAP_TRANSMASK_PRIORITY(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - UINT32 srcdata = (SOURCE); \ - if (((transmask >> srcdata) & 1) == 0) \ - { \ - if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ - (DEST) = paldata[srcdata]; \ - (PRIORITY) = 31; \ - } \ -} \ -while (0) \ +#define PIXEL_OP_REMAP_TRANSMASK(DEST, PRIORITY, SOURCE) \ +do \ +{ \ + UINT32 srcdata = (SOURCE); \ + if (((transmask >> srcdata) & 1) == 0) \ + (DEST) = paldata[srcdata]; \ +} \ +while (0) \ + +#define PIXEL_OP_REMAP_TRANSMASK_PRIORITY(DEST, PRIORITY, SOURCE) \ +do \ +{ \ + UINT32 srcdata = (SOURCE); \ + if (((transmask >> srcdata) & 1) == 0) \ + { \ + if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ + (DEST) = paldata[srcdata]; \ + (PRIORITY) = 31; \ + } \ +} \ +while (0) \ /*------------------------------------------------- @@ -220,81 +220,81 @@ while (0) \ the destination pixel using 'shadowtable' -------------------------------------------------*/ -#define PIXEL_OP_REMAP_TRANSTABLE16(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - UINT32 srcdata = (SOURCE); \ - UINT32 entry = pentable[srcdata]; \ - if (entry != DRAWMODE_NONE) \ - { \ - if (entry == DRAWMODE_SOURCE) \ - (DEST) = paldata[srcdata]; \ - else \ - (DEST) = shadowtable[DEST]; \ - } \ -} \ -while (0) \ - -#define PIXEL_OP_REMAP_TRANSTABLE32(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - UINT32 srcdata = (SOURCE); \ - UINT32 entry = pentable[srcdata]; \ - if (entry != DRAWMODE_NONE) \ - { \ - if (entry == DRAWMODE_SOURCE) \ - (DEST) = paldata[srcdata]; \ - else \ - (DEST) = shadowtable[rgb_to_rgb15(DEST)]; \ - } \ -} \ -while (0) \ - -#define PIXEL_OP_REMAP_TRANSTABLE16_PRIORITY(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - UINT32 srcdata = (SOURCE); \ - UINT32 entry = pentable[srcdata]; \ - if (entry != DRAWMODE_NONE) \ - { \ - UINT8 pridata = (PRIORITY); \ - if (entry == DRAWMODE_SOURCE) \ - { \ - if (((1 << (pridata & 0x1f)) & pmask) == 0) \ - (DEST) = paldata[srcdata]; \ - (PRIORITY) = 31; \ - } \ - else if ((pridata & 0x80) == 0 && ((1 << (pridata & 0x1f)) & pmask) == 0) \ - { \ - (DEST) = shadowtable[DEST]; \ - (PRIORITY) = pridata | 0x80; \ - } \ - } \ -} \ -while (0) \ - -#define PIXEL_OP_REMAP_TRANSTABLE32_PRIORITY(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - UINT32 srcdata = (SOURCE); \ - UINT32 entry = pentable[srcdata]; \ - if (entry != DRAWMODE_NONE) \ - { \ - UINT8 pridata = (PRIORITY); \ - if (entry == DRAWMODE_SOURCE) \ - { \ - if (((1 << (pridata & 0x1f)) & pmask) == 0) \ - (DEST) = paldata[srcdata]; \ - (PRIORITY) = 31; \ - } \ - else if ((pridata & 0x80) == 0 && ((1 << (pridata & 0x1f)) & pmask) == 0) \ - { \ - (DEST) = shadowtable[rgb_to_rgb15(DEST)]; \ - (PRIORITY) = pridata | 0x80; \ - } \ - } \ -} \ -while (0) \ +#define PIXEL_OP_REMAP_TRANSTABLE16(DEST, PRIORITY, SOURCE) \ +do \ +{ \ + UINT32 srcdata = (SOURCE); \ + UINT32 entry = pentable[srcdata]; \ + if (entry != DRAWMODE_NONE) \ + { \ + if (entry == DRAWMODE_SOURCE) \ + (DEST) = paldata[srcdata]; \ + else \ + (DEST) = shadowtable[DEST]; \ + } \ +} \ +while (0) \ + +#define PIXEL_OP_REMAP_TRANSTABLE32(DEST, PRIORITY, SOURCE) \ +do \ +{ \ + UINT32 srcdata = (SOURCE); \ + UINT32 entry = pentable[srcdata]; \ + if (entry != DRAWMODE_NONE) \ + { \ + if (entry == DRAWMODE_SOURCE) \ + (DEST) = paldata[srcdata]; \ + else \ + (DEST) = shadowtable[rgb_to_rgb15(DEST)]; \ + } \ +} \ +while (0) \ + +#define PIXEL_OP_REMAP_TRANSTABLE16_PRIORITY(DEST, PRIORITY, SOURCE) \ +do \ +{ \ + UINT32 srcdata = (SOURCE); \ + UINT32 entry = pentable[srcdata]; \ + if (entry != DRAWMODE_NONE) \ + { \ + UINT8 pridata = (PRIORITY); \ + if (entry == DRAWMODE_SOURCE) \ + { \ + if (((1 << (pridata & 0x1f)) & pmask) == 0) \ + (DEST) = paldata[srcdata]; \ + (PRIORITY) = 31; \ + } \ + else if ((pridata & 0x80) == 0 && ((1 << (pridata & 0x1f)) & pmask) == 0) \ + { \ + (DEST) = shadowtable[DEST]; \ + (PRIORITY) = pridata | 0x80; \ + } \ + } \ +} \ +while (0) \ + +#define PIXEL_OP_REMAP_TRANSTABLE32_PRIORITY(DEST, PRIORITY, SOURCE) \ +do \ +{ \ + UINT32 srcdata = (SOURCE); \ + UINT32 entry = pentable[srcdata]; \ + if (entry != DRAWMODE_NONE) \ + { \ + UINT8 pridata = (PRIORITY); \ + if (entry == DRAWMODE_SOURCE) \ + { \ + if (((1 << (pridata & 0x1f)) & pmask) == 0) \ + (DEST) = paldata[srcdata]; \ + (PRIORITY) = 31; \ + } \ + else if ((pridata & 0x80) == 0 && ((1 << (pridata & 0x1f)) & pmask) == 0) \ + { \ + (DEST) = shadowtable[rgb_to_rgb15(DEST)]; \ + (PRIORITY) = pridata | 0x80; \ + } \ + } \ +} \ +while (0) \ /*------------------------------------------------- @@ -305,27 +305,27 @@ while (0) \ against the destination using 'alpha' -------------------------------------------------*/ -#define PIXEL_OP_REMAP_TRANSPEN_ALPHA32(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - UINT32 srcdata = (SOURCE); \ - if (srcdata != transpen) \ - (DEST) = alpha_blend_r32((DEST), paldata[srcdata], alpha); \ -} \ -while (0) \ - -#define PIXEL_OP_REMAP_TRANSPEN_ALPHA32_PRIORITY(DEST, PRIORITY, SOURCE) \ -do \ -{ \ - UINT32 srcdata = (SOURCE); \ - if (srcdata != transpen) \ - { \ - if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ - (DEST) = alpha_blend_r32((DEST), paldata[srcdata], alpha); \ - (PRIORITY) = 31; \ - } \ -} \ -while (0) \ +#define PIXEL_OP_REMAP_TRANSPEN_ALPHA32(DEST, PRIORITY, SOURCE) \ +do \ +{ \ + UINT32 srcdata = (SOURCE); \ + if (srcdata != transpen) \ + (DEST) = alpha_blend_r32((DEST), paldata[srcdata], alpha); \ +} \ +while (0) \ + +#define PIXEL_OP_REMAP_TRANSPEN_ALPHA32_PRIORITY(DEST, PRIORITY, SOURCE) \ +do \ +{ \ + UINT32 srcdata = (SOURCE); \ + if (srcdata != transpen) \ + { \ + if (((1 << ((PRIORITY) & 0x1f)) & pmask) == 0) \ + (DEST) = alpha_blend_r32((DEST), paldata[srcdata], alpha); \ + (PRIORITY) = 31; \ + } \ +} \ +while (0) \ @@ -349,153 +349,153 @@ while (0) \ */ -#define DRAWGFX_CORE(PIXEL_TYPE, PIXEL_OP, PRIORITY_TYPE) \ -do { \ - g_profiler.start(PROFILER_DRAWGFX); \ - do { \ - const UINT8 *srcdata; \ - INT32 destendx, destendy; \ - INT32 srcx, srcy; \ - INT32 curx, cury; \ - INT32 dy; \ +#define DRAWGFX_CORE(PIXEL_TYPE, PIXEL_OP, PRIORITY_TYPE) \ +do { \ + g_profiler.start(PROFILER_DRAWGFX); \ + do { \ + const UINT8 *srcdata; \ + INT32 destendx, destendy; \ + INT32 srcx, srcy; \ + INT32 curx, cury; \ + INT32 dy; \ \ - assert(dest.valid()); \ - assert(gfx != NULL); \ - assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \ - assert(dest.cliprect().contains(cliprect)); \ - assert(code < gfx->elements()); \ + assert(dest.valid()); \ + assert(gfx != NULL); \ + assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \ + assert(dest.cliprect().contains(cliprect)); \ + assert(code < gfx->elements()); \ \ - /* ignore empty/invalid cliprects */ \ - if (cliprect.empty()) \ - break; \ + /* ignore empty/invalid cliprects */ \ + if (cliprect.empty()) \ + break; \ \ - /* compute final pixel in X and exit if we are entirely clipped */ \ - destendx = destx + gfx->width() - 1; \ - if (destx > cliprect.max_x || destendx < cliprect.min_x) \ - break; \ + /* compute final pixel in X and exit if we are entirely clipped */ \ + destendx = destx + gfx->width() - 1; \ + if (destx > cliprect.max_x || destendx < cliprect.min_x) \ + break; \ \ - /* apply left clip */ \ - srcx = 0; \ - if (destx < cliprect.min_x) \ - { \ - srcx = cliprect.min_x - destx; \ - destx = cliprect.min_x; \ - } \ + /* apply left clip */ \ + srcx = 0; \ + if (destx < cliprect.min_x) \ + { \ + srcx = cliprect.min_x - destx; \ + destx = cliprect.min_x; \ + } \ \ - /* apply right clip */ \ - if (destendx > cliprect.max_x) \ - destendx = cliprect.max_x; \ + /* apply right clip */ \ + if (destendx > cliprect.max_x) \ + destendx = cliprect.max_x; \ \ - /* compute final pixel in Y and exit if we are entirely clipped */ \ - destendy = desty + gfx->height() - 1; \ - if (desty > cliprect.max_y || destendy < cliprect.min_y) \ - break; \ + /* compute final pixel in Y and exit if we are entirely clipped */ \ + destendy = desty + gfx->height() - 1; \ + if (desty > cliprect.max_y || destendy < cliprect.min_y) \ + break; \ \ - /* apply top clip */ \ - srcy = 0; \ - if (desty < cliprect.min_y) \ - { \ - srcy = cliprect.min_y - desty; \ - desty = cliprect.min_y; \ - } \ + /* apply top clip */ \ + srcy = 0; \ + if (desty < cliprect.min_y) \ + { \ + srcy = cliprect.min_y - desty; \ + desty = cliprect.min_y; \ + } \ \ - /* apply bottom clip */ \ - if (destendy > cliprect.max_y) \ - destendy = cliprect.max_y; \ + /* apply bottom clip */ \ + if (destendy > cliprect.max_y) \ + destendy = cliprect.max_y; \ \ - /* apply X flipping */ \ - if (flipx) \ - srcx = gfx->width() - 1 - srcx; \ + /* apply X flipping */ \ + if (flipx) \ + srcx = gfx->width() - 1 - srcx; \ \ - /* apply Y flipping */ \ - dy = gfx->rowbytes(); \ - if (flipy) \ - { \ - srcy = gfx->height() - 1 - srcy; \ - dy = -dy; \ - } \ + /* apply Y flipping */ \ + dy = gfx->rowbytes(); \ + if (flipy) \ + { \ + srcy = gfx->height() - 1 - srcy; \ + dy = -dy; \ + } \ \ - /* fetch the source data */ \ - srcdata = gfx->get_data(code); \ + /* fetch the source data */ \ + srcdata = gfx->get_data(code); \ \ - /* compute how many blocks of 4 pixels we have */ \ - UINT32 numblocks = (destendx + 1 - destx) / 4; \ - UINT32 leftovers = (destendx + 1 - destx) - 4 * numblocks; \ + /* compute how many blocks of 4 pixels we have */ \ + UINT32 numblocks = (destendx + 1 - destx) / 4; \ + UINT32 leftovers = (destendx + 1 - destx) - 4 * numblocks; \ \ - /* adjust srcdata to point to the first source pixel of the row */ \ - srcdata += srcy * gfx->rowbytes() + srcx; \ + /* adjust srcdata to point to the first source pixel of the row */ \ + srcdata += srcy * gfx->rowbytes() + srcx; \ \ - /* non-flipped 8bpp case */ \ - if (!flipx) \ - { \ - /* iterate over pixels in Y */ \ - for (cury = desty; cury <= destendy; cury++) \ - { \ + /* non-flipped 8bpp case */ \ + if (!flipx) \ + { \ + /* iterate over pixels in Y */ \ + for (cury = desty; cury <= destendy; cury++) \ + { \ PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, destx); \ - PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, destx); \ - const UINT8 *srcptr = srcdata; \ - srcdata += dy; \ + PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, destx); \ + const UINT8 *srcptr = srcdata; \ + srcdata += dy; \ \ - /* iterate over unrolled blocks of 4 */ \ - for (curx = 0; curx < numblocks; curx++) \ - { \ - PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ - PIXEL_OP(destptr[1], priptr[1], srcptr[1]); \ - PIXEL_OP(destptr[2], priptr[2], srcptr[2]); \ - PIXEL_OP(destptr[3], priptr[3], srcptr[3]); \ + /* iterate over unrolled blocks of 4 */ \ + for (curx = 0; curx < numblocks; curx++) \ + { \ + PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ + PIXEL_OP(destptr[1], priptr[1], srcptr[1]); \ + PIXEL_OP(destptr[2], priptr[2], srcptr[2]); \ + PIXEL_OP(destptr[3], priptr[3], srcptr[3]); \ \ - srcptr += 4; \ - destptr += 4; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ - } \ + srcptr += 4; \ + destptr += 4; \ + PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ + } \ \ - /* iterate over leftover pixels */ \ - for (curx = 0; curx < leftovers; curx++) \ - { \ - PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ - srcptr++; \ - destptr++; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ - } \ - } \ - } \ + /* iterate over leftover pixels */ \ + for (curx = 0; curx < leftovers; curx++) \ + { \ + PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ + srcptr++; \ + destptr++; \ + PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ + } \ + } \ + } \ \ - /* flipped 8bpp case */ \ - else \ - { \ - /* iterate over pixels in Y */ \ - for (cury = desty; cury <= destendy; cury++) \ - { \ + /* flipped 8bpp case */ \ + else \ + { \ + /* iterate over pixels in Y */ \ + for (cury = desty; cury <= destendy; cury++) \ + { \ PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, destx); \ - PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, destx); \ - const UINT8 *srcptr = srcdata; \ - srcdata += dy; \ + PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, destx); \ + const UINT8 *srcptr = srcdata; \ + srcdata += dy; \ \ - /* iterate over unrolled blocks of 4 */ \ - for (curx = 0; curx < numblocks; curx++) \ - { \ - PIXEL_OP(destptr[0], priptr[0], srcptr[ 0]); \ - PIXEL_OP(destptr[1], priptr[1], srcptr[-1]); \ - PIXEL_OP(destptr[2], priptr[2], srcptr[-2]); \ - PIXEL_OP(destptr[3], priptr[3], srcptr[-3]); \ + /* iterate over unrolled blocks of 4 */ \ + for (curx = 0; curx < numblocks; curx++) \ + { \ + PIXEL_OP(destptr[0], priptr[0], srcptr[ 0]); \ + PIXEL_OP(destptr[1], priptr[1], srcptr[-1]); \ + PIXEL_OP(destptr[2], priptr[2], srcptr[-2]); \ + PIXEL_OP(destptr[3], priptr[3], srcptr[-3]); \ \ - srcptr -= 4; \ - destptr += 4; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ - } \ + srcptr -= 4; \ + destptr += 4; \ + PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ + } \ \ - /* iterate over leftover pixels */ \ - for (curx = 0; curx < leftovers; curx++) \ - { \ - PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ - srcptr--; \ - destptr++; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ - } \ - } \ - } \ - } while (0); \ - g_profiler.stop(); \ + /* iterate over leftover pixels */ \ + for (curx = 0; curx < leftovers; curx++) \ + { \ + PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ + srcptr--; \ + destptr++; \ + PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ + } \ + } \ + } \ + } while (0); \ + g_profiler.stop(); \ } while (0) @@ -522,130 +522,130 @@ do { \ */ -#define DRAWGFXZOOM_CORE(PIXEL_TYPE, PIXEL_OP, PRIORITY_TYPE) \ -do { \ - g_profiler.start(PROFILER_DRAWGFX); \ - do { \ - const UINT8 *srcdata; \ - UINT32 dstwidth, dstheight; \ - INT32 destendx, destendy; \ - INT32 srcx, srcy; \ - INT32 curx, cury; \ - INT32 dx, dy; \ +#define DRAWGFXZOOM_CORE(PIXEL_TYPE, PIXEL_OP, PRIORITY_TYPE) \ +do { \ + g_profiler.start(PROFILER_DRAWGFX); \ + do { \ + const UINT8 *srcdata; \ + UINT32 dstwidth, dstheight; \ + INT32 destendx, destendy; \ + INT32 srcx, srcy; \ + INT32 curx, cury; \ + INT32 dx, dy; \ \ - assert(dest.valid()); \ - assert(gfx != NULL); \ - assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \ - assert(dest.cliprect().contains(cliprect)); \ + assert(dest.valid()); \ + assert(gfx != NULL); \ + assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \ + assert(dest.cliprect().contains(cliprect)); \ \ - /* ignore empty/invalid cliprects */ \ - if (cliprect.empty()) \ - break; \ + /* ignore empty/invalid cliprects */ \ + if (cliprect.empty()) \ + break; \ \ - /* compute scaled size */ \ - dstwidth = (scalex * gfx->width() + 0x8000) >> 16; \ - dstheight = (scaley * gfx->height() + 0x8000) >> 16; \ - if (dstwidth < 1 || dstheight < 1) \ - break; \ + /* compute scaled size */ \ + dstwidth = (scalex * gfx->width() + 0x8000) >> 16; \ + dstheight = (scaley * gfx->height() + 0x8000) >> 16; \ + if (dstwidth < 1 || dstheight < 1) \ + break; \ \ - /* compute 16.16 source steps in dx and dy */ \ - dx = (gfx->width() << 16) / dstwidth; \ - dy = (gfx->height() << 16) / dstheight; \ + /* compute 16.16 source steps in dx and dy */ \ + dx = (gfx->width() << 16) / dstwidth; \ + dy = (gfx->height() << 16) / dstheight; \ \ - /* compute final pixel in X and exit if we are entirely clipped */ \ - destendx = destx + dstwidth - 1; \ - if (destx > cliprect.max_x || destendx < cliprect.min_x) \ - break; \ + /* compute final pixel in X and exit if we are entirely clipped */ \ + destendx = destx + dstwidth - 1; \ + if (destx > cliprect.max_x || destendx < cliprect.min_x) \ + break; \ \ - /* apply left clip */ \ - srcx = 0; \ - if (destx < cliprect.min_x) \ - { \ - srcx = (cliprect.min_x - destx) * dx; \ - destx = cliprect.min_x; \ - } \ + /* apply left clip */ \ + srcx = 0; \ + if (destx < cliprect.min_x) \ + { \ + srcx = (cliprect.min_x - destx) * dx; \ + destx = cliprect.min_x; \ + } \ \ - /* apply right clip */ \ - if (destendx > cliprect.max_x) \ - destendx = cliprect.max_x; \ + /* apply right clip */ \ + if (destendx > cliprect.max_x) \ + destendx = cliprect.max_x; \ \ - /* compute final pixel in Y and exit if we are entirely clipped */ \ - destendy = desty + dstheight - 1; \ - if (desty > cliprect.max_y || destendy < cliprect.min_y) \ - { \ - g_profiler.stop(); \ - return; \ - } \ + /* compute final pixel in Y and exit if we are entirely clipped */ \ + destendy = desty + dstheight - 1; \ + if (desty > cliprect.max_y || destendy < cliprect.min_y) \ + { \ + g_profiler.stop(); \ + return; \ + } \ \ - /* apply top clip */ \ - srcy = 0; \ - if (desty < cliprect.min_y) \ - { \ - srcy = (cliprect.min_y - desty) * dy; \ - desty = cliprect.min_y; \ - } \ + /* apply top clip */ \ + srcy = 0; \ + if (desty < cliprect.min_y) \ + { \ + srcy = (cliprect.min_y - desty) * dy; \ + desty = cliprect.min_y; \ + } \ \ - /* apply bottom clip */ \ - if (destendy > cliprect.max_y) \ - destendy = cliprect.max_y; \ + /* apply bottom clip */ \ + if (destendy > cliprect.max_y) \ + destendy = cliprect.max_y; \ \ - /* apply X flipping */ \ - if (flipx) \ - { \ - srcx = (dstwidth - 1) * dx - srcx; \ - dx = -dx; \ - } \ + /* apply X flipping */ \ + if (flipx) \ + { \ + srcx = (dstwidth - 1) * dx - srcx; \ + dx = -dx; \ + } \ \ - /* apply Y flipping */ \ - if (flipy) \ - { \ - srcy = (dstheight - 1) * dy - srcy; \ - dy = -dy; \ - } \ + /* apply Y flipping */ \ + if (flipy) \ + { \ + srcy = (dstheight - 1) * dy - srcy; \ + dy = -dy; \ + } \ \ - /* fetch the source data */ \ - srcdata = gfx->get_data(code); \ + /* fetch the source data */ \ + srcdata = gfx->get_data(code); \ \ - /* compute how many blocks of 4 pixels we have */ \ - UINT32 numblocks = (destendx + 1 - destx) / 4; \ - UINT32 leftovers = (destendx + 1 - destx) - 4 * numblocks; \ + /* compute how many blocks of 4 pixels we have */ \ + UINT32 numblocks = (destendx + 1 - destx) / 4; \ + UINT32 leftovers = (destendx + 1 - destx) - 4 * numblocks; \ \ - /* iterate over pixels in Y */ \ - for (cury = desty; cury <= destendy; cury++) \ - { \ + /* iterate over pixels in Y */ \ + for (cury = desty; cury <= destendy; cury++) \ + { \ PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, destx); \ - PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, destx); \ - const UINT8 *srcptr = srcdata + (srcy >> 16) * gfx->rowbytes(); \ - INT32 cursrcx = srcx; \ - srcy += dy; \ + PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, destx); \ + const UINT8 *srcptr = srcdata + (srcy >> 16) * gfx->rowbytes(); \ + INT32 cursrcx = srcx; \ + srcy += dy; \ \ - /* iterate over unrolled blocks of 4 */ \ - for (curx = 0; curx < numblocks; curx++) \ - { \ - PIXEL_OP(destptr[0], priptr[0], srcptr[cursrcx >> 16]); \ - cursrcx += dx; \ - PIXEL_OP(destptr[1], priptr[1], srcptr[cursrcx >> 16]); \ - cursrcx += dx; \ - PIXEL_OP(destptr[2], priptr[2], srcptr[cursrcx >> 16]); \ - cursrcx += dx; \ - PIXEL_OP(destptr[3], priptr[3], srcptr[cursrcx >> 16]); \ - cursrcx += dx; \ + /* iterate over unrolled blocks of 4 */ \ + for (curx = 0; curx < numblocks; curx++) \ + { \ + PIXEL_OP(destptr[0], priptr[0], srcptr[cursrcx >> 16]); \ + cursrcx += dx; \ + PIXEL_OP(destptr[1], priptr[1], srcptr[cursrcx >> 16]); \ + cursrcx += dx; \ + PIXEL_OP(destptr[2], priptr[2], srcptr[cursrcx >> 16]); \ + cursrcx += dx; \ + PIXEL_OP(destptr[3], priptr[3], srcptr[cursrcx >> 16]); \ + cursrcx += dx; \ \ - destptr += 4; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ - } \ + destptr += 4; \ + PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ + } \ \ - /* iterate over leftover pixels */ \ - for (curx = 0; curx < leftovers; curx++) \ - { \ - PIXEL_OP(destptr[0], priptr[0], srcptr[cursrcx >> 16]); \ - cursrcx += dx; \ - destptr++; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ - } \ - } \ - } while (0); \ - g_profiler.stop(); \ + /* iterate over leftover pixels */ \ + for (curx = 0; curx < leftovers; curx++) \ + { \ + PIXEL_OP(destptr[0], priptr[0], srcptr[cursrcx >> 16]); \ + cursrcx += dx; \ + destptr++; \ + PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ + } \ + } \ + } while (0); \ + g_profiler.stop(); \ } while (0) @@ -667,156 +667,156 @@ do { \ bitmap_t &priority - the priority bitmap (even if PRIORITY_TYPE is NO_PRIORITY, at least needs a dummy) */ -#define COPYBITMAP_CORE(PIXEL_TYPE, PIXEL_OP, PRIORITY_TYPE) \ -do { \ - g_profiler.start(PROFILER_COPYBITMAP); \ - do { \ - const PIXEL_TYPE *srcdata; \ - UINT32 numblocks, leftovers; \ - INT32 destendx, destendy; \ - INT32 srcx, srcy; \ - INT32 curx, cury; \ - INT32 dx, dy; \ +#define COPYBITMAP_CORE(PIXEL_TYPE, PIXEL_OP, PRIORITY_TYPE) \ +do { \ + g_profiler.start(PROFILER_COPYBITMAP); \ + do { \ + const PIXEL_TYPE *srcdata; \ + UINT32 numblocks, leftovers; \ + INT32 destendx, destendy; \ + INT32 srcx, srcy; \ + INT32 curx, cury; \ + INT32 dx, dy; \ \ - assert(dest.valid()); \ - assert(src.valid()); \ - assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \ - assert(dest.cliprect().contains(cliprect)); \ + assert(dest.valid()); \ + assert(src.valid()); \ + assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \ + assert(dest.cliprect().contains(cliprect)); \ \ - /* ignore empty/invalid cliprects */ \ - if (cliprect.empty()) \ - break; \ + /* ignore empty/invalid cliprects */ \ + if (cliprect.empty()) \ + break; \ \ - /* standard setup; dx counts bytes in X, dy counts pixels in Y */ \ - dx = 1; \ - dy = src.rowpixels(); \ + /* standard setup; dx counts bytes in X, dy counts pixels in Y */ \ + dx = 1; \ + dy = src.rowpixels(); \ \ - /* compute final pixel in X and exit if we are entirely clipped */ \ - destendx = destx + src.width() - 1; \ - if (destx > cliprect.max_x || destendx < cliprect.min_x) \ - break; \ + /* compute final pixel in X and exit if we are entirely clipped */ \ + destendx = destx + src.width() - 1; \ + if (destx > cliprect.max_x || destendx < cliprect.min_x) \ + break; \ \ - /* apply left clip */ \ - srcx = 0; \ - if (destx < cliprect.min_x) \ - { \ - srcx = cliprect.min_x - destx; \ - destx = cliprect.min_x; \ - } \ + /* apply left clip */ \ + srcx = 0; \ + if (destx < cliprect.min_x) \ + { \ + srcx = cliprect.min_x - destx; \ + destx = cliprect.min_x; \ + } \ \ - /* apply right clip */ \ - if (destendx > cliprect.max_x) \ - destendx = cliprect.max_x; \ + /* apply right clip */ \ + if (destendx > cliprect.max_x) \ + destendx = cliprect.max_x; \ \ - /* compute final pixel in Y and exit if we are entirely clipped */ \ - destendy = desty + src.height() - 1; \ - if (desty > cliprect.max_y || destendy < cliprect.min_y) \ - break; \ + /* compute final pixel in Y and exit if we are entirely clipped */ \ + destendy = desty + src.height() - 1; \ + if (desty > cliprect.max_y || destendy < cliprect.min_y) \ + break; \ \ - /* apply top clip */ \ - srcy = 0; \ - if (desty < cliprect.min_y) \ - { \ - srcy = cliprect.min_y - desty; \ - desty = cliprect.min_y; \ - } \ + /* apply top clip */ \ + srcy = 0; \ + if (desty < cliprect.min_y) \ + { \ + srcy = cliprect.min_y - desty; \ + desty = cliprect.min_y; \ + } \ \ - /* apply bottom clip */ \ - if (destendy > cliprect.max_y) \ - destendy = cliprect.max_y; \ + /* apply bottom clip */ \ + if (destendy > cliprect.max_y) \ + destendy = cliprect.max_y; \ \ - /* apply X flipping */ \ - if (flipx) \ - { \ - srcx = src.width() - 1 - srcx; \ - dx = -dx; \ - } \ + /* apply X flipping */ \ + if (flipx) \ + { \ + srcx = src.width() - 1 - srcx; \ + dx = -dx; \ + } \ \ - /* apply Y flipping */ \ - if (flipy) \ - { \ - srcy = src.height() - 1 - srcy; \ - dy = -dy; \ - } \ + /* apply Y flipping */ \ + if (flipy) \ + { \ + srcy = src.height() - 1 - srcy; \ + dy = -dy; \ + } \ \ - /* compute how many blocks of 4 pixels we have */ \ - numblocks = (destendx + 1 - destx) / 4; \ - leftovers = (destendx + 1 - destx) - 4 * numblocks; \ + /* compute how many blocks of 4 pixels we have */ \ + numblocks = (destendx + 1 - destx) / 4; \ + leftovers = (destendx + 1 - destx) - 4 * numblocks; \ \ - /* compute the address of the first source pixel of the first row */ \ - srcdata = &src.pixt<PIXEL_TYPE>(srcy, srcx); \ + /* compute the address of the first source pixel of the first row */ \ + srcdata = &src.pixt<PIXEL_TYPE>(srcy, srcx); \ \ - /* non-flipped case */ \ - if (!flipx) \ - { \ - /* iterate over pixels in Y */ \ - for (cury = desty; cury <= destendy; cury++) \ - { \ + /* non-flipped case */ \ + if (!flipx) \ + { \ + /* iterate over pixels in Y */ \ + for (cury = desty; cury <= destendy; cury++) \ + { \ PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, destx); \ - PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, destx); \ - const PIXEL_TYPE *srcptr = srcdata; \ - srcdata += dy; \ + PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, destx); \ + const PIXEL_TYPE *srcptr = srcdata; \ + srcdata += dy; \ \ - /* iterate over unrolled blocks of 4 */ \ - for (curx = 0; curx < numblocks; curx++) \ - { \ - PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ - PIXEL_OP(destptr[1], priptr[1], srcptr[1]); \ - PIXEL_OP(destptr[2], priptr[2], srcptr[2]); \ - PIXEL_OP(destptr[3], priptr[3], srcptr[3]); \ + /* iterate over unrolled blocks of 4 */ \ + for (curx = 0; curx < numblocks; curx++) \ + { \ + PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ + PIXEL_OP(destptr[1], priptr[1], srcptr[1]); \ + PIXEL_OP(destptr[2], priptr[2], srcptr[2]); \ + PIXEL_OP(destptr[3], priptr[3], srcptr[3]); \ \ - srcptr += 4; \ - destptr += 4; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ - } \ + srcptr += 4; \ + destptr += 4; \ + PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ + } \ \ - /* iterate over leftover pixels */ \ - for (curx = 0; curx < leftovers; curx++) \ - { \ - PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ - srcptr++; \ - destptr++; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ - } \ - } \ - } \ + /* iterate over leftover pixels */ \ + for (curx = 0; curx < leftovers; curx++) \ + { \ + PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ + srcptr++; \ + destptr++; \ + PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ + } \ + } \ + } \ \ - /* flipped case */ \ - else \ - { \ - /* iterate over pixels in Y */ \ - for (cury = desty; cury <= destendy; cury++) \ - { \ + /* flipped case */ \ + else \ + { \ + /* iterate over pixels in Y */ \ + for (cury = desty; cury <= destendy; cury++) \ + { \ PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, destx); \ - PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, destx); \ - const PIXEL_TYPE *srcptr = srcdata; \ - srcdata += dy; \ + PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, destx); \ + const PIXEL_TYPE *srcptr = srcdata; \ + srcdata += dy; \ \ - /* iterate over unrolled blocks of 4 */ \ - for (curx = 0; curx < numblocks; curx++) \ - { \ - PIXEL_OP(destptr[0], priptr[0], srcptr[ 0]); \ - PIXEL_OP(destptr[1], priptr[1], srcptr[-1]); \ - PIXEL_OP(destptr[2], priptr[2], srcptr[-2]); \ - PIXEL_OP(destptr[3], priptr[3], srcptr[-3]); \ + /* iterate over unrolled blocks of 4 */ \ + for (curx = 0; curx < numblocks; curx++) \ + { \ + PIXEL_OP(destptr[0], priptr[0], srcptr[ 0]); \ + PIXEL_OP(destptr[1], priptr[1], srcptr[-1]); \ + PIXEL_OP(destptr[2], priptr[2], srcptr[-2]); \ + PIXEL_OP(destptr[3], priptr[3], srcptr[-3]); \ \ - srcptr -= 4; \ - destptr += 4; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ - } \ + srcptr -= 4; \ + destptr += 4; \ + PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ + } \ \ - /* iterate over leftover pixels */ \ - for (curx = 0; curx < leftovers; curx++) \ - { \ - PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ - srcptr--; \ - destptr++; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ - } \ - } \ - } \ - } while (0); \ - g_profiler.stop(); \ + /* iterate over leftover pixels */ \ + for (curx = 0; curx < leftovers; curx++) \ + { \ + PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ + srcptr--; \ + destptr++; \ + PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ + } \ + } \ + } \ + } while (0); \ + g_profiler.stop(); \ } while (0) @@ -841,280 +841,280 @@ do { \ bitmap_t &priority - the priority bitmap (even if PRIORITY_TYPE is NO_PRIORITY, at least needs a dummy) */ -#define COPYROZBITMAP_CORE(PIXEL_TYPE, PIXEL_OP, PRIORITY_TYPE) \ -do { \ - UINT32 srcfixwidth, srcfixheight; \ - UINT32 numblocks, leftovers; \ - INT32 curx, cury; \ +#define COPYROZBITMAP_CORE(PIXEL_TYPE, PIXEL_OP, PRIORITY_TYPE) \ +do { \ + UINT32 srcfixwidth, srcfixheight; \ + UINT32 numblocks, leftovers; \ + INT32 curx, cury; \ \ - g_profiler.start(PROFILER_COPYBITMAP); \ + g_profiler.start(PROFILER_COPYBITMAP); \ \ - assert(dest.valid()); \ - assert(dest.valid()); \ - assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \ - assert(dest.cliprect().contains(cliprect)); \ - assert(!wraparound || (src.width() & (src.width() - 1)) == 0); \ - assert(!wraparound || (src.height() & (src.height() - 1)) == 0); \ + assert(dest.valid()); \ + assert(dest.valid()); \ + assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \ + assert(dest.cliprect().contains(cliprect)); \ + assert(!wraparound || (src.width() & (src.width() - 1)) == 0); \ + assert(!wraparound || (src.height() & (src.height() - 1)) == 0); \ \ - /* ignore empty/invalid cliprects */ \ - if (cliprect.empty()) \ - break; \ + /* ignore empty/invalid cliprects */ \ + if (cliprect.empty()) \ + break; \ \ - /* compute fixed-point 16.16 size of the source bitmap */ \ - srcfixwidth = src.width() << 16; \ - srcfixheight = src.height() << 16; \ + /* compute fixed-point 16.16 size of the source bitmap */ \ + srcfixwidth = src.width() << 16; \ + srcfixheight = src.height() << 16; \ \ - /* advance the starting coordinates to the top-left of the cliprect */ \ - startx += cliprect.min_x * incxx + cliprect.min_y * incyx; \ - starty += cliprect.min_x * incxy + cliprect.min_y * incyy; \ + /* advance the starting coordinates to the top-left of the cliprect */ \ + startx += cliprect.min_x * incxx + cliprect.min_y * incyx; \ + starty += cliprect.min_x * incxy + cliprect.min_y * incyy; \ \ - /* compute how many blocks of 4 pixels we have */ \ - numblocks = cliprect.width() / 4; \ - leftovers = cliprect.width() - 4 * numblocks; \ + /* compute how many blocks of 4 pixels we have */ \ + numblocks = cliprect.width() / 4; \ + leftovers = cliprect.width() - 4 * numblocks; \ \ - /* if incxy and incyx are 0, then we aren't rotating, just zooming */ \ - if (incxy == 0 && incyx == 0) \ - { \ - /* zoom-only, non-wraparound case */ \ - if (!wraparound) \ - { \ - /* iterate over pixels in Y */ \ - for (cury = cliprect.min_y; cury <= cliprect.max_y; cury++) \ - { \ + /* if incxy and incyx are 0, then we aren't rotating, just zooming */ \ + if (incxy == 0 && incyx == 0) \ + { \ + /* zoom-only, non-wraparound case */ \ + if (!wraparound) \ + { \ + /* iterate over pixels in Y */ \ + for (cury = cliprect.min_y; cury <= cliprect.max_y; cury++) \ + { \ PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, cliprect.min_x); \ PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, cliprect.min_x); \ - const PIXEL_TYPE *srcptr; \ - INT32 srcx = startx; \ - INT32 srcy = starty; \ + const PIXEL_TYPE *srcptr; \ + INT32 srcx = startx; \ + INT32 srcy = starty; \ \ - starty += incyy; \ + starty += incyy; \ \ - /* check srcy for the whole row at once */ \ - if ((UINT32)srcy < srcfixheight) \ - { \ - srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16); \ + /* check srcy for the whole row at once */ \ + if ((UINT32)srcy < srcfixheight) \ + { \ + srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16); \ \ - /* iterate over unrolled blocks of 4 */ \ - for (curx = 0; curx < numblocks; curx++) \ - { \ - if ((UINT32)srcx < srcfixwidth) \ - PIXEL_OP(destptr[0], priptr[0], srcptr[srcx >> 16]); \ - srcx += incxx; \ + /* iterate over unrolled blocks of 4 */ \ + for (curx = 0; curx < numblocks; curx++) \ + { \ + if ((UINT32)srcx < srcfixwidth) \ + PIXEL_OP(destptr[0], priptr[0], srcptr[srcx >> 16]); \ + srcx += incxx; \ \ - if ((UINT32)srcx < srcfixwidth) \ - PIXEL_OP(destptr[1], priptr[1], srcptr[srcx >> 16]); \ - srcx += incxx; \ + if ((UINT32)srcx < srcfixwidth) \ + PIXEL_OP(destptr[1], priptr[1], srcptr[srcx >> 16]); \ + srcx += incxx; \ \ - if ((UINT32)srcx < srcfixwidth) \ - PIXEL_OP(destptr[2], priptr[2], srcptr[srcx >> 16]); \ - srcx += incxx; \ + if ((UINT32)srcx < srcfixwidth) \ + PIXEL_OP(destptr[2], priptr[2], srcptr[srcx >> 16]); \ + srcx += incxx; \ \ - if ((UINT32)srcx < srcfixwidth) \ - PIXEL_OP(destptr[3], priptr[3], srcptr[srcx >> 16]); \ - srcx += incxx; \ + if ((UINT32)srcx < srcfixwidth) \ + PIXEL_OP(destptr[3], priptr[3], srcptr[srcx >> 16]); \ + srcx += incxx; \ \ - destptr += 4; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ - } \ + destptr += 4; \ + PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ + } \ \ - /* iterate over leftover pixels */ \ - for (curx = 0; curx < leftovers; curx++) \ - { \ - if ((UINT32)srcx < srcfixwidth) \ - PIXEL_OP(destptr[0], priptr[0], srcptr[srcx >> 16]); \ - srcx += incxx; \ - destptr++; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ - } \ - } \ - } \ - } \ + /* iterate over leftover pixels */ \ + for (curx = 0; curx < leftovers; curx++) \ + { \ + if ((UINT32)srcx < srcfixwidth) \ + PIXEL_OP(destptr[0], priptr[0], srcptr[srcx >> 16]); \ + srcx += incxx; \ + destptr++; \ + PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ + } \ + } \ + } \ + } \ \ - /* zoom-only, wraparound case */ \ - else \ - { \ - /* convert srcfixwidth/height into a mask and apply */ \ - srcfixwidth--; \ - srcfixheight--; \ - startx &= srcfixwidth; \ - starty &= srcfixheight; \ + /* zoom-only, wraparound case */ \ + else \ + { \ + /* convert srcfixwidth/height into a mask and apply */ \ + srcfixwidth--; \ + srcfixheight--; \ + startx &= srcfixwidth; \ + starty &= srcfixheight; \ \ - /* iterate over pixels in Y */ \ - for (cury = cliprect.min_y; cury <= cliprect.max_y; cury++) \ - { \ + /* iterate over pixels in Y */ \ + for (cury = cliprect.min_y; cury <= cliprect.max_y; cury++) \ + { \ PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, cliprect.min_x); \ PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, cliprect.min_x); \ - const PIXEL_TYPE *srcptr = &src.pixt<PIXEL_TYPE>(starty >> 16); \ - INT32 srcx = startx; \ + const PIXEL_TYPE *srcptr = &src.pixt<PIXEL_TYPE>(starty >> 16); \ + INT32 srcx = startx; \ \ - starty = (starty + incyy) & srcfixheight; \ + starty = (starty + incyy) & srcfixheight; \ \ - /* iterate over unrolled blocks of 4 */ \ - for (curx = 0; curx < numblocks; curx++) \ - { \ - PIXEL_OP(destptr[0], priptr[0], srcptr[srcx >> 16]); \ - srcx = (srcx + incxx) & srcfixwidth; \ + /* iterate over unrolled blocks of 4 */ \ + for (curx = 0; curx < numblocks; curx++) \ + { \ + PIXEL_OP(destptr[0], priptr[0], srcptr[srcx >> 16]); \ + srcx = (srcx + incxx) & srcfixwidth; \ \ - PIXEL_OP(destptr[1], priptr[1], srcptr[srcx >> 16]); \ - srcx = (srcx + incxx) & srcfixwidth; \ + PIXEL_OP(destptr[1], priptr[1], srcptr[srcx >> 16]); \ + srcx = (srcx + incxx) & srcfixwidth; \ \ - PIXEL_OP(destptr[2], priptr[2], srcptr[srcx >> 16]); \ - srcx = (srcx + incxx) & srcfixwidth; \ + PIXEL_OP(destptr[2], priptr[2], srcptr[srcx >> 16]); \ + srcx = (srcx + incxx) & srcfixwidth; \ \ - PIXEL_OP(destptr[3], priptr[3], srcptr[srcx >> 16]); \ - srcx = (srcx + incxx) & srcfixwidth; \ + PIXEL_OP(destptr[3], priptr[3], srcptr[srcx >> 16]); \ + srcx = (srcx + incxx) & srcfixwidth; \ \ - destptr += 4; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ - } \ + destptr += 4; \ + PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ + } \ \ - /* iterate over leftover pixels */ \ - for (curx = 0; curx < leftovers; curx++) \ - { \ - PIXEL_OP(destptr[0], priptr[0], srcptr[srcx >> 16]); \ - srcx = (srcx + incxx) & srcfixwidth; \ - destptr++; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ - } \ - } \ - } \ - } \ + /* iterate over leftover pixels */ \ + for (curx = 0; curx < leftovers; curx++) \ + { \ + PIXEL_OP(destptr[0], priptr[0], srcptr[srcx >> 16]); \ + srcx = (srcx + incxx) & srcfixwidth; \ + destptr++; \ + PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ + } \ + } \ + } \ + } \ \ - /* full rotation case */ \ - else \ - { \ - /* full rotation, non-wraparound case */ \ - if (!wraparound) \ - { \ - /* iterate over pixels in Y */ \ - for (cury = cliprect.min_y; cury <= cliprect.max_y; cury++) \ - { \ + /* full rotation case */ \ + else \ + { \ + /* full rotation, non-wraparound case */ \ + if (!wraparound) \ + { \ + /* iterate over pixels in Y */ \ + for (cury = cliprect.min_y; cury <= cliprect.max_y; cury++) \ + { \ PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, cliprect.min_x); \ PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, cliprect.min_x); \ - const PIXEL_TYPE *srcptr; \ - INT32 srcx = startx; \ - INT32 srcy = starty; \ + const PIXEL_TYPE *srcptr; \ + INT32 srcx = startx; \ + INT32 srcy = starty; \ \ - startx += incyx; \ - starty += incyy; \ + startx += incyx; \ + starty += incyy; \ \ - /* iterate over unrolled blocks of 4 */ \ - for (curx = 0; curx < numblocks; curx++) \ - { \ - if ((UINT32)srcx < srcfixwidth && (UINT32)srcy < srcfixheight) \ - { \ - srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16, srcx >> 16); \ - PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ - } \ - srcx += incxx; \ - srcy += incxy; \ + /* iterate over unrolled blocks of 4 */ \ + for (curx = 0; curx < numblocks; curx++) \ + { \ + if ((UINT32)srcx < srcfixwidth && (UINT32)srcy < srcfixheight) \ + { \ + srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16, srcx >> 16); \ + PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ + } \ + srcx += incxx; \ + srcy += incxy; \ \ - if ((UINT32)srcx < srcfixwidth && (UINT32)srcy < srcfixheight) \ - { \ - srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16, srcx >> 16); \ - PIXEL_OP(destptr[1], priptr[1], srcptr[0]); \ - } \ - srcx += incxx; \ - srcy += incxy; \ + if ((UINT32)srcx < srcfixwidth && (UINT32)srcy < srcfixheight) \ + { \ + srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16, srcx >> 16); \ + PIXEL_OP(destptr[1], priptr[1], srcptr[0]); \ + } \ + srcx += incxx; \ + srcy += incxy; \ \ - if ((UINT32)srcx < srcfixwidth && (UINT32)srcy < srcfixheight) \ - { \ - srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16, srcx >> 16); \ - PIXEL_OP(destptr[2], priptr[2], srcptr[0]); \ - } \ - srcx += incxx; \ - srcy += incxy; \ + if ((UINT32)srcx < srcfixwidth && (UINT32)srcy < srcfixheight) \ + { \ + srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16, srcx >> 16); \ + PIXEL_OP(destptr[2], priptr[2], srcptr[0]); \ + } \ + srcx += incxx; \ + srcy += incxy; \ \ - if ((UINT32)srcx < srcfixwidth && (UINT32)srcy < srcfixheight) \ - { \ - srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16, srcx >> 16); \ - PIXEL_OP(destptr[3], priptr[3], srcptr[0]); \ - } \ - srcx += incxx; \ - srcy += incxy; \ + if ((UINT32)srcx < srcfixwidth && (UINT32)srcy < srcfixheight) \ + { \ + srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16, srcx >> 16); \ + PIXEL_OP(destptr[3], priptr[3], srcptr[0]); \ + } \ + srcx += incxx; \ + srcy += incxy; \ \ - destptr += 4; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ - } \ + destptr += 4; \ + PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ + } \ \ - /* iterate over leftover pixels */ \ - for (curx = 0; curx < leftovers; curx++) \ - { \ - if ((UINT32)srcx < srcfixwidth && (UINT32)srcy < srcfixheight) \ - { \ - srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16, srcx >> 16); \ - PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ - } \ - srcx += incxx; \ - srcy += incxy; \ - destptr++; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ - } \ - } \ - } \ + /* iterate over leftover pixels */ \ + for (curx = 0; curx < leftovers; curx++) \ + { \ + if ((UINT32)srcx < srcfixwidth && (UINT32)srcy < srcfixheight) \ + { \ + srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16, srcx >> 16); \ + PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ + } \ + srcx += incxx; \ + srcy += incxy; \ + destptr++; \ + PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ + } \ + } \ + } \ \ - /* zoom-only, wraparound case */ \ - else \ - { \ - /* convert srcfixwidth/height into a mask and apply */ \ - srcfixwidth--; \ - srcfixheight--; \ - startx &= srcfixwidth; \ - starty &= srcfixheight; \ + /* zoom-only, wraparound case */ \ + else \ + { \ + /* convert srcfixwidth/height into a mask and apply */ \ + srcfixwidth--; \ + srcfixheight--; \ + startx &= srcfixwidth; \ + starty &= srcfixheight; \ \ - /* iterate over pixels in Y */ \ - for (cury = cliprect.min_y; cury <= cliprect.max_y; cury++) \ - { \ + /* iterate over pixels in Y */ \ + for (cury = cliprect.min_y; cury <= cliprect.max_y; cury++) \ + { \ PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, cliprect.min_x); \ PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, cliprect.min_x); \ - const PIXEL_TYPE *srcptr; \ - INT32 srcx = startx; \ - INT32 srcy = starty; \ + const PIXEL_TYPE *srcptr; \ + INT32 srcx = startx; \ + INT32 srcy = starty; \ \ - startx = (startx + incyx) & srcfixwidth; \ - starty = (starty + incyy) & srcfixheight; \ + startx = (startx + incyx) & srcfixwidth; \ + starty = (starty + incyy) & srcfixheight; \ \ - /* iterate over unrolled blocks of 4 */ \ - for (curx = 0; curx < numblocks; curx++) \ - { \ - srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16, srcx >> 16); \ - PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ - srcx = (srcx + incxx) & srcfixwidth; \ - srcy = (srcy + incxy) & srcfixheight; \ + /* iterate over unrolled blocks of 4 */ \ + for (curx = 0; curx < numblocks; curx++) \ + { \ + srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16, srcx >> 16); \ + PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ + srcx = (srcx + incxx) & srcfixwidth; \ + srcy = (srcy + incxy) & srcfixheight; \ \ - srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16, srcx >> 16); \ - PIXEL_OP(destptr[1], priptr[1], srcptr[0]); \ - srcx = (srcx + incxx) & srcfixwidth; \ - srcy = (srcy + incxy) & srcfixheight; \ + srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16, srcx >> 16); \ + PIXEL_OP(destptr[1], priptr[1], srcptr[0]); \ + srcx = (srcx + incxx) & srcfixwidth; \ + srcy = (srcy + incxy) & srcfixheight; \ \ - srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16, srcx >> 16); \ - PIXEL_OP(destptr[2], priptr[2], srcptr[0]); \ - srcx = (srcx + incxx) & srcfixwidth; \ - srcy = (srcy + incxy) & srcfixheight; \ + srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16, srcx >> 16); \ + PIXEL_OP(destptr[2], priptr[2], srcptr[0]); \ + srcx = (srcx + incxx) & srcfixwidth; \ + srcy = (srcy + incxy) & srcfixheight; \ \ - srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16, srcx >> 16); \ - PIXEL_OP(destptr[3], priptr[3], srcptr[0]); \ - srcx = (srcx + incxx) & srcfixwidth; \ - srcy = (srcy + incxy) & srcfixheight; \ + srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16, srcx >> 16); \ + PIXEL_OP(destptr[3], priptr[3], srcptr[0]); \ + srcx = (srcx + incxx) & srcfixwidth; \ + srcy = (srcy + incxy) & srcfixheight; \ \ - destptr += 4; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ - } \ + destptr += 4; \ + PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ + } \ \ - /* iterate over leftover pixels */ \ - for (curx = 0; curx < leftovers; curx++) \ - { \ - srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16, srcx >> 16); \ - PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ - srcx = (srcx + incxx) & srcfixwidth; \ - srcy = (srcy + incxy) & srcfixheight; \ - destptr++; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ - } \ - } \ - } \ - } \ - g_profiler.stop(); \ + /* iterate over leftover pixels */ \ + for (curx = 0; curx < leftovers; curx++) \ + { \ + srcptr = &src.pixt<PIXEL_TYPE>(srcy >> 16, srcx >> 16); \ + PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ + srcx = (srcx + incxx) & srcfixwidth; \ + srcy = (srcy + incxy) & srcfixheight; \ + destptr++; \ + PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ + } \ + } \ + } \ + } \ + g_profiler.stop(); \ } while (0) @@ -1134,43 +1134,43 @@ do { \ bitmap_t &priority - the priority bitmap (even if PRIORITY_TYPE is NO_PRIORITY, at least needs a dummy) */ -#define DRAWSCANLINE_CORE(PIXEL_TYPE, PIXEL_OP, PRIORITY_TYPE) \ -do { \ - assert(bitmap.valid()); \ - assert(destx >= 0); \ - assert(destx + length <= bitmap.width()); \ - assert(desty >= 0); \ - assert(desty < bitmap.height()); \ - assert(srcptr != NULL); \ - assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \ +#define DRAWSCANLINE_CORE(PIXEL_TYPE, PIXEL_OP, PRIORITY_TYPE) \ +do { \ + assert(bitmap.valid()); \ + assert(destx >= 0); \ + assert(destx + length <= bitmap.width()); \ + assert(desty >= 0); \ + assert(desty < bitmap.height()); \ + assert(srcptr != NULL); \ + assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \ \ - { \ + { \ PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, desty, destx); \ - PIXEL_TYPE *destptr = &bitmap.pixt<PIXEL_TYPE>(desty, destx); \ + PIXEL_TYPE *destptr = &bitmap.pixt<PIXEL_TYPE>(desty, destx); \ \ - /* iterate over unrolled blocks of 4 */ \ - while (length >= 4) \ - { \ - PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ - PIXEL_OP(destptr[1], priptr[1], srcptr[1]); \ - PIXEL_OP(destptr[2], priptr[2], srcptr[2]); \ - PIXEL_OP(destptr[3], priptr[3], srcptr[3]); \ + /* iterate over unrolled blocks of 4 */ \ + while (length >= 4) \ + { \ + PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ + PIXEL_OP(destptr[1], priptr[1], srcptr[1]); \ + PIXEL_OP(destptr[2], priptr[2], srcptr[2]); \ + PIXEL_OP(destptr[3], priptr[3], srcptr[3]); \ \ - length -= 4; \ - srcptr += 4; \ - destptr += 4; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ - } \ + length -= 4; \ + srcptr += 4; \ + destptr += 4; \ + PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 4); \ + } \ \ - /* iterate over leftover pixels */ \ - while (length-- > 0) \ - { \ - PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ - srcptr++; \ - destptr++; \ - PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ - } \ - } \ + /* iterate over leftover pixels */ \ + while (length-- > 0) \ + { \ + PIXEL_OP(destptr[0], priptr[0], srcptr[0]); \ + srcptr++; \ + destptr++; \ + PRIORITY_ADVANCE(PRIORITY_TYPE, priptr, 1); \ + } \ + } \ } while (0) @@ -1189,40 +1189,40 @@ do { \ UINTx *destptr - pointer to memory to receive the extracted pixels */ -#define EXTRACTSCANLINE_CORE(PIXEL_TYPE) \ -do { \ - assert(bitmap.valid()); \ - assert(srcx >= 0); \ - assert(srcx + length <= bitmap.width()); \ - assert(srcy >= 0); \ - assert(srcy < bitmap.height()); \ - assert(destptr != NULL); \ +#define EXTRACTSCANLINE_CORE(PIXEL_TYPE) \ +do { \ + assert(bitmap.valid()); \ + assert(srcx >= 0); \ + assert(srcx + length <= bitmap.width()); \ + assert(srcy >= 0); \ + assert(srcy < bitmap.height()); \ + assert(destptr != NULL); \ \ - { \ - const PIXEL_TYPE *srcptr = &bitmap.pixt<PIXEL_TYPE>(srcy, srcx); \ + { \ + const PIXEL_TYPE *srcptr = &bitmap.pixt<PIXEL_TYPE>(srcy, srcx); \ \ - /* iterate over unrolled blocks of 4 */ \ - while (length >= 4) \ - { \ - destptr[0] = srcptr[0]; \ - destptr[1] = srcptr[1]; \ - destptr[2] = srcptr[2]; \ - destptr[3] = srcptr[3]; \ - length -= 4; \ - srcptr += 4; \ - destptr += 4; \ - } \ + /* iterate over unrolled blocks of 4 */ \ + while (length >= 4) \ + { \ + destptr[0] = srcptr[0]; \ + destptr[1] = srcptr[1]; \ + destptr[2] = srcptr[2]; \ + destptr[3] = srcptr[3]; \ + length -= 4; \ + srcptr += 4; \ + destptr += 4; \ + } \ \ - /* iterate over leftover pixels */ \ - while (length > 0) \ - { \ - destptr[0] = srcptr[0]; \ - length--; \ - srcptr++; \ - destptr++; \ - } \ - } \ + /* iterate over leftover pixels */ \ + while (length > 0) \ + { \ + destptr[0] = srcptr[0]; \ + length--; \ + srcptr++; \ + destptr++; \ + } \ + } \ } while (0) -#endif /* __DRAWGFXM_H__ */ +#endif /* __DRAWGFXM_H__ */ |