mirror of
https://github.com/holub/mame
synced 2025-06-14 00:25:38 +03:00
- Added some asserts to drawgfx and drawgfxzoom
- Moved some variable declerations so that they are only visible where they are actually used Note that the diff is large only because I removed a level of indentation from a huge chunk of code. I could do that because the case it was checking for was already caught by one of the asserts added.
This commit is contained in:
parent
4c67395bc6
commit
51cae46fac
@ -1340,13 +1340,11 @@ INLINE void common_drawgfxzoom( mame_bitmap *dest_bmp,const gfx_element *gfx,
|
|||||||
const rectangle *clip,int transparency,int transparent_color,
|
const rectangle *clip,int transparency,int transparent_color,
|
||||||
int scalex, int scaley,mame_bitmap *pri_buffer,UINT32 pri_mask)
|
int scalex, int scaley,mame_bitmap *pri_buffer,UINT32 pri_mask)
|
||||||
{
|
{
|
||||||
rectangle myclip;
|
/* verify arguments */
|
||||||
|
assert(dest_bmp != NULL);
|
||||||
|
assert(gfx != NULL);
|
||||||
|
|
||||||
UINT8 ah, al;
|
if ((scalex == 0) || (scaley == 0)) return;
|
||||||
|
|
||||||
al = (pdrawgfx_shadow_lowpri) ? 0 : 0x80;
|
|
||||||
|
|
||||||
if (!scalex || !scaley) return;
|
|
||||||
|
|
||||||
if (scalex == 0x10000 && scaley == 0x10000)
|
if (scalex == 0x10000 && scaley == 0x10000)
|
||||||
{
|
{
|
||||||
@ -1372,6 +1370,8 @@ INLINE void common_drawgfxzoom( mame_bitmap *dest_bmp,const gfx_element *gfx,
|
|||||||
/* force clip to bitmap boundary */
|
/* force clip to bitmap boundary */
|
||||||
if (clip)
|
if (clip)
|
||||||
{
|
{
|
||||||
|
rectangle myclip;
|
||||||
|
|
||||||
myclip.min_x = clip->min_x;
|
myclip.min_x = clip->min_x;
|
||||||
myclip.max_x = clip->max_x;
|
myclip.max_x = clip->max_x;
|
||||||
myclip.min_y = clip->min_y;
|
myclip.min_y = clip->min_y;
|
||||||
@ -1388,8 +1388,6 @@ INLINE void common_drawgfxzoom( mame_bitmap *dest_bmp,const gfx_element *gfx,
|
|||||||
|
|
||||||
/* 8-bit destination bitmap */
|
/* 8-bit destination bitmap */
|
||||||
if (dest_bmp->bpp == 8)
|
if (dest_bmp->bpp == 8)
|
||||||
{
|
|
||||||
if( gfx )
|
|
||||||
{
|
{
|
||||||
UINT32 palbase = gfx->color_base + gfx->color_granularity * (color % gfx->total_colors);
|
UINT32 palbase = gfx->color_base + gfx->color_granularity * (color % gfx->total_colors);
|
||||||
UINT8 *source_base = gfx->gfxdata + (code % gfx->total_elements) * gfx->char_modulo;
|
UINT8 *source_base = gfx->gfxdata + (code % gfx->total_elements) * gfx->char_modulo;
|
||||||
@ -1409,7 +1407,7 @@ INLINE void common_drawgfxzoom( mame_bitmap *dest_bmp,const gfx_element *gfx,
|
|||||||
int x_index_base;
|
int x_index_base;
|
||||||
int y_index;
|
int y_index;
|
||||||
|
|
||||||
if( flipx )
|
if (flipx )
|
||||||
{
|
{
|
||||||
x_index_base = (sprite_screen_width-1)*dx;
|
x_index_base = (sprite_screen_width-1)*dx;
|
||||||
dx = -dx;
|
dx = -dx;
|
||||||
@ -1740,6 +1738,8 @@ INLINE void common_drawgfxzoom( mame_bitmap *dest_bmp,const gfx_element *gfx,
|
|||||||
pen_t *palette_shadow_table = Machine->shadow_table;
|
pen_t *palette_shadow_table = Machine->shadow_table;
|
||||||
if (pri_buffer)
|
if (pri_buffer)
|
||||||
{
|
{
|
||||||
|
UINT8 al = (pdrawgfx_shadow_lowpri) ? 0 : 0x80;
|
||||||
|
|
||||||
for( y=sy; y<ey; y++ )
|
for( y=sy; y<ey; y++ )
|
||||||
{
|
{
|
||||||
UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo;
|
UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo;
|
||||||
@ -1810,12 +1810,9 @@ INLINE void common_drawgfxzoom( mame_bitmap *dest_bmp,const gfx_element *gfx,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* 16-bit destination bitmap */
|
/* 16-bit destination bitmap */
|
||||||
else if (dest_bmp->bpp == 16)
|
else if (dest_bmp->bpp == 16)
|
||||||
{
|
|
||||||
if( gfx )
|
|
||||||
{
|
{
|
||||||
const pen_t *pal = &Machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
|
const pen_t *pal = &Machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
|
||||||
UINT8 *source_base = gfx->gfxdata + (code % gfx->total_elements) * gfx->char_modulo;
|
UINT8 *source_base = gfx->gfxdata + (code % gfx->total_elements) * gfx->char_modulo;
|
||||||
@ -2167,6 +2164,8 @@ INLINE void common_drawgfxzoom( mame_bitmap *dest_bmp,const gfx_element *gfx,
|
|||||||
pen_t *palette_shadow_table = Machine->shadow_table;
|
pen_t *palette_shadow_table = Machine->shadow_table;
|
||||||
if (pri_buffer)
|
if (pri_buffer)
|
||||||
{
|
{
|
||||||
|
UINT8 al = (pdrawgfx_shadow_lowpri) ? 0 : 0x80;
|
||||||
|
|
||||||
for( y=sy; y<ey; y++ )
|
for( y=sy; y<ey; y++ )
|
||||||
{
|
{
|
||||||
UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo;
|
UINT8 *source = source_base + (y_index>>16) * gfx->line_modulo;
|
||||||
@ -2179,6 +2178,8 @@ INLINE void common_drawgfxzoom( mame_bitmap *dest_bmp,const gfx_element *gfx,
|
|||||||
int c = source[x_index>>16];
|
int c = source[x_index>>16];
|
||||||
if( c != transparent_color )
|
if( c != transparent_color )
|
||||||
{
|
{
|
||||||
|
UINT8 ah;
|
||||||
|
|
||||||
switch(gfx_drawmode_table[c])
|
switch(gfx_drawmode_table[c])
|
||||||
{
|
{
|
||||||
case DRAWMODE_SOURCE:
|
case DRAWMODE_SOURCE:
|
||||||
@ -2344,12 +2345,9 @@ INLINE void common_drawgfxzoom( mame_bitmap *dest_bmp,const gfx_element *gfx,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* 32-bit destination bitmap */
|
/* 32-bit destination bitmap */
|
||||||
else
|
else
|
||||||
{
|
|
||||||
if( gfx )
|
|
||||||
{
|
{
|
||||||
const pen_t *pal = &Machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
|
const pen_t *pal = &Machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)];
|
||||||
UINT8 *source_base = gfx->gfxdata + (code % gfx->total_elements) * gfx->char_modulo;
|
UINT8 *source_base = gfx->gfxdata + (code % gfx->total_elements) * gfx->char_modulo;
|
||||||
@ -2611,6 +2609,7 @@ INLINE void common_drawgfxzoom( mame_bitmap *dest_bmp,const gfx_element *gfx,
|
|||||||
UINT8 *source, *pri;
|
UINT8 *source, *pri;
|
||||||
UINT32 *dest;
|
UINT32 *dest;
|
||||||
int c, x, x_index;
|
int c, x, x_index;
|
||||||
|
UINT8 al, ah;
|
||||||
|
|
||||||
if (pri_buffer)
|
if (pri_buffer)
|
||||||
{
|
{
|
||||||
@ -2786,7 +2785,6 @@ INLINE void common_drawgfxzoom( mame_bitmap *dest_bmp,const gfx_element *gfx,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawgfxzoom( mame_bitmap *dest_bmp,const gfx_element *gfx,
|
void drawgfxzoom( mame_bitmap *dest_bmp,const gfx_element *gfx,
|
||||||
@ -3766,6 +3764,9 @@ DECLARE(drawgfx_core,(
|
|||||||
int ex;
|
int ex;
|
||||||
int ey;
|
int ey;
|
||||||
|
|
||||||
|
/* verify arguments */
|
||||||
|
assert(dest != NULL);
|
||||||
|
assert(gfx != NULL);
|
||||||
|
|
||||||
/* check bounds */
|
/* check bounds */
|
||||||
ox = sx;
|
ox = sx;
|
||||||
|
Loading…
Reference in New Issue
Block a user