further consolidation of codepaths (nw)

This commit is contained in:
David Haywood 2013-07-17 00:13:24 +00:00
parent c0a4bc8930
commit e325b73b56

View File

@ -243,7 +243,7 @@ public:
ox -= (zoomx * width) >> 13;
oy -= (zoomy * height) >> 13;
if (gx_objzbuf && gx_shdzbuf) /* GX case, custom draw function */
if (gx_objzbuf && gx_shdzbuf) /* GX */
{
k053247_draw_yxloop_gx( bitmap, cliprect,
@ -257,11 +257,12 @@ public:
nozoom,
pri,
zcode, alpha, drawmode,
gx_objzbuf, gx_shdzbuf
gx_objzbuf, gx_shdzbuf,
0,0
);
}
else /* non-GX case, MAME draw functions */
else /* non-GX */
{
UINT8* whichtable = drawmode_table;
if (color == -1)
@ -288,7 +289,7 @@ public:
drawmode_table[m_gfx->granularity() - 1] = shadow ? DRAWMODE_SHADOW : DRAWMODE_SOURCE;
k053247_draw_loop( bitmap, cliprect,
k053247_draw_yxloop_gx( bitmap, cliprect,
code,
color,
height, width,
@ -297,8 +298,10 @@ public:
xa, ya,
mirrorx, mirrory,
nozoom,
primask,
whichtable
0,
0, 0, 0,
0, 0,
primask,whichtable
);
@ -320,94 +323,7 @@ public:
/* gx specifics */
int pri,
int zcode, int alpha, int drawmode,
UINT8* gx_objzbuf, UINT8* gx_shdzbuf
)
{
static const int xoffset[8] = { 0, 1, 4, 5, 16, 17, 20, 21 };
static const int yoffset[8] = { 0, 2, 8, 10, 32, 34, 40, 42 };
int zw,zh;
int temp1, temp2, temp3, temp4;
int temp;
// substitutes: temp=code, temp1=fx, temp2=fy, temp3=sx, temp4=sy;
for (int y=0; y<height; y++)
{
temp4 = oy + ((zoomy * y + (1<<11)) >> 12);
zh = (oy + ((zoomy * (y+1) + (1<<11)) >> 12)) - temp4;
for (int x=0; x<width; x++)
{
temp3 = ox + ((zoomx * x + (1<<11)) >> 12);
zw = (ox + ((zoomx * (x+1) + (1<<11)) >> 12)) - temp3;
temp = code;
if (mirrorx)
{
if ((!flipx)^((x<<1)<width))
{
/* mirror left/right */
temp += xoffset[(width-1-x+xa)&7];
temp1 = 1;
}
else
{
temp += xoffset[(x+xa)&7];
temp1 = 0;
}
}
else
{
if (flipx) temp += xoffset[(width-1-x+xa)&7];
else temp += xoffset[(x+xa)&7];
temp1 = flipx;
}
if (mirrory)
{
if ((!flipy)^((y<<1)>=height))
{
/* mirror top/bottom */
temp += yoffset[(height-1-y+ya)&7];
temp2 = 1;
}
else
{
temp += yoffset[(y+ya)&7];
temp2 = 0;
}
}
else
{
if (flipy) temp += yoffset[(height-1-y+ya)&7];
else temp += yoffset[(y+ya)&7];
temp2 = flipy;
}
if (nozoom) { zw = zh = 0x10; }
zdrawgfxzoom32GP(
bitmap, cliprect,
temp,
color,
temp1,temp2,
temp3,temp4,
zw << 12, zh << 12, alpha, drawmode, zcode, pri,
gx_objzbuf, gx_shdzbuf
);
}
}
}
template<class _BitmapClass>
void k053247_draw_loop( _BitmapClass &bitmap, const rectangle &cliprect,
int code,
int color,
int height, int width,
int zoomx, int zoomy, int flipx, int flipy,
int ox, int oy,
int xa, int ya,
int mirrorx, int mirrory,
int nozoom,
UINT8* gx_objzbuf, UINT8* gx_shdzbuf,
/* non-gx specifics */
int primask,
UINT8* whichtable
@ -415,67 +331,84 @@ public:
{
static const int xoffset[8] = { 0, 1, 4, 5, 16, 17, 20, 21 };
static const int yoffset[8] = { 0, 2, 8, 10, 32, 34, 40, 42 };
int zw,zh;
int fx, fy, sx, sy;
int tempcode;
for (int y=0; y<height; y++)
{
int sx, sy, zw, zh;
sy = oy + ((zoomy * y + (1<<11)) >> 12);
zh = (oy + ((zoomy * (y+1) + (1<<11)) >> 12)) - sy;
for (int x=0; x<width; x++)
{
int c, fx, fy;
sx = ox + ((zoomx * x + (1<<11)) >> 12);
zw = (ox + ((zoomx * (x+1) + (1<<11)) >> 12)) - sx;
c = code;
tempcode = code;
if (mirrorx)
{
if ((flipx == 0) ^ ((x << 1) < width))
if ((!flipx)^((x<<1)<width))
{
/* mirror left/right */
c += xoffset[(width - 1 - x + xa) & 7];
tempcode += xoffset[(width-1-x+xa)&7];
fx = 1;
}
else
{
c += xoffset[(x + xa) & 7];
tempcode += xoffset[(x+xa)&7];
fx = 0;
}
}
else
{
if (flipx) c += xoffset[(width - 1 - x + xa) & 7];
else c += xoffset[(x + xa) & 7];
if (flipx) tempcode += xoffset[(width-1-x+xa)&7];
else tempcode += xoffset[(x+xa)&7];
fx = flipx;
}
if (mirrory)
{
if ((flipy == 0) ^ ((y<<1) >= height))
if ((!flipy)^((y<<1)>=height))
{
/* mirror top/bottom */
c += yoffset[(height - 1 - y + ya) & 7];
tempcode += yoffset[(height-1-y+ya)&7];
fy = 1;
}
else
{
c += yoffset[(y + ya) & 7];
tempcode += yoffset[(y+ya)&7];
fy = 0;
}
}
else
{
if (flipy) c += yoffset[(height - 1 - y + ya) & 7];
else c += yoffset[(y + ya) & 7];
if (flipy) tempcode += yoffset[(height-1-y+ya)&7];
else tempcode += yoffset[(y+ya)&7];
fy = flipy;
}
if (gx_objzbuf && gx_shdzbuf) /* GX uses a custom draw function */
{
if (nozoom) { zw = zh = 0x10; }
zdrawgfxzoom32GP(
bitmap, cliprect,
tempcode,
color,
fx,fy,
sx,sy,
zw << 12, zh << 12, alpha, drawmode, zcode, pri,
gx_objzbuf, gx_shdzbuf
);
}
else /* Non-GX using regular pdrawgfx */
{
if (nozoom)
{
pdrawgfx_transtable(bitmap,cliprect,m_gfx,
c,
tempcode,
color,
fx,fy,
sx,sy,
@ -485,7 +418,7 @@ public:
else
{
pdrawgfxzoom_transtable(bitmap,cliprect,m_gfx,
c,
tempcode,
color,
fx,fy,
sx,sy,
@ -499,7 +432,7 @@ public:
if (nozoom)
{
pdrawgfx_transtable(bitmap,cliprect,m_gfx,
c,
tempcode,
color,
fx,!fy,
sx,sy,
@ -509,7 +442,7 @@ public:
else
{
pdrawgfxzoom_transtable(bitmap,cliprect,m_gfx,
c,
tempcode,
color,
fx,!fy,
sx,sy,
@ -518,12 +451,15 @@ public:
whichtable,machine().shadow_table);
}
}
}
} // end of X loop
} // end of Y loop
}
template<class _BitmapClass>
void k053247_sprites_draw_common( _BitmapClass &bitmap, const rectangle &cliprect );