summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/video/stvvdp2.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/video/stvvdp2.cpp')
-rw-r--r--src/devices/video/stvvdp2.cpp176
1 files changed, 87 insertions, 89 deletions
diff --git a/src/devices/video/stvvdp2.cpp b/src/devices/video/stvvdp2.cpp
index cc1da5b39d3..3c64fce6690 100644
--- a/src/devices/video/stvvdp2.cpp
+++ b/src/devices/video/stvvdp2.cpp
@@ -2502,27 +2502,27 @@ void saturn_state::stv_vdp2_drawgfxzoom(
y_index = 0;
}
- if( sx < myclip.min_x)
+ if( sx < myclip.left())
{ /* clip left */
- int pixels = myclip.min_x-sx;
+ int pixels = myclip.left()-sx;
sx += pixels;
x_index_base += pixels*dx;
}
- if( sy < myclip.min_y )
+ if( sy < myclip.top() )
{ /* clip top */
- int pixels = myclip.min_y-sy;
+ int pixels = myclip.top()-sy;
sy += pixels;
y_index += pixels*dy;
}
/* NS 980211 - fixed incorrect clipping */
- if( ex > myclip.max_x+1 )
+ if( ex > myclip.right()+1 )
{ /* clip right */
- int pixels = ex-myclip.max_x-1;
+ int pixels = ex-myclip.right()-1;
ex -= pixels;
}
- if( ey > myclip.max_y+1 )
+ if( ey > myclip.bottom()+1 )
{ /* clip bottom */
- int pixels = ey-myclip.max_y-1;
+ int pixels = ey-myclip.bottom()-1;
ey -= pixels;
}
@@ -2703,27 +2703,27 @@ void saturn_state::stv_vdp2_drawgfxzoom_rgb555(
y_index = 0;
}
- if( sx < myclip.min_x)
+ if( sx < myclip.left())
{ /* clip left */
- int pixels = myclip.min_x-sx;
+ int pixels = myclip.left()-sx;
sx += pixels;
x_index_base += pixels*dx;
}
- if( sy < myclip.min_y )
+ if( sy < myclip.top() )
{ /* clip top */
- int pixels = myclip.min_y-sy;
+ int pixels = myclip.top()-sy;
sy += pixels;
y_index += pixels*dy;
}
/* NS 980211 - fixed incorrect clipping */
- if( ex > myclip.max_x+1 )
+ if( ex > myclip.right()+1 )
{ /* clip right */
- int pixels = ex-myclip.max_x-1;
+ int pixels = ex-myclip.right()-1;
ex -= pixels;
}
- if( ey > myclip.max_y+1 )
+ if( ey > myclip.bottom()+1 )
{ /* clip bottom */
- int pixels = ey-myclip.max_y-1;
+ int pixels = ey-myclip.bottom()-1;
ey -= pixels;
}
@@ -2893,27 +2893,27 @@ void saturn_state::stv_vdp2_drawgfx_rgb555( bitmap_rgb32 &dest_bmp, const rectan
y_index = 0;
}
- if( sx < myclip.min_x)
+ if( sx < myclip.left())
{ /* clip left */
- int pixels = myclip.min_x-sx;
+ int pixels = myclip.left()-sx;
sx += pixels;
x_index_base += pixels*dx;
}
- if( sy < myclip.min_y )
+ if( sy < myclip.top() )
{ /* clip top */
- int pixels = myclip.min_y-sy;
+ int pixels = myclip.top()-sy;
sy += pixels;
y_index += pixels*dy;
}
/* NS 980211 - fixed incorrect clipping */
- if( ex > myclip.max_x+1 )
+ if( ex > myclip.right()+1 )
{ /* clip right */
- int pixels = ex-myclip.max_x-1;
+ int pixels = ex-myclip.right()-1;
ex -= pixels;
}
- if( ey > myclip.max_y+1 )
+ if( ey > myclip.bottom()+1 )
{ /* clip bottom */
- int pixels = ey-myclip.max_y-1;
+ int pixels = ey-myclip.bottom()-1;
ey -= pixels;
}
@@ -3006,27 +3006,27 @@ void saturn_state::stv_vdp2_drawgfx_rgb888( bitmap_rgb32 &dest_bmp, const rectan
y_index = 0;
}
- if( sx < myclip.min_x)
+ if( sx < myclip.left())
{ /* clip left */
- int pixels = myclip.min_x-sx;
+ int pixels = myclip.left()-sx;
sx += pixels;
x_index_base += pixels*dx;
}
- if( sy < myclip.min_y )
+ if( sy < myclip.top() )
{ /* clip top */
- int pixels = myclip.min_y-sy;
+ int pixels = myclip.top()-sy;
sy += pixels;
y_index += pixels*dy;
}
/* NS 980211 - fixed incorrect clipping */
- if( ex > myclip.max_x+1 )
+ if( ex > myclip.right()+1 )
{ /* clip right */
- int pixels = ex-myclip.max_x-1;
+ int pixels = ex-myclip.right()-1;
ex -= pixels;
}
- if( ey > myclip.max_y+1 )
+ if( ey > myclip.bottom()+1 )
{ /* clip bottom */
- int pixels = ey-myclip.max_y-1;
+ int pixels = ey-myclip.bottom()-1;
ey -= pixels;
}
@@ -3096,29 +3096,29 @@ void saturn_state::stv_vdp2_drawgfx_alpha(bitmap_rgb32 &dest_bmp,const rectangle
ey = sy + gfx->height();
/* clip left */
- if (sx < clip.min_x)
+ if (sx < clip.left())
{
- int pixels = clip.min_x-sx;
+ int pixels = clip.left()-sx;
sx += pixels;
x_index_base += xinc*pixels;
}
/* clip top */
- if (sy < clip.min_y)
- { int pixels = clip.min_y-sy;
+ if (sy < clip.top())
+ { int pixels = clip.top()-sy;
sy += pixels;
y_index += yinc*pixels;
}
/* clip right */
- if (ex > clip.max_x+1)
+ if (ex > clip.right()+1)
{
- ex = clip.max_x+1;
+ ex = clip.right()+1;
}
/* clip bottom */
- if (ey > clip.max_y+1)
+ if (ey > clip.bottom()+1)
{
- ey = clip.max_y+1;
+ ey = clip.bottom()+1;
}
/* skip if inner loop doesn't draw anything */
@@ -3173,29 +3173,29 @@ void saturn_state::stv_vdp2_drawgfx_transpen(bitmap_rgb32 &dest_bmp,const rectan
ey = sy + gfx->height();
/* clip left */
- if (sx < clip.min_x)
+ if (sx < clip.left())
{
- int pixels = clip.min_x-sx;
+ int pixels = clip.left()-sx;
sx += pixels;
x_index_base += xinc*pixels;
}
/* clip top */
- if (sy < clip.min_y)
- { int pixels = clip.min_y-sy;
+ if (sy < clip.top())
+ { int pixels = clip.top()-sy;
sy += pixels;
y_index += yinc*pixels;
}
/* clip right */
- if (ex > clip.max_x+1)
+ if (ex > clip.right()+1)
{
- ex = clip.max_x+1;
+ ex = clip.right()+1;
}
/* clip bottom */
- if (ey > clip.max_y+1)
+ if (ey > clip.bottom()+1)
{
- ey = clip.max_y+1;
+ ey = clip.bottom()+1;
}
/* skip if inner loop doesn't draw anything */
@@ -3251,9 +3251,9 @@ void saturn_state::draw_4bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &clipr
if(stv2_current_tilemap.fade_control & 1)
pal_bank += ((stv2_current_tilemap.fade_control & 2) ? (2*2048) : (2048));
- for(ydst=cliprect.min_y;ydst<=cliprect.max_y;ydst++)
+ for(ydst=cliprect.top();ydst<=cliprect.bottom();ydst++)
{
- for(xdst=cliprect.min_x;xdst<=cliprect.max_x;xdst++)
+ for(xdst=cliprect.left();xdst<=cliprect.right();xdst++)
{
if(!stv_vdp2_window_process(xdst,ydst))
continue;
@@ -3308,9 +3308,9 @@ void saturn_state::draw_8bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &clipr
if(stv2_current_tilemap.fade_control & 1)
pal_bank += ((stv2_current_tilemap.fade_control & 2) ? (2*2048) : (2048));
- for(ydst=cliprect.min_y;ydst<=cliprect.max_y;ydst++)
+ for(ydst=cliprect.top();ydst<=cliprect.bottom();ydst++)
{
- for(xdst=cliprect.min_x;xdst<=cliprect.max_x;xdst++)
+ for(xdst=cliprect.left();xdst<=cliprect.right();xdst++)
{
if(!stv_vdp2_window_process(xdst,ydst))
continue;
@@ -3364,9 +3364,9 @@ void saturn_state::draw_11bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &clip
if(stv2_current_tilemap.fade_control & 1)
pal_bank = ((stv2_current_tilemap.fade_control & 2) ? (2*2048) : (2048));
- for(ydst=cliprect.min_y;ydst<=cliprect.max_y;ydst++)
+ for(ydst=cliprect.top();ydst<=cliprect.bottom();ydst++)
{
- for(xdst=cliprect.min_x;xdst<=cliprect.max_x;xdst++)
+ for(xdst=cliprect.left();xdst<=cliprect.right();xdst++)
{
if(!stv_vdp2_window_process(xdst,ydst))
continue;
@@ -3418,9 +3418,9 @@ void saturn_state::draw_rgb15_bitmap(bitmap_rgb32 &bitmap, const rectangle &clip
xsize_mask = (stv2_current_tilemap.linescroll_enable) ? 1024 : xsize;
ysize_mask = (stv2_current_tilemap.vertical_linescroll_enable) ? 512 : ysize;
- for(ydst=cliprect.min_y;ydst<=cliprect.max_y;ydst++)
+ for(ydst=cliprect.top();ydst<=cliprect.bottom();ydst++)
{
- for(xdst=cliprect.min_x;xdst<=cliprect.max_x;xdst++)
+ for(xdst=cliprect.left();xdst<=cliprect.right();xdst++)
{
if(!stv_vdp2_window_process(xdst,ydst))
continue;
@@ -3476,9 +3476,9 @@ void saturn_state::draw_rgb32_bitmap(bitmap_rgb32 &bitmap, const rectangle &clip
xsize_mask = (stv2_current_tilemap.linescroll_enable) ? 1024 : xsize;
ysize_mask = (stv2_current_tilemap.vertical_linescroll_enable) ? 512 : ysize;
- for(ydst=cliprect.min_y;ydst<=cliprect.max_y;ydst++)
+ for(ydst=cliprect.top();ydst<=cliprect.bottom();ydst++)
{
- for(xdst=cliprect.min_x;xdst<=cliprect.max_x;xdst++)
+ for(xdst=cliprect.left();xdst<=cliprect.right();xdst++)
{
if(!stv_vdp2_window_process(xdst,ydst))
continue;
@@ -3958,7 +3958,7 @@ void saturn_state::stv_vdp2_draw_basic_tilemap(bitmap_rgb32 &bitmap, const recta
{
int drawyposinc = tilesizey*(stv2_current_tilemap.tile_size ? 2 : 1);
drawypos = -(stv2_current_tilemap.scrolly*scaley);
- while( ((drawypos + drawyposinc) >> 16) < cliprect.min_y )
+ while( ((drawypos + drawyposinc) >> 16) < cliprect.top() )
{
drawypos += drawyposinc;
y++;
@@ -3969,7 +3969,7 @@ void saturn_state::stv_vdp2_draw_basic_tilemap(bitmap_rgb32 &bitmap, const recta
{
drawypos += tilesizey*(stv2_current_tilemap.tile_size ? 2 : 1);
}
- if ((drawypos >> 16) > cliprect.max_y) break;
+ if ((drawypos >> 16) > cliprect.bottom()) break;
ypageoffs = y & (pgtiles_y-1);
@@ -3981,7 +3981,7 @@ void saturn_state::stv_vdp2_draw_basic_tilemap(bitmap_rgb32 &bitmap, const recta
{
int drawxposinc = tilesizex*(stv2_current_tilemap.tile_size ? 2 : 1);
drawxpos = -(stv2_current_tilemap.scrollx*scalex);
- while( ((drawxpos + drawxposinc) >> 16) < cliprect.min_x )
+ while( ((drawxpos + drawxposinc) >> 16) < cliprect.left() )
{
drawxpos += drawxposinc;
x++;
@@ -3992,7 +3992,7 @@ void saturn_state::stv_vdp2_draw_basic_tilemap(bitmap_rgb32 &bitmap, const recta
{
drawxpos+=tilesizex*(stv2_current_tilemap.tile_size ? 2 : 1);
}
- if ( (drawxpos >> 16) > cliprect.max_x ) break;
+ if ( (drawxpos >> 16) > cliprect.right() ) break;
xpageoffs = x & (pgtiles_x-1);
@@ -4190,7 +4190,7 @@ void saturn_state::stv_vdp2_draw_basic_tilemap(bitmap_rgb32 &bitmap, const recta
if ( LOG_VDP2 )
{
- logerror( "Layer RBG%d, size %d x %d\n", stv2_current_tilemap.layer_name & 0x7f, cliprect.max_x + 1, cliprect.max_y + 1 );
+ logerror( "Layer RBG%d, size %d x %d\n", stv2_current_tilemap.layer_name & 0x7f, cliprect.right() + 1, cliprect.bottom() + 1 );
logerror( "Tiles: min %08X, max %08X\n", tilecodemin, tilecodemax );
logerror( "MAP size in dwords %08X\n", mpsize_dwords );
for (i = 0; i < stv2_current_tilemap.map_count; i++)
@@ -4240,7 +4240,7 @@ void saturn_state::stv_vdp2_draw_basic_tilemap(bitmap_rgb32 &bitmap, const recta
void saturn_state::stv_vdp2_check_tilemap_with_linescroll(bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
rectangle mycliprect;
- int cur_line = cliprect.min_y;
+ int cur_line = cliprect.top();
int address;
int active_functions = 0;
int32_t scroll_values[3], prev_scroll_values[3];
@@ -4278,7 +4278,7 @@ void saturn_state::stv_vdp2_check_tilemap_with_linescroll(bitmap_rgb32 &bitmap,
if ( linezoom_enable ) active_functions++;
// address of data table
- address = stv2_current_tilemap.linescroll_table_address + active_functions*4*cliprect.min_y;
+ address = stv2_current_tilemap.linescroll_table_address + active_functions*4*cliprect.top();
// get the first scroll values
for ( i = 0; i < active_functions; i++ )
@@ -4294,7 +4294,7 @@ void saturn_state::stv_vdp2_check_tilemap_with_linescroll(bitmap_rgb32 &bitmap,
}
}
- while( cur_line <= cliprect.max_y )
+ while( cur_line <= cliprect.bottom() )
{
lines = 0;
do
@@ -4325,12 +4325,11 @@ void saturn_state::stv_vdp2_check_tilemap_with_linescroll(bitmap_rgb32 &bitmap,
{
scroll_values_equal &= (scroll_values[i] == prev_scroll_values[i]);
}
- } while( scroll_values_equal && ((cur_line + lines) <= cliprect.max_y) );
+ } while( scroll_values_equal && ((cur_line + lines) <= cliprect.bottom()) );
// determined how many lines can be drawn
// prepare clipping rectangle
- mycliprect.min_y = cur_line;
- mycliprect.max_y = cur_line + lines - 1;
+ mycliprect.sety(cur_line, cur_line + lines - 1);
// prepare scroll values
i = 0;
@@ -4358,7 +4357,7 @@ void saturn_state::stv_vdp2_check_tilemap_with_linescroll(bitmap_rgb32 &bitmap,
i++;
}
-// if ( LOG_VDP2 ) logerror( "Linescroll: y < %d, %d >, scrollx = %d, scrolly = %d, incx = %f\n", mycliprect.min_y, mycliprect.max_y, stv2_current_tilemap.scrollx, stv2_current_tilemap.scrolly, (float)stv2_current_tilemap.incx/65536.0 );
+// if ( LOG_VDP2 ) logerror( "Linescroll: y < %d, %d >, scrollx = %d, scrolly = %d, incx = %f\n", mycliprect.top(), mycliprect.bottom(), stv2_current_tilemap.scrollx, stv2_current_tilemap.scrolly, (float)stv2_current_tilemap.incx/65536.0 );
// render current tilemap portion
if (stv2_current_tilemap.bitmap_enable) // this layer is a bitmap
{
@@ -4389,14 +4388,14 @@ void saturn_state::stv_vdp2_draw_line(bitmap_rgb32 &bitmap, const rectangle &cli
{
base_mask = STV_VDP2_VRAMSZ ? 0x7ffff : 0x3ffff;
- for(y=cliprect.min_y;y<=cliprect.max_y;y++)
+ for(y=cliprect.top();y<=cliprect.bottom();y++)
{
base_offs = (STV_VDP2_LCTA & base_mask) << 1;
if(STV_VDP2_LCCLMD)
base_offs += (y / interlace) << 1;
- for(x=cliprect.min_x;x<=cliprect.max_x;x++)
+ for(x=cliprect.left();x<=cliprect.right();x++)
{
uint16_t pen;
@@ -4427,9 +4426,9 @@ void saturn_state::stv_vdp2_draw_mosaic(bitmap_rgb32 &bitmap, const rectangle &c
if(STV_VDP2_LSMD == 3)
v_size <<= 1;
- for(y=cliprect.min_y;y<=cliprect.max_y;y+=v_size)
+ for(y=cliprect.top();y<=cliprect.bottom();y+=v_size)
{
- for(x=cliprect.min_x;x<=cliprect.max_x;x+=h_size)
+ for(x=cliprect.left();x<=cliprect.right();x+=h_size)
{
pix = bitmap.pix32(y, x);
@@ -4484,10 +4483,9 @@ void saturn_state::stv_vdp2_check_tilemap(bitmap_rgb32 &bitmap, const rectangle
//base_incx = stv2_current_tilemap.incx;
//base_incy = stv2_current_tilemap.incy;
- while(cur_char <= cliprect.max_x)
+ while(cur_char <= cliprect.right())
{
- mycliprect.min_x = cur_char;
- mycliprect.max_x = cur_char + 8 - 1;
+ mycliprect.setx(cur_char, cur_char + 8 - 1);
uint32_t cur_address;
int16_t char_scroll;
@@ -4755,7 +4753,7 @@ void saturn_state::stv_vdp2_copy_roz_bitmap(bitmap_rgb32 &bitmap,
xp = mul_fixed32( RP.A, RP.px - RP.cx ) + mul_fixed32( RP.B, RP.py - RP.cy ) + mul_fixed32( RP.C, RP.pz - RP.cz ) + RP.cx + RP.mx;
yp = mul_fixed32( RP.D, RP.px - RP.cx ) + mul_fixed32( RP.E, RP.py - RP.cy ) + mul_fixed32( RP.F, RP.pz - RP.cz ) + RP.cy + RP.my;
- for (vcnt = cliprect.min_y; vcnt <= cliprect.max_y; vcnt++ )
+ for (vcnt = cliprect.top(); vcnt <= cliprect.bottom(); vcnt++ )
{
/*xsp = RP.A * ( ( RP.xst + RP.dxst * (vcnt << 16) ) - RP.px ) +
RP.B * ( ( RP.yst + RP.dyst * (vcnt << 16) ) - RP.py ) +
@@ -4847,7 +4845,7 @@ void saturn_state::stv_vdp2_copy_roz_bitmap(bitmap_rgb32 &bitmap,
dxs = mul_fixed32( kx, mul_fixed32( dx, 1 << (16-hcnt_shift)));
dys = mul_fixed32( ky, mul_fixed32( dy, 1 << (16-hcnt_shift)));
- for (hcnt = cliprect.min_x; hcnt <= cliprect.max_x; xs+=dxs, ys+=dys, hcnt++ )
+ for (hcnt = cliprect.left(); hcnt <= cliprect.right(); xs+=dxs, ys+=dys, hcnt++ )
{
x = xs >> 16;
y = ys >> 16;
@@ -4904,7 +4902,7 @@ void saturn_state::stv_vdp2_copy_roz_bitmap(bitmap_rgb32 &bitmap,
}
else
{
- for (hcnt = cliprect.min_x; hcnt <= cliprect.max_x; hcnt++ )
+ for (hcnt = cliprect.left(); hcnt <= cliprect.right(); hcnt++ )
{
switch( coeff_table_size )
{
@@ -5830,13 +5828,13 @@ void saturn_state::stv_vdp2_draw_back(bitmap_rgb32 &bitmap, const rectangle &cli
{
base_mask = STV_VDP2_VRAMSZ ? 0x7ffff : 0x3ffff;
- for(y=cliprect.min_y;y<=cliprect.max_y;y++)
+ for(y=cliprect.top();y<=cliprect.bottom();y++)
{
base_offs = ((STV_VDP2_BKTA ) & base_mask) << 1;
if(STV_VDP2_BKCLMD)
base_offs += ((y / interlace) << 1);
- for(x=cliprect.min_x;x<=cliprect.max_x;x++)
+ for(x=cliprect.left();x<=cliprect.right();x++)
{
int r,g,b;
uint16_t dot;
@@ -6182,7 +6180,7 @@ uint8_t saturn_state::get_hblank( void )
const rectangle &visarea = m_screen->visible_area();
int cur_h = m_screen->hpos();
- if (cur_h > visarea.max_x) //TODO
+ if (cur_h > visarea.right()) //TODO
return 1;
return 0;
@@ -6791,7 +6789,7 @@ void saturn_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect,
{
if ( alpha_enabled == 0 )
{
- for ( y = cliprect.min_y; y <= cliprect.max_y; y++ )
+ for ( y = cliprect.top(); y <= cliprect.bottom(); y++ )
{
if ( stv_sprite_priorities_usage_valid )
if (stv_sprite_priorities_in_fb_line[y][pri] == 0)
@@ -6800,7 +6798,7 @@ void saturn_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect,
framebuffer_line = m_vdp1.framebuffer_display_lines[y];
bitmap_line = &bitmap.pix32(y);
- for ( x = cliprect.min_x; x <= cliprect.max_x; x++ )
+ for ( x = cliprect.left(); x <= cliprect.right(); x++ )
{
if(!stv_vdp2_window_process(x,y))
continue;
@@ -6884,7 +6882,7 @@ void saturn_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect,
}
else //alpha_enabled == 1
{
- for ( y = cliprect.min_y; y <= cliprect.max_y; y++ )
+ for ( y = cliprect.top(); y <= cliprect.bottom(); y++ )
{
if ( stv_sprite_priorities_usage_valid )
if (stv_sprite_priorities_in_fb_line[y][pri] == 0)
@@ -6893,7 +6891,7 @@ void saturn_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect,
framebuffer_line = m_vdp1.framebuffer_display_lines[y];
bitmap_line = &bitmap.pix32(y);
- for ( x = cliprect.min_x; x <= cliprect.max_x; x++ )
+ for ( x = cliprect.left(); x <= cliprect.right(); x++ )
{
if(!stv_vdp2_window_process(x,y))
continue;
@@ -6993,7 +6991,7 @@ void saturn_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect,
}
else
{
- for ( y = cliprect.min_y; y <= cliprect.max_y / (interlace_framebuffer+1); y++ )
+ for ( y = cliprect.top(); y <= cliprect.bottom() / (interlace_framebuffer+1); y++ )
{
if ( stv_sprite_priorities_usage_valid )
if (stv_sprite_priorities_in_fb_line[y][pri] == 0)
@@ -7010,7 +7008,7 @@ void saturn_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect,
bitmap_line2 = &bitmap.pix32(2*y + 1);
}
- for ( x = cliprect.min_x; x <= cliprect.max_x /(double_x+1) ; x++ )
+ for ( x = cliprect.left(); x <= cliprect.right() /(double_x+1) ; x++ )
{
if(!stv_vdp2_window_process(x,y))
continue;