summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2018-07-28 02:27:53 +1000
committer Vas Crabb <vas@vastheman.com>2018-07-28 02:27:53 +1000
commit29686200984dc74633183583e7391c6fa913b070 (patch)
treede9714f32cc0dae1eeca22e8cc160910d4dfe984
parentdbb034ad61477d9072c42ed83c8547d925085beb (diff)
make rectangle work better with constexpr, change many things to use designated getters/setters (nw)
-rw-r--r--makefile4
-rw-r--r--src/devices/video/poly.h58
-rw-r--r--src/devices/video/stvvdp2.cpp176
-rw-r--r--src/devices/video/upd7220.cpp13
-rw-r--r--src/devices/video/vic4567.cpp12
-rw-r--r--src/emu/drawgfx.cpp6
-rw-r--r--src/emu/drawgfxm.h100
-rw-r--r--src/emu/render.cpp2
-rw-r--r--src/emu/rendfont.cpp7
-rw-r--r--src/emu/rendlay.cpp68
-rw-r--r--src/emu/screen.cpp89
-rw-r--r--src/emu/screen.h4
-rw-r--r--src/emu/tilemap.cpp50
-rw-r--r--src/lib/util/bitmap.cpp60
-rw-r--r--src/lib/util/bitmap.h50
-rw-r--r--src/mame/drivers/accomm.cpp6
-rw-r--r--src/mame/drivers/alg.cpp4
-rw-r--r--src/mame/drivers/apple1.cpp4
-rw-r--r--src/mame/drivers/astrof.cpp2
-rw-r--r--src/mame/drivers/atarisy4.cpp6
-rw-r--r--src/mame/drivers/bfcobra.cpp4
-rw-r--r--src/mame/drivers/bmcpokr.cpp5
-rw-r--r--src/mame/drivers/c65.cpp4
-rw-r--r--src/mame/drivers/casloopy.cpp2
-rw-r--r--src/mame/drivers/cps3.cpp29
-rw-r--r--src/mame/drivers/ddenlovr.cpp4
-rw-r--r--src/mame/drivers/dooyong.cpp6
-rw-r--r--src/mame/drivers/firefox.cpp4
-rw-r--r--src/mame/drivers/fp200.cpp8
-rw-r--r--src/mame/drivers/missile.cpp14
-rw-r--r--src/mame/drivers/popobear.cpp4
-rw-r--r--src/mame/drivers/riscpc.cpp9
-rw-r--r--src/mame/drivers/sbrkout.cpp4
-rw-r--r--src/mame/includes/realbrk.h10
-rw-r--r--src/mame/machine/amiga.cpp2
-rw-r--r--src/mame/machine/archimds.cpp14
-rw-r--r--src/mame/machine/deco_irq.cpp4
-rw-r--r--src/mame/machine/electron.cpp4
-rw-r--r--src/mame/video/agat7.cpp20
-rw-r--r--src/mame/video/amiga.cpp10
-rw-r--r--src/mame/video/amigaaga.cpp10
-rw-r--r--src/mame/video/apple2.cpp64
-rw-r--r--src/mame/video/apple3.cpp16
-rw-r--r--src/mame/video/aquarium.cpp4
-rw-r--r--src/mame/video/arcadecl.cpp8
-rw-r--r--src/mame/video/atarig42.cpp8
-rw-r--r--src/mame/video/atarigt.cpp6
-rw-r--r--src/mame/video/atarigx2.cpp8
-rw-r--r--src/mame/video/atarimo.cpp18
-rw-r--r--src/mame/video/atarirle.cpp95
-rw-r--r--src/mame/video/atarisy1.cpp6
-rw-r--r--src/mame/video/atarisy2.cpp4
-rw-r--r--src/mame/video/atarivad.cpp40
-rw-r--r--src/mame/video/badlands.cpp4
-rw-r--r--src/mame/video/batman.cpp8
-rw-r--r--src/mame/video/beathead.cpp10
-rw-r--r--src/mame/video/blstroid.cpp4
-rw-r--r--src/mame/video/boogwing.cpp4
-rw-r--r--src/mame/video/ccastles.cpp6
-rw-r--r--src/mame/video/cinemat.cpp8
-rw-r--r--src/mame/video/cloak.cpp4
-rw-r--r--src/mame/video/cloud9.cpp6
-rw-r--r--src/mame/video/copsnrob.cpp2
-rw-r--r--src/mame/video/cvs.cpp6
-rw-r--r--src/mame/video/cyberbal.cpp4
-rw-r--r--src/mame/video/cybstorm.cpp8
-rw-r--r--src/mame/video/dassault.cpp4
-rw-r--r--src/mame/video/decbac06.cpp38
-rw-r--r--src/mame/video/deco16ic.cpp4
-rw-r--r--src/mame/video/deco32.cpp4
-rw-r--r--src/mame/video/deco_mlc.cpp19
-rw-r--r--src/mame/video/deco_zoomspr.cpp20
-rw-r--r--src/mame/video/decocass.cpp18
-rw-r--r--src/mame/video/decospr.cpp28
-rw-r--r--src/mame/video/dragrace.cpp3
-rw-r--r--src/mame/video/dynax.cpp4
-rw-r--r--src/mame/video/electron.cpp6
-rw-r--r--src/mame/video/eprom.cpp16
-rw-r--r--src/mame/video/equites.cpp6
-rw-r--r--src/mame/video/exidy440.cpp12
-rw-r--r--src/mame/video/fantland.cpp2
-rw-r--r--src/mame/video/firetrk.cpp10
-rw-r--r--src/mame/video/galaxia.cpp10
-rw-r--r--src/mame/video/galspnbl.cpp4
-rw-r--r--src/mame/video/gamate.cpp4
-rw-r--r--src/mame/video/gauntlet.cpp4
-rw-r--r--src/mame/video/harddriv.cpp4
-rw-r--r--src/mame/video/irobot.cpp2
-rw-r--r--src/mame/video/jaguar.cpp8
-rw-r--r--src/mame/video/jedi.cpp10
-rw-r--r--src/mame/video/klax.cpp4
-rw-r--r--src/mame/video/leland.cpp4
-rw-r--r--src/mame/video/lemmings.cpp14
-rw-r--r--src/mame/video/mac.cpp31
-rw-r--r--src/mame/video/madalien.cpp15
-rw-r--r--src/mame/video/mermaid.cpp28
-rw-r--r--src/mame/video/namcos21.cpp12
-rw-r--r--src/mame/video/namcos22.cpp59
-rw-r--r--src/mame/video/offtwall.cpp4
-rw-r--r--src/mame/video/quasar.cpp4
-rw-r--r--src/mame/video/rampart.cpp8
-rw-r--r--src/mame/video/realbrk.cpp435
-rw-r--r--src/mame/video/relief.cpp4
-rw-r--r--src/mame/video/rohga.cpp8
-rw-r--r--src/mame/video/shuuz.cpp4
-rw-r--r--src/mame/video/skullxbo.cpp6
-rw-r--r--src/mame/video/sprint2.cpp16
-rw-r--r--src/mame/video/sprint4.cpp16
-rw-r--r--src/mame/video/tank8.cpp4
-rw-r--r--src/mame/video/thunderj.cpp8
110 files changed, 1010 insertions, 1157 deletions
diff --git a/makefile b/makefile
index 89788aed12c..6c9664138f0 100644
--- a/makefile
+++ b/makefile
@@ -912,12 +912,12 @@ endif
ifeq ($(OS),windows)
ifeq (posix,$(SHELLTYPE))
GCC_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) -dumpversion 2> /dev/null)
-CLANG_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) --version 2> /dev/null| head -n 1 | grep clang | sed "s/^.*[^0-9]\([0-9]\+\.[0-9]\+\.[0-9]\+\).*$$/\1/" | head -n 1)
+CLANG_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) --version 2> /dev/null| head -n 1 | grep clang | sed "s/^.*[^0-9]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$$/\1/" | head -n 1)
PYTHON_AVAILABLE := $(shell $(PYTHON) --version > /dev/null 2>&1 && echo python)
GIT_AVAILABLE := $(shell git --version > /dev/null 2>&1 && echo git)
else
GCC_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) -dumpversion 2> NUL)
-CLANG_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) --version 2> NUL| head -n 1 | grep clang | sed "s/^.*[^0-9]\([0-9]\+\.[0-9]\+\.[0-9]\+\).*$$/\1/" | head -n 1)
+CLANG_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) --version 2> NUL| head -n 1 | grep clang | sed "s/^.*[^0-9]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$$/\1/" | head -n 1)
PYTHON_AVAILABLE := $(shell $(PYTHON) --version > NUL 2>&1 && echo python)
GIT_AVAILABLE := $(shell git --version > NUL 2>&1 && echo git)
endif
diff --git a/src/devices/video/poly.h b/src/devices/video/poly.h
index 3f1053e65c6..cda1c46dc3b 100644
--- a/src/devices/video/poly.h
+++ b/src/devices/video/poly.h
@@ -513,8 +513,8 @@ uint32_t poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::render_til
// clip coordinates
int32_t v1yclip = v1y;
int32_t v2yclip = v2y + ((m_flags & FLAG_INCLUDE_BOTTOM_EDGE) ? 1 : 0);
- v1yclip = std::max(v1yclip, cliprect.min_y);
- v2yclip = std::min(v2yclip, cliprect.max_y + 1);
+ v1yclip = std::max(v1yclip, cliprect.top());
+ v2yclip = std::min(v2yclip, cliprect.bottom() + 1);
if (v2yclip - v1yclip <= 0)
return 0;
@@ -558,10 +558,10 @@ uint32_t poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::render_til
istopx++;
// apply left/right clipping
- if (istartx < cliprect.min_x)
- istartx = cliprect.min_x;
- if (istopx > cliprect.max_x)
- istopx = cliprect.max_x + 1;
+ if (istartx < cliprect.left())
+ istartx = cliprect.left();
+ if (istopx > cliprect.right())
+ istopx = cliprect.right() + 1;
if (istartx >= istopx)
return 0;
@@ -658,8 +658,8 @@ uint32_t poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::render_tri
// clip coordinates
int32_t v1yclip = v1y;
int32_t v3yclip = v3y + ((m_flags & FLAG_INCLUDE_BOTTOM_EDGE) ? 1 : 0);
- v1yclip = std::max(v1yclip, cliprect.min_y);
- v3yclip = std::min(v3yclip, cliprect.max_y + 1);
+ v1yclip = std::max(v1yclip, cliprect.top());
+ v3yclip = std::min(v3yclip, cliprect.bottom() + 1);
if (v3yclip - v1yclip <= 0)
return 0;
@@ -772,10 +772,10 @@ uint32_t poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::render_tri
istopx++;
// apply left/right clipping
- if (istartx < cliprect.min_x)
- istartx = cliprect.min_x;
- if (istopx > cliprect.max_x)
- istopx = cliprect.max_x + 1;
+ if (istartx < cliprect.left())
+ istartx = cliprect.left();
+ if (istopx > cliprect.right())
+ istopx = cliprect.right() + 1;
// set the extent and update the total pixel count
if (istartx >= istopx)
@@ -848,8 +848,8 @@ template<typename _BaseType, class _ObjectData, int _MaxParams, int _MaxPolys>
uint32_t poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::render_triangle_custom(const rectangle &cliprect, render_delegate callback, int startscanline, int numscanlines, const extent_t *extents)
{
// clip coordinates
- int32_t v1yclip = std::max(startscanline, cliprect.min_y);
- int32_t v3yclip = std::min(startscanline + numscanlines, cliprect.max_y + 1);
+ int32_t v1yclip = std::max(startscanline, cliprect.top());
+ int32_t v3yclip = std::min(startscanline + numscanlines, cliprect.bottom() + 1);
if (v3yclip - v1yclip <= 0)
return 0;
@@ -883,14 +883,14 @@ uint32_t poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::render_tri
int32_t istartx = srcextent.startx, istopx = srcextent.stopx;
// apply left/right clipping
- if (istartx < cliprect.min_x)
- istartx = cliprect.min_x;
- if (istartx > cliprect.max_x)
- istartx = cliprect.max_x + 1;
- if (istopx < cliprect.min_x)
- istopx = cliprect.min_x;
- if (istopx > cliprect.max_x)
- istopx = cliprect.max_x + 1;
+ if (istartx < cliprect.left())
+ istartx = cliprect.left();
+ if (istartx > cliprect.right())
+ istartx = cliprect.right() + 1;
+ if (istopx < cliprect.left())
+ istopx = cliprect.left();
+ if (istopx > cliprect.right())
+ istopx = cliprect.right() + 1;
// set the extent and update the total pixel count
extent_t &extent = unit.extent[extnum];
@@ -956,8 +956,8 @@ uint32_t poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::render_pol
// clip coordinates
int32_t minyclip = miny;
int32_t maxyclip = maxy + ((m_flags & FLAG_INCLUDE_BOTTOM_EDGE) ? 1 : 0);
- minyclip = std::max(minyclip, cliprect.min_y);
- maxyclip = std::min(maxyclip, cliprect.max_y + 1);
+ minyclip = std::max(minyclip, cliprect.top());
+ maxyclip = std::min(maxyclip, cliprect.bottom() + 1);
if (maxyclip - minyclip <= 0)
return 0;
@@ -1092,14 +1092,14 @@ uint32_t poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::render_pol
istopx++;
// apply left/right clipping
- if (istartx < cliprect.min_x)
+ if (istartx < cliprect.left())
{
for (int paramnum = 0; paramnum < paramcount; paramnum++)
- extent.param[paramnum].start += (cliprect.min_x - istartx) * extent.param[paramnum].dpdx;
- istartx = cliprect.min_x;
+ extent.param[paramnum].start += (cliprect.left() - istartx) * extent.param[paramnum].dpdx;
+ istartx = cliprect.left();
}
- if (istopx > cliprect.max_x)
- istopx = cliprect.max_x + 1;
+ if (istopx > cliprect.right())
+ istopx = cliprect.right() + 1;
// set the extent and update the total pixel count
if (istartx >= istopx)
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;
diff --git a/src/devices/video/upd7220.cpp b/src/devices/video/upd7220.cpp
index f7174ae4543..16bbc507a5a 100644
--- a/src/devices/video/upd7220.cpp
+++ b/src/devices/video/upd7220.cpp
@@ -408,15 +408,14 @@ inline void upd7220_device::recompute_parameters()
attoseconds_t refresh = HZ_TO_ATTOSECONDS(clock() * 8) * horiz_pix_total * vert_pix_total;
- rectangle visarea;
-
- visarea.min_x = 0; //(m_hs + m_hbp) * 8;
- visarea.min_y = m_vbp; //m_vs + m_vbp;
- visarea.max_x = m_aw * horiz_mult - 1;//horiz_pix_total - (m_hfp * 8) - 1;
- visarea.max_y = m_al * vert_mult + m_vbp - 1;//vert_pix_total - m_vfp - 1;
+ rectangle visarea(
+ 0, //(m_hs + m_hbp) * 8;
+ m_aw * horiz_mult - 1,//horiz_pix_total - (m_hfp * 8) - 1;
+ m_vbp, //m_vs + m_vbp;
+ m_al * vert_mult + m_vbp - 1);//vert_pix_total - m_vfp - 1;
LOG("uPD7220 Screen: %u x %u @ %f Hz\n", horiz_pix_total, vert_pix_total, 1 / ATTOSECONDS_TO_DOUBLE(refresh));
- LOG("Visible Area: (%u, %u) - (%u, %u)\n", visarea.min_x, visarea.min_y, visarea.max_x, visarea.max_y);
+ LOG("Visible Area: (%u, %u) - (%u, %u)\n", visarea.left(), visarea.top(), visarea.right(), visarea.bottom());
LOG("%d %d %d %d %d\n",m_hs,m_hbp,m_aw,m_hfp,m_pitch);
LOG("%d %d %d %d\n",m_vs,m_vbp,m_al,m_vfp);
diff --git a/src/devices/video/vic4567.cpp b/src/devices/video/vic4567.cpp
index 8154f6a9458..14e22461c23 100644
--- a/src/devices/video/vic4567.cpp
+++ b/src/devices/video/vic4567.cpp
@@ -1906,25 +1906,25 @@ void vic3_device::draw_bitplanes()
if (XPOS > 0)
{
- vis.set(0, XPOS - 1, 0, visarea.max_y);
+ vis.set(0, XPOS - 1, 0, visarea.bottom());
m_bitmap->fill(FRAMECOLOR, vis);
}
- if (XPOS + VIC3_BITPLANES_WIDTH < visarea.max_x)
+ if (XPOS + VIC3_BITPLANES_WIDTH < visarea.right())
{
- vis.set(XPOS + VIC3_BITPLANES_WIDTH, visarea.max_x, 0, visarea.max_y);
+ vis.set(XPOS + VIC3_BITPLANES_WIDTH, visarea.right(), 0, visarea.bottom());
m_bitmap->fill(FRAMECOLOR, vis);
}
if (YPOS > 0)
{
- vis.set(0, visarea.max_x, 0, YPOS - 1);
+ vis.set(0, visarea.right(), 0, YPOS - 1);
m_bitmap->fill(FRAMECOLOR, vis);
}
- if (YPOS + VIC3_LINES < visarea.max_y)
+ if (YPOS + VIC3_LINES < visarea.bottom())
{
- vis.set(0, visarea.max_x, YPOS + VIC3_LINES, visarea.max_y);
+ vis.set(0, visarea.right(), YPOS + VIC3_LINES, visarea.bottom());
m_bitmap->fill(FRAMECOLOR, vis);
}
}
diff --git a/src/emu/drawgfx.cpp b/src/emu/drawgfx.cpp
index 8c86de6ad9a..3a00569e32c 100644
--- a/src/emu/drawgfx.cpp
+++ b/src/emu/drawgfx.cpp
@@ -2014,8 +2014,7 @@ static inline void copyscrollbitmap_trans_common(_BitmapClass &dest, const _Bitm
for (s32 sx = xscroll - src.width(); sx < dest.width(); sx += src.width())
{
// compute the cliprect for this group
- subclip.min_x = col * colwidth + sx;
- subclip.max_x = (col + groupcols) * colwidth - 1 + sx;
+ subclip.setx(col * colwidth + sx, (col + groupcols) * colwidth - 1 + sx);
subclip &= cliprect;
// iterate over all portions of the scroll that overlap the destination
@@ -2051,8 +2050,7 @@ static inline void copyscrollbitmap_trans_common(_BitmapClass &dest, const _Bitm
for (s32 sy = yscroll - src.height(); sy < dest.height(); sy += src.height())
{
// compute the cliprect for this group
- subclip.min_y = row * rowheight + sy;
- subclip.max_y = (row + grouprows) * rowheight - 1 + sy;
+ subclip.sety(row * rowheight + sy, (row + grouprows) * rowheight - 1 + sy);
subclip &= cliprect;
// iterate over all portions of the scroll that overlap the destination
diff --git a/src/emu/drawgfxm.h b/src/emu/drawgfxm.h
index 1bef8e15237..f4566e9b59f 100644
--- a/src/emu/drawgfxm.h
+++ b/src/emu/drawgfxm.h
@@ -419,37 +419,37 @@ do {
\
/* compute final pixel in X and exit if we are entirely clipped */ \
destendx = destx + width() - 1; \
- if (destx > cliprect.max_x || destendx < cliprect.min_x) \
+ if (destx > cliprect.right() || destendx < cliprect.left()) \
break; \
\
/* apply left clip */ \
srcx = 0; \
- if (destx < cliprect.min_x) \
+ if (destx < cliprect.left()) \
{ \
- srcx = cliprect.min_x - destx; \
- destx = cliprect.min_x; \
+ srcx = cliprect.left() - destx; \
+ destx = cliprect.left(); \
} \
\
/* apply right clip */ \
- if (destendx > cliprect.max_x) \
- destendx = cliprect.max_x; \
+ if (destendx > cliprect.right()) \
+ destendx = cliprect.right(); \
\
/* compute final pixel in Y and exit if we are entirely clipped */ \
destendy = desty + height() - 1; \
- if (desty > cliprect.max_y || destendy < cliprect.min_y) \
+ if (desty > cliprect.bottom() || destendy < cliprect.top()) \
break; \
\
/* apply top clip */ \
srcy = 0; \
- if (desty < cliprect.min_y) \
+ if (desty < cliprect.top()) \
{ \
- srcy = cliprect.min_y - desty; \
- desty = cliprect.min_y; \
+ srcy = cliprect.top() - desty; \
+ desty = cliprect.top(); \
} \
\
/* apply bottom clip */ \
- if (destendy > cliprect.max_y) \
- destendy = cliprect.max_y; \
+ if (destendy > cliprect.bottom()) \
+ destendy = cliprect.bottom(); \
\
/* apply X flipping */ \
if (flipx) \
@@ -601,24 +601,24 @@ do {
\
/* 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) \
+ if (destx > cliprect.right() || destendx < cliprect.left()) \
break; \
\
/* apply left clip */ \
srcx = 0; \
- if (destx < cliprect.min_x) \
+ if (destx < cliprect.left()) \
{ \
- srcx = (cliprect.min_x - destx) * dx; \
- destx = cliprect.min_x; \
+ srcx = (cliprect.left() - destx) * dx; \
+ destx = cliprect.left(); \
} \
\
/* apply right clip */ \
- if (destendx > cliprect.max_x) \
- destendx = cliprect.max_x; \
+ if (destendx > cliprect.right()) \
+ destendx = cliprect.right(); \
\
/* 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) \
+ if (desty > cliprect.bottom() || destendy < cliprect.top()) \
{ \
g_profiler.stop(); \
return; \
@@ -626,15 +626,15 @@ do {
\
/* apply top clip */ \
srcy = 0; \
- if (desty < cliprect.min_y) \
+ if (desty < cliprect.top()) \
{ \
- srcy = (cliprect.min_y - desty) * dy; \
- desty = cliprect.min_y; \
+ srcy = (cliprect.top() - desty) * dy; \
+ desty = cliprect.top(); \
} \
\
/* apply bottom clip */ \
- if (destendy > cliprect.max_y) \
- destendy = cliprect.max_y; \
+ if (destendy > cliprect.bottom()) \
+ destendy = cliprect.bottom(); \
\
/* apply X flipping */ \
if (flipx) \
@@ -740,37 +740,37 @@ do {
\
/* 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) \
+ if (destx > cliprect.right() || destendx < cliprect.left()) \
break; \
\
/* apply left clip */ \
srcx = 0; \
- if (destx < cliprect.min_x) \
+ if (destx < cliprect.left()) \
{ \
- srcx = cliprect.min_x - destx; \
- destx = cliprect.min_x; \
+ srcx = cliprect.left() - destx; \
+ destx = cliprect.left(); \
} \
\
/* apply right clip */ \
- if (destendx > cliprect.max_x) \
- destendx = cliprect.max_x; \
+ if (destendx > cliprect.right()) \
+ destendx = cliprect.right(); \
\
/* 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) \
+ if (desty > cliprect.bottom() || destendy < cliprect.top()) \
break; \
\
/* apply top clip */ \
srcy = 0; \
- if (desty < cliprect.min_y) \
+ if (desty < cliprect.top()) \
{ \
- srcy = cliprect.min_y - desty; \
- desty = cliprect.min_y; \
+ srcy = cliprect.top() - desty; \
+ desty = cliprect.top(); \
} \
\
/* apply bottom clip */ \
- if (destendy > cliprect.max_y) \
- destendy = cliprect.max_y; \
+ if (destendy > cliprect.bottom()) \
+ destendy = cliprect.bottom(); \
\
/* apply X flipping */ \
if (flipx) \
@@ -912,8 +912,8 @@ do {
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; \
+ startx += cliprect.left() * incxx + cliprect.top() * incyx; \
+ starty += cliprect.left() * incxy + cliprect.top() * incyy; \
\
/* compute how many blocks of 4 pixels we have */ \
numblocks = cliprect.width() / 4; \
@@ -926,10 +926,10 @@ do {
if (!wraparound) \
{ \
/* iterate over pixels in Y */ \
- for (cury = cliprect.min_y; cury <= cliprect.max_y; cury++) \
+ for (cury = cliprect.top(); cury <= cliprect.bottom(); cury++) \
{ \
- PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, cliprect.min_x); \
- PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, cliprect.min_x); \
+ PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, cliprect.left()); \
+ PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, cliprect.left()); \
const PIXEL_TYPE *srcptr; \
s32 srcx = startx; \
s32 srcy = starty; \
@@ -987,10 +987,10 @@ do {
starty &= srcfixheight; \
\
/* iterate over pixels in Y */ \
- for (cury = cliprect.min_y; cury <= cliprect.max_y; cury++) \
+ for (cury = cliprect.top(); cury <= cliprect.bottom(); cury++) \
{ \
- PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, cliprect.min_x); \
- PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, cliprect.min_x); \
+ PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, cliprect.left()); \
+ PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, cliprect.left()); \
const PIXEL_TYPE *srcptr = &src.pixt<PIXEL_TYPE>(starty >> 16); \
s32 srcx = startx; \
\
@@ -1034,10 +1034,10 @@ do {
if (!wraparound) \
{ \
/* iterate over pixels in Y */ \
- for (cury = cliprect.min_y; cury <= cliprect.max_y; cury++) \
+ for (cury = cliprect.top(); cury <= cliprect.bottom(); cury++) \
{ \
- PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, cliprect.min_x); \
- PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, cliprect.min_x); \
+ PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, cliprect.left()); \
+ PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, cliprect.left()); \
const PIXEL_TYPE *srcptr; \
s32 srcx = startx; \
s32 srcy = starty; \
@@ -1110,10 +1110,10 @@ do {
starty &= srcfixheight; \
\
/* iterate over pixels in Y */ \
- for (cury = cliprect.min_y; cury <= cliprect.max_y; cury++) \
+ for (cury = cliprect.top(); cury <= cliprect.bottom(); cury++) \
{ \
- PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, cliprect.min_x); \
- PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, cliprect.min_x); \
+ PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, cliprect.left()); \
+ PIXEL_TYPE *destptr = &dest.pixt<PIXEL_TYPE>(cury, cliprect.left()); \
const PIXEL_TYPE *srcptr; \
s32 srcx = startx; \
s32 srcy = starty; \
diff --git a/src/emu/render.cpp b/src/emu/render.cpp
index a65a47e2cf6..243b118d81e 100644
--- a/src/emu/render.cpp
+++ b/src/emu/render.cpp
@@ -457,7 +457,7 @@ void render_texture::get_scaled(u32 dwidth, u32 dheight, render_texinfo &texinfo
// add a reference and set up the source bitmap
primlist.add_reference(m_bitmap);
- texinfo.base = m_bitmap->raw_pixptr(m_sbounds.min_y, m_sbounds.min_x);
+ texinfo.base = m_bitmap->raw_pixptr(m_sbounds.top(), m_sbounds.left());
texinfo.rowpixels = m_bitmap->rowpixels();
texinfo.width = swidth;
texinfo.height = sheight;
diff --git a/src/emu/rendfont.cpp b/src/emu/rendfont.cpp
index 5e7f0329fd2..a71a119f75f 100644
--- a/src/emu/rendfont.cpp
+++ b/src/emu/rendfont.cpp
@@ -524,10 +524,9 @@ inline render_font::glyph &render_font::get_char(char32_t chnum)
gl.bmheight = int(glyph_ch.bmheight * scale + 0.5f);
gl.bitmap.allocate(gl.bmwidth, gl.bmheight);
- rectangle clip;
- clip.min_x = clip.min_y = 0;
- clip.max_x = glyph_ch.bitmap.width() - 1;
- clip.max_y = glyph_ch.bitmap.height() - 1;
+ rectangle clip(
+ 0, glyph_ch.bitmap.width() - 1,
+ 0, glyph_ch.bitmap.height() - 1);
render_texture::hq_scale(gl.bitmap, glyph_ch.bitmap, clip, nullptr);
/* wrap a texture around the bitmap */
diff --git a/src/emu/rendlay.cpp b/src/emu/rendlay.cpp
index 2c4057501d6..1d5dd7eadd5 100644
--- a/src/emu/rendlay.cpp
+++ b/src/emu/rendlay.cpp
@@ -1139,11 +1139,11 @@ void layout_element::element_scale(bitmap_argb32 &dest, bitmap_argb32 &source, c
if (curcomp->state() == -1 || curcomp->state() == elemtex->m_state)
{
// get the local scaled bounds
- rectangle bounds;
- bounds.min_x = render_round_nearest(curcomp->bounds().x0 * dest.width());
- bounds.min_y = render_round_nearest(curcomp->bounds().y0 * dest.height());
- bounds.max_x = render_round_nearest(curcomp->bounds().x1 * dest.width());
- bounds.max_y = render_round_nearest(curcomp->bounds().y1 * dest.height());
+ rectangle bounds(
+ render_round_nearest(curcomp->bounds().x0 * dest.width()),
+ render_round_nearest(curcomp->bounds().x1 * dest.width()),
+ render_round_nearest(curcomp->bounds().y0 * dest.height()),
+ render_round_nearest(curcomp->bounds().y1 * dest.height()));
bounds &= dest.cliprect();
// based on the component type, add to the texture
@@ -1255,9 +1255,9 @@ protected:
u32 const inva = (1.0f - color().a) * 255.0f;
// iterate over X and Y
- for (u32 y = bounds.min_y; y <= bounds.max_y; y++)
+ for (u32 y = bounds.top(); y <= bounds.bottom(); y++)
{
- for (u32 x = bounds.min_x; x <= bounds.max_x; x++)
+ for (u32 x = bounds.left(); x <= bounds.right(); x++)
{
u32 finalr = r;
u32 finalg = g;
@@ -1308,7 +1308,7 @@ protected:
float const ooyradius2 = 1.0f / (yradius * yradius);
// iterate over y
- for (u32 y = bounds.min_y; y <= bounds.max_y; y++)
+ for (u32 y = bounds.top(); y <= bounds.bottom(); y++)
{
float ycoord = ycenter - ((float)y + 0.5f);
float xval = xradius * sqrtf(1.0f - (ycoord * ycoord) * ooyradius2);
@@ -2157,23 +2157,23 @@ protected:
if (m_reelreversed==1)
{
- basey = bounds.min_y + ((use_state)*(ourheight/num_shown)/(max_state_used/m_numstops)) + curry;
+ basey = bounds.top() + ((use_state)*(ourheight/num_shown)/(max_state_used/m_numstops)) + curry;
}
else
{
- basey = bounds.min_y - ((use_state)*(ourheight/num_shown)/(max_state_used/m_numstops)) + curry;
+ basey = bounds.top() - ((use_state)*(ourheight/num_shown)/(max_state_used/m_numstops)) + curry;
}
// wrap around...
- if (basey < bounds.min_y)
+ if (basey < bounds.top())
basey += ((max_state_used)*(ourheight/num_shown)/(max_state_used/m_numstops));
- if (basey > bounds.max_y)
+ if (basey > bounds.bottom())
basey -= ((max_state_used)*(ourheight/num_shown)/(max_state_used/m_numstops));
int endpos = basey+ourheight/num_shown;
// only render the symbol / text if it's atually in view because the code is SLOW
- if ((endpos >= bounds.min_y) && (basey <= bounds.max_y))
+ if ((endpos >= bounds.top()) && (basey <= bounds.bottom()))
{
while (1)
{
@@ -2184,7 +2184,7 @@ protected:
}
s32 curx;
- curx = bounds.min_x + (bounds.width() - width) / 2;
+ curx = bounds.left() + (bounds.width() - width) / 2;
if (m_file[fruit])
if (!m_bitmap[fruit].valid())
@@ -2202,14 +2202,14 @@ protected:
{
int effy = basey + y;
- if (effy >= bounds.min_y && effy <= bounds.max_y)
+ if (effy >= bounds.top() && effy <= bounds.bottom())
{
u32 *src = &tempbitmap2.pix32(y);
u32 *d = &dest.pix32(effy);
for (int x = 0; x < dest.width(); x++)
{
int effx = x;
- if (effx >= bounds.min_x && effx <= bounds.max_x)
+ if (effx >= bounds.left() && effx <= bounds.right())
{
u32 spix = rgb_t(src[x]).a();
if (spix != 0)
@@ -2249,14 +2249,14 @@ protected:
{
int effy = basey + y;
- if (effy >= bounds.min_y && effy <= bounds.max_y)
+ if (effy >= bounds.top() && effy <= bounds.bottom())
{
u32 *src = &tempbitmap.pix32(y);
u32 *d = &dest.pix32(effy);
for (int x = 0; x < chbounds.width(); x++)
{
- int effx = curx + x + chbounds.min_x;
- if (effx >= bounds.min_x && effx <= bounds.max_x)
+ int effx = curx + x + chbounds.left();
+ if (effx >= bounds.left() && effx <= bounds.right())
{
u32 spix = rgb_t(src[x]).a();
if (spix != 0)
@@ -2324,15 +2324,15 @@ private:
}
// wrap around...
- if (basex < bounds.min_x)
+ if (basex < bounds.left())
basex += ((max_state_used)*(ourwidth/num_shown)/(max_state_used/m_numstops));
- if (basex > bounds.max_x)
+ if (basex > bounds.right())
basex -= ((max_state_used)*(ourwidth/num_shown)/(max_state_used/m_numstops));
int endpos = basex+(ourwidth/num_shown);
// only render the symbol / text if it's atually in view because the code is SLOW
- if ((endpos >= bounds.min_x) && (basex <= bounds.max_x))
+ if ((endpos >= bounds.left()) && (basex <= bounds.right()))
{
while (1)
{
@@ -2343,7 +2343,7 @@ private:
}
s32 curx;
- curx = bounds.min_x;
+ curx = bounds.left();
if (m_file[fruit])
if (!m_bitmap[fruit].valid())
@@ -2361,14 +2361,14 @@ private:
{
int effy = y;
- if (effy >= bounds.min_y && effy <= bounds.max_y)
+ if (effy >= bounds.top() && effy <= bounds.bottom())
{
u32 *src = &tempbitmap2.pix32(y);
u32 *d = &dest.pix32(effy);
for (int x = 0; x < ourwidth/num_shown; x++)
{
int effx = basex + x;
- if (effx >= bounds.min_x && effx <= bounds.max_x)
+ if (effx >= bounds.left() && effx <= bounds.right())
{
u32 spix = rgb_t(src[x]).a();
if (spix != 0)
@@ -2410,14 +2410,14 @@ private:
{
int effy = y;
- if (effy >= bounds.min_y && effy <= bounds.max_y)
+ if (effy >= bounds.top() && effy <= bounds.bottom())
{
u32 *src = &tempbitmap.pix32(y);
u32 *d = &dest.pix32(effy);
for (int x = 0; x < chbounds.width(); x++)
{
int effx = basex + curx + x;
- if (effx >= bounds.min_x && effx <= bounds.max_x)
+ if (effx >= bounds.left() && effx <= bounds.right())
{
u32 spix = rgb_t(src[x]).a();
if (spix != 0)
@@ -2618,17 +2618,17 @@ void layout_element::component::draw_text(render_font &font, bitmap_argb32 &dest
{
// left
case 1:
- curx = bounds.min_x;
+ curx = bounds.left();
break;
// right
case 2:
- curx = bounds.max_x - width;
+ curx = bounds.right() - width;
break;
// default to center
default:
- curx = bounds.min_x + (bounds.width() - width) / 2;
+ curx = bounds.left() + (bounds.width() - width) / 2;
break;
}
@@ -2656,15 +2656,15 @@ void layout_element::component::draw_text(render_font &font, bitmap_argb32 &dest
// copy the data into the target
for (int y = 0; y < chbounds.height(); y++)
{
- int effy = bounds.min_y + y;
- if (effy >= bounds.min_y && effy <= bounds.max_y)
+ int effy = bounds.top() + y;
+ if (effy >= bounds.top() && effy <= bounds.bottom())
{
u32 *src = &tempbitmap.pix32(y);
u32 *d = &dest.pix32(effy);
for (int x = 0; x < chbounds.width(); x++)
{
- int effx = curx + x + chbounds.min_x;
- if (effx >= bounds.min_x && effx <= bounds.max_x)
+ int effx = curx + x + chbounds.left();
+ if (effx >= bounds.left() && effx <= bounds.right())
{
u32 spix = rgb_t(src[x]).a();
if (spix != 0)
diff --git a/src/emu/screen.cpp b/src/emu/screen.cpp
index 26ef04c43ce..a3f762071b2 100644
--- a/src/emu/screen.cpp
+++ b/src/emu/screen.cpp
@@ -615,7 +615,7 @@ void screen_device::device_validity_check(validity_checker &valid) const
// sanity check display area
if (m_type != SCREEN_TYPE_VECTOR && m_type != SCREEN_TYPE_SVG)
{
- if (m_visarea.empty() || m_visarea.max_x >= m_width || m_visarea.max_y >= m_height)
+ if (m_visarea.empty() || m_visarea.right() >= m_width || m_visarea.bottom() >= m_height)
osd_printf_error("Invalid display area\n");
// sanity check screen formats
@@ -886,8 +886,8 @@ void screen_device::device_timer(emu_timer &timer, device_timer_id id, int param
// compute the next visible scanline
param++;
- if (param > m_visarea.max_y)
- param = m_visarea.min_y;
+ if (param > m_visarea.bottom())
+ param = m_visarea.top();
m_scanline_timer->adjust(time_until_pos(param), param);
break;
}
@@ -903,12 +903,12 @@ void screen_device::configure(int width, int height, const rectangle &visarea, a
// validate arguments
assert(width > 0);
assert(height > 0);
- assert(visarea.min_x >= 0);
- assert(visarea.min_y >= 0);
-// assert(visarea.max_x < width);
-// assert(visarea.max_y < height);
- assert(m_type == SCREEN_TYPE_VECTOR || m_type == SCREEN_TYPE_SVG || visarea.min_x < width);
- assert(m_type == SCREEN_TYPE_VECTOR || m_type == SCREEN_TYPE_SVG || visarea.min_y < height);
+ assert(visarea.left() >= 0);
+ assert(visarea.top() >= 0);
+// assert(visarea.right() < width);
+// assert(visarea.bottom() < height);
+ assert(m_type == SCREEN_TYPE_VECTOR || m_type == SCREEN_TYPE_SVG || visarea.left() < width);
+ assert(m_type == SCREEN_TYPE_VECTOR || m_type == SCREEN_TYPE_SVG || visarea.top() < height);
assert(frame_period > 0);
// fill in the new parameters
@@ -973,9 +973,9 @@ void screen_device::reset_origin(int beamy, int beamx)
else
m_scanline0_timer->adjust(time_until_pos(0));
- // if we are resetting relative to (visarea.max_y + 1, 0) == VBLANK start,
+ // if we are resetting relative to (visarea.bottom() + 1, 0) == VBLANK start,
// call the VBLANK start timer now; otherwise, adjust it for the future
- if (beamy == ((m_visarea.max_y + 1) % m_height) && beamx == 0)
+ if (beamy == ((m_visarea.bottom() + 1) % m_height) && beamx == 0)
vblank_begin();
else
m_vblank_begin_timer->adjust(time_until_vblank_start());
@@ -994,8 +994,8 @@ void screen_device::realloc_screen_bitmaps()
return;
// determine effective size to allocate
- s32 effwidth = std::max(m_width, m_visarea.max_x + 1);
- s32 effheight = std::max(m_height, m_visarea.max_y + 1);
+ s32 effwidth = std::max(m_width, m_visarea.right() + 1);
+ s32 effheight = std::max(m_height, m_visarea.bottom() + 1);
// reize all registered screen bitmaps
for (auto &item : m_auto_bitmap_list)
@@ -1063,21 +1063,20 @@ bool screen_device::update_partial(int scanline)
}
// set the range of scanlines to render
- rectangle clip = m_visarea;
- if (m_last_partial_scan > clip.min_y)
- clip.min_y = m_last_partial_scan;
- if (scanline < clip.max_y)
- clip.max_y = scanline;
+ rectangle clip(m_visarea);
+ clip.sety(
+ (std::max)(clip.top(), m_last_partial_scan),
+ (std::min)(clip.bottom(), scanline));
// skip if entirely outside of visible area
- if (clip.min_y > clip.max_y)
+ if (clip.top() > clip.bottom())
{
LOG_PARTIAL_UPDATES(("skipped because outside of visible area\n"));
return false;
}
// otherwise, render
- LOG_PARTIAL_UPDATES(("updating %d-%d\n", clip.min_y, clip.max_y));
+ LOG_PARTIAL_UPDATES(("updating %d-%d\n", clip.top(), clip.bottom()));
g_profiler.start(PROFILER_VIDEO);
u32 flags;
@@ -1137,7 +1136,7 @@ void screen_device::update_now()
int current_hpos = hpos();
rectangle clip = m_visarea;
- LOG_PARTIAL_UPDATES(("update_now(): Y=%d, X=%d, last partial %d, partial hpos %d (vis %d %d)\n", current_vpos, current_hpos, m_last_partial_scan, m_partial_scan_hpos, m_visarea.max_x, m_visarea.max_y));
+ LOG_PARTIAL_UPDATES(("update_now(): Y=%d, X=%d, last partial %d, partial hpos %d (vis %d %d)\n", current_vpos, current_hpos, m_last_partial_scan, m_partial_scan_hpos, m_visarea.right(), m_visarea.bottom()));
// start off by doing a partial update up to the line before us, in case that was necessary
if (current_vpos > m_last_partial_scan)
@@ -1154,17 +1153,14 @@ void screen_device::update_now()
// now finish the previous partial scanline
int scanline = current_vpos - 1;
- if (m_partial_scan_hpos > clip.min_x)
- clip.min_x = m_partial_scan_hpos;
- if (current_hpos < clip.max_x)
- clip.max_x = current_hpos;
- if (m_last_partial_scan > clip.min_y)
- clip.min_y = m_last_partial_scan;
- if (scanline < clip.max_y)
- clip.max_y = scanline;
+ clip.set(
+ (std::max)(clip.left(), m_partial_scan_hpos),
+ (std::min)(clip.right(), current_hpos),
+ (std::max)(clip.top(), m_last_partial_scan),
+ (std::min)(clip.bottom(), scanline));
// if there's something to draw, do it
- if ((clip.min_x <= clip.max_x) && (clip.min_y <= clip.max_y))
+ if (!clip.empty())
{
g_profiler.start(PROFILER_VIDEO);
@@ -1191,21 +1187,18 @@ void screen_device::update_now()
// now draw this partial scanline
clip = m_visarea;
- if (m_partial_scan_hpos > clip.min_x)
- clip.min_x = m_partial_scan_hpos;
- if (current_hpos < clip.max_x)
- clip.max_x = current_hpos;
- if (current_vpos > clip.min_y)
- clip.min_y = current_vpos;
- if (current_vpos < clip.max_y)
- clip.max_y = current_vpos;
+ clip.set(
+ (std::max)(clip.left(), m_partial_scan_hpos),
+ (std::min)(clip.right(), current_hpos),
+ (std::max)(clip.top(), current_vpos),
+ (std::min)(clip.bottom(), current_vpos));
// and if there's something to draw, do it
- if ((clip.min_x <= clip.max_x) && (clip.min_y <= clip.max_y))
+ if (!clip.empty())
{
g_profiler.start(PROFILER_VIDEO);
- LOG_PARTIAL_UPDATES(("doing scanline partial draw: Y %d X %d-%d\n", clip.max_y, clip.min_x, clip.max_x));
+ LOG_PARTIAL_UPDATES(("doing scanline partial draw: Y %d X %d-%d\n", clip.bottom(), clip.left(), clip.right()));
u32 flags;
screen_bitmap &curbitmap = m_bitmap[m_curbitmap];
@@ -1227,7 +1220,7 @@ void screen_device::update_now()
m_last_partial_scan = current_vpos;
// if we completed the line, mark it so
- if (current_hpos >= m_visarea.max_x)
+ if (current_hpos >= m_visarea.right())
{
m_partial_scan_hpos = 0;
m_last_partial_scan = current_vpos + 1;
@@ -1267,7 +1260,7 @@ int screen_device::vpos() const
vpos = delta / m_scantime;
// adjust for the fact that VBLANK starts at the bottom of the visible area
- return (m_visarea.max_y + 1 + vpos) % m_height;
+ return (m_visarea.bottom() + 1 + vpos) % m_height;
}
@@ -1307,7 +1300,7 @@ attotime screen_device::time_until_pos(int vpos, int hpos) const
assert(hpos >= 0);
// since we measure time relative to VBLANK, compute the scanline offset from VBLANK
- vpos += m_height - (m_visarea.max_y + 1);
+ vpos += m_height - (m_visarea.bottom() + 1);
vpos %= m_height;
// compute the delta for the given X,Y position
@@ -1545,11 +1538,11 @@ void screen_device::finalize_burnin()
return;
// compute the scaled visible region
- rectangle scaledvis;
- scaledvis.min_x = m_visarea.min_x * m_burnin.width() / m_width;
- scaledvis.max_x = m_visarea.max_x * m_burnin.width() / m_width;
- scaledvis.min_y = m_visarea.min_y * m_burnin.height() / m_height;
- scaledvis.max_y = m_visarea.max_y * m_burnin.height() / m_height;
+ rectangle scaledvis(
+ m_visarea.left() * m_burnin.width() / m_width,
+ m_visarea.right() * m_burnin.width() / m_width,
+ m_visarea.top() * m_burnin.height() / m_height,
+ m_visarea.bottom() * m_burnin.height() / m_height);
// wrap a bitmap around the memregion we care about
bitmap_argb32 finalmap(scaledvis.width(), scaledvis.height());
diff --git a/src/emu/screen.h b/src/emu/screen.h
index 4d0fddf17ef..45374fef1e7 100644
--- a/src/emu/screen.h
+++ b/src/emu/screen.h
@@ -279,11 +279,11 @@ public:
int vpos() const;
int hpos() const;
DECLARE_READ_LINE_MEMBER(vblank) const { return (machine().time() < m_vblank_end_time) ? 1 : 0; }
- DECLARE_READ_LINE_MEMBER(hblank) const { int const curpos = hpos(); return (curpos < m_visarea.min_x || curpos > m_visarea.max_x) ? 1 : 0; }
+ DECLARE_READ_LINE_MEMBER(hblank) const { int const curpos = hpos(); return (curpos < m_visarea.left() || curpos > m_visarea.right()) ? 1 : 0; }
// timing
attotime time_until_pos(int vpos, int hpos = 0) const;
- attotime time_until_vblank_start() const { return time_until_pos(m_visarea.max_y + 1); }
+ attotime time_until_vblank_start() const { return time_until_pos(m_visarea.bottom() + 1); }
attotime time_until_vblank_end() const;
attotime time_until_update() const { return (m_video_attributes & VIDEO_UPDATE_AFTER_VBLANK) ? time_until_vblank_end() : time_until_vblank_start(); }
attotime scan_period() const { return attotime(0, m_scantime); }
diff --git a/src/emu/tilemap.cpp b/src/emu/tilemap.cpp
index 0b7b748a494..9425ee88c16 100644
--- a/src/emu/tilemap.cpp
+++ b/src/emu/tilemap.cpp
@@ -953,8 +953,8 @@ g_profiler.start(PROFILER_TILEMAP_DRAW);
// flip the tilemap around the center of the visible area
rectangle visarea = screen.visible_area();
- u32 width = visarea.min_x + visarea.max_x + 1;
- u32 height = visarea.min_y + visarea.max_y + 1;
+ u32 width = visarea.left() + visarea.right() + 1;
+ u32 height = visarea.top() + visarea.bottom() + 1;
// XY scrolling playfield
if (m_scrollrows == 1 && m_scrollcols == 1)
@@ -962,8 +962,8 @@ g_profiler.start(PROFILER_TILEMAP_DRAW);
// iterate to handle wraparound
int scrollx = effective_rowscroll(0, width);
int scrolly = effective_colscroll(0, height);
- for (int ypos = scrolly - m_height; ypos <= blit.cliprect.max_y; ypos += m_height)
- for (int xpos = scrollx - m_width; xpos <= blit.cliprect.max_x; xpos += m_width)
+ for (int ypos = scrolly - m_height; ypos <= blit.cliprect.bottom(); ypos += m_height)
+ for (int xpos = scrollx - m_width; xpos <= blit.cliprect.right(); xpos += m_width)
draw_instance(screen, dest, blit, xpos, ypos);
}
@@ -975,10 +975,10 @@ g_profiler.start(PROFILER_TILEMAP_DRAW);
// iterate over Y to handle wraparound
int rowheight = m_height / m_scrollrows;
int scrolly = effective_colscroll(0, height);
- for (int ypos = scrolly - m_height; ypos <= original_cliprect.max_y; ypos += m_height)
+ for (int ypos = scrolly - m_height; ypos <= original_cliprect.bottom(); ypos += m_height)
{
- int const firstrow = std::max((original_cliprect.min_y - ypos) / rowheight, 0);
- int const lastrow = std::min((original_cliprect.max_y - ypos) / rowheight, s32(m_scrollrows) - 1);
+ int const firstrow = std::max((original_cliprect.top() - ypos) / rowheight, 0);
+ int const lastrow = std::min((original_cliprect.bottom() - ypos) / rowheight, s32(m_scrollrows) - 1);
// iterate over rows in the tilemap
int nextrow;
@@ -995,12 +995,11 @@ g_profiler.start(PROFILER_TILEMAP_DRAW);
continue;
// update the cliprect just for this set of rows
- blit.cliprect.min_y = currow * rowheight + ypos;
- blit.cliprect.max_y = nextrow * rowheight - 1 + ypos;
+ blit.cliprect.sety(currow * rowheight + ypos, nextrow * rowheight - 1 + ypos);
blit.cliprect &= original_cliprect;
// iterate over X to handle wraparound
- for (int xpos = scrollx - m_width; xpos <= original_cliprect.max_x; xpos += m_width)
+ for (int xpos = scrollx - m_width; xpos <= original_cliprect.right(); xpos += m_width)
draw_instance(screen, dest, blit, xpos, ypos);
}
}
@@ -1028,15 +1027,14 @@ g_profiler.start(PROFILER_TILEMAP_DRAW);
continue;
// iterate over X to handle wraparound
- for (int xpos = scrollx - m_width; xpos <= original_cliprect.max_x; xpos += m_width)
+ for (int xpos = scrollx - m_width; xpos <= original_cliprect.right(); xpos += m_width)
{
// update the cliprect just for this set of columns
- blit.cliprect.min_x = curcol * colwidth + xpos;
- blit.cliprect.max_x = nextcol * colwidth - 1 + xpos;
+ blit.cliprect.setx(curcol * colwidth + xpos, nextcol * colwidth - 1 + xpos);
blit.cliprect &= original_cliprect;
// iterate over Y to handle wraparound
- for (int ypos = scrolly - m_height; ypos <= original_cliprect.max_y; ypos += m_height)
+ for (int ypos = scrolly - m_height; ypos <= original_cliprect.bottom(); ypos += m_height)
draw_instance(screen, dest, blit, xpos, ypos);
}
}
@@ -1115,10 +1113,10 @@ void tilemap_t::draw_instance(screen_device &screen, _BitmapClass &dest, const b
{
// clip destination coordinates to the tilemap
// note that x2/y2 are exclusive, not inclusive
- int x1 = std::max(xpos, blit.cliprect.min_x);
- int x2 = std::min(xpos + (int)m_width, blit.cliprect.max_x + 1);
- int y1 = std::max(ypos, blit.cliprect.min_y);
- int y2 = std::min(ypos + (int)m_height, blit.cliprect.max_y + 1);
+ int x1 = (std::max)(xpos, blit.cliprect.left());
+ int x2 = (std::min)(xpos + int(m_width), blit.cliprect.right() + 1);
+ int y1 = (std::max)(ypos, blit.cliprect.top());
+ int y2 = (std::min)(ypos + int(m_height), blit.cliprect.bottom() + 1);
// if totally clipped, stop here
if (x1 >= x2 || y1 >= y2)
@@ -1305,14 +1303,14 @@ void tilemap_t::draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, c
u8 alpha = blit.alpha;
// pre-advance based on the cliprect
- startx += blit.cliprect.min_x * incxx + blit.cliprect.min_y * incyx;
- starty += blit.cliprect.min_x * incxy + blit.cliprect.min_y * incyy;
+ startx += blit.cliprect.left() * incxx + blit.cliprect.top() * incyx;
+ starty += blit.cliprect.left() * incxy + blit.cliprect.top() * incyy;
// extract start/end points
- int sx = blit.cliprect.min_x;
- int sy = blit.cliprect.min_y;
- int ex = blit.cliprect.max_x;
- int ey = blit.cliprect.max_y;
+ int sx = blit.cliprect.left();
+ int sy = blit.cliprect.top();
+ int ex = blit.cliprect.right();
+ int ey = blit.cliprect.bottom();
// optimized loop for the not rotated case
if (incxy == 0 && incyx == 0 && !wraparound)
@@ -1476,8 +1474,8 @@ void tilemap_t::draw_debug(screen_device &screen, bitmap_rgb32 &dest, u32 scroll
realize_all_dirty_tiles();
// iterate to handle wraparound
- for (int ypos = scrolly - m_height; ypos <= blit.cliprect.max_y; ypos += m_height)
- for (int xpos = scrollx - m_width; xpos <= blit.cliprect.max_x; xpos += m_width)
+ for (int ypos = scrolly - m_height; ypos <= blit.cliprect.bottom(); ypos += m_height)
+ for (int xpos = scrollx - m_width; xpos <= blit.cliprect.right(); xpos += m_width)
draw_instance(screen, dest, blit, xpos, ypos);
}
diff --git a/src/lib/util/bitmap.cpp b/src/lib/util/bitmap.cpp
index c8ceb5d3eab..a0a1e92f4d9 100644
--- a/src/lib/util/bitmap.cpp
+++ b/src/lib/util/bitmap.cpp
@@ -129,7 +129,7 @@ bitmap_t::bitmap_t(bitmap_format format, uint8_t bpp, void *base, int width, int
bitmap_t::bitmap_t(bitmap_format format, uint8_t bpp, bitmap_t &source, const rectangle &subrect)
: m_alloc()
, m_allocbytes(0)
- , m_base(source.raw_pixptr(subrect.min_y, subrect.min_x))
+ , m_base(source.raw_pixptr(subrect.top(), subrect.left()))
, m_rowpixels(source.m_rowpixels)
, m_width(subrect.width())
, m_height(subrect.height())
@@ -332,7 +332,7 @@ void bitmap_t::wrap(const bitmap_t &source, const rectangle &subrect)
reset();
// copy relevant fields
- m_base = source.raw_pixptr(subrect.min_y, subrect.min_x);
+ m_base = source.raw_pixptr(subrect.top(), subrect.left());
m_rowpixels = source.m_rowpixels;
m_width = subrect.width();
m_height = subrect.height();
@@ -391,29 +391,29 @@ void bitmap_t::fill(uint32_t color, const rectangle &cliprect)
{
case 8:
// 8bpp always uses memset
- for (int32_t y = fill.min_y; y <= fill.max_y; y++)
- memset(raw_pixptr(y, fill.min_x), (uint8_t)color, fill.width());
+ for (int32_t y = fill.top(); y <= fill.bottom(); y++)
+ memset(raw_pixptr(y, fill.left()), uint8_t(color), fill.width());
break;
case 16:
// 16bpp can use memset if the bytes are equal
- if ((uint8_t)(color >> 8) == (uint8_t)color)
+ if (uint8_t(color >> 8) == uint8_t(color))
{
- for (int32_t y = fill.min_y; y <= fill.max_y; y++)
- memset(raw_pixptr(y, fill.min_x), (uint8_t)color, fill.width() * 2);
+ for (int32_t y = fill.top(); y <= fill.bottom(); y++)
+ memset(raw_pixptr(y, fill.left()), uint8_t(color), fill.width() * 2);
}
else
{
// Fill the first line the hard way
- uint16_t *destrow = &pixt<uint16_t>(fill.min_y);
- for (int32_t x = fill.min_x; x <= fill.max_x; x++)
- destrow[x] = (uint16_t)color;
+ uint16_t *destrow = &pixt<uint16_t>(fill.top());
+ for (int32_t x = fill.left(); x <= fill.right(); x++)
+ destrow[x] = uint16_t(color);
// For the other lines, just copy the first one
- void *destrow0 = &pixt<uint16_t>(fill.min_y, fill.min_x);
- for (int32_t y = fill.min_y + 1; y <= fill.max_y; y++)
+ void *destrow0 = &pixt<uint16_t>(fill.top(), fill.left());
+ for (int32_t y = fill.top() + 1; y <= fill.bottom(); y++)
{
- destrow = &pixt<uint16_t>(y, fill.min_x);
+ destrow = &pixt<uint16_t>(y, fill.left());
memcpy(destrow, destrow0, fill.width() * 2);
}
}
@@ -423,21 +423,21 @@ void bitmap_t::fill(uint32_t color, const rectangle &cliprect)
// 32bpp can use memset if the bytes are equal
if ((uint8_t)(color >> 8) == (uint8_t)color && (uint16_t)(color >> 16) == (uint16_t)color)
{
- for (int32_t y = fill.min_y; y <= fill.max_y; y++)
- memset(&pixt<uint32_t>(y, fill.min_x), (uint8_t)color, fill.width() * 4);
+ for (int32_t y = fill.top(); y <= fill.bottom(); y++)
+ memset(&pixt<uint32_t>(y, fill.left()), uint8_t(color), fill.width() * 4);
}
else
{
// Fill the first line the hard way
- uint32_t *destrow = &pixt<uint32_t>(fill.min_y);
- for (int32_t x = fill.min_x; x <= fill.max_x; x++)
- destrow[x] = (uint32_t)color;
+ uint32_t *destrow = &pixt<uint32_t>(fill.top());
+ for (int32_t x = fill.left(); x <= fill.right(); x++)
+ destrow[x] = uint32_t(color);
// For the other lines, just copy the first one
- uint32_t *destrow0 = &pixt<uint32_t>(fill.min_y, fill.min_x);
- for (int32_t y = fill.min_y + 1; y <= fill.max_y; y++)
+ uint32_t *destrow0 = &pixt<uint32_t>(fill.top(), fill.left());
+ for (int32_t y = fill.top() + 1; y <= fill.bottom(); y++)
{
- destrow = &pixt<uint32_t>(y, fill.min_x);
+ destrow = &pixt<uint32_t>(y, fill.left());
memcpy(destrow, destrow0, fill.width() * 4);
}
}
@@ -445,23 +445,23 @@ void bitmap_t::fill(uint32_t color, const rectangle &cliprect)
case 64:
// 64bpp can use memset if the bytes are equal
- if ((uint8_t)(color >> 8) == (uint8_t)color && (uint16_t)(color >> 16) == (uint16_t)color)
+ if (uint8_t(color >> 8) == uint8_t(color) && uint16_t(color >> 16) == uint16_t(color)) // FIXME: really? wat about the upper bits that would be zeroed when done the "hard way"?
{
- for (int32_t y = fill.min_y; y <= fill.max_y; y++)
- memset(&pixt<uint64_t>(y, fill.min_x), (uint8_t)color, fill.width() * 8);
+ for (int32_t y = fill.top(); y <= fill.bottom(); y++)
+ memset(&pixt<uint64_t>(y, fill.left()), uint8_t(color), fill.width() * 8);
}
else
{
// Fill the first line the hard way
- uint64_t *destrow = &pixt<uint64_t>(fill.min_y);
- for (int32_t x = fill.min_x; x <= fill.max_x; x++)
- destrow[x] = (uint64_t)color;
+ uint64_t *destrow = &pixt<uint64_t>(fill.top());
+ for (int32_t x = fill.left(); x <= fill.right(); x++)
+ destrow[x] = uint64_t(color);
// For the other lines, just copy the first one
- uint64_t *destrow0 = &pixt<uint64_t>(fill.min_y, fill.min_x);
- for (int32_t y = fill.min_y + 1; y <= fill.max_y; y++)
+ uint64_t *destrow0 = &pixt<uint64_t>(fill.top(), fill.left());
+ for (int32_t y = fill.top() + 1; y <= fill.bottom(); y++)
{
- destrow = &pixt<uint64_t>(y, fill.min_x);
+ destrow = &pixt<uint64_t>(y, fill.left());
memcpy(destrow, destrow0, fill.width() * 8);
}
}
diff --git a/src/lib/util/bitmap.h b/src/lib/util/bitmap.h
index 7b0fc34610f..efb18f7e456 100644
--- a/src/lib/util/bitmap.h
+++ b/src/lib/util/bitmap.h
@@ -43,16 +43,16 @@ class rectangle
{
public:
// construction/destruction
- rectangle()
- : min_x(0), max_x(0), min_y(0), max_y(0) { }
- rectangle(int32_t minx, int32_t maxx, int32_t miny, int32_t maxy)
- : min_x(minx), max_x(maxx), min_y(miny), max_y(maxy) { }
+ constexpr rectangle() { }
+ constexpr rectangle(int32_t minx, int32_t maxx, int32_t miny, int32_t maxy)
+ : min_x(minx), max_x(maxx), min_y(miny), max_y(maxy)
+ { }
// getters
- int32_t left() const { return min_x; }
- int32_t right() const { return max_x; }
- int32_t top() const { return min_y; }
- int32_t bottom() const { return max_y; }
+ constexpr int32_t left() const { return min_x; }
+ constexpr int32_t right() const { return max_x; }
+ constexpr int32_t top() const { return min_y; }
+ constexpr int32_t bottom() const { return max_y; }
// compute intersection with another rect
rectangle &operator&=(const rectangle &src)
@@ -75,21 +75,21 @@ public:
}
// comparisons
- bool operator==(const rectangle &rhs) const { return min_x == rhs.min_x && max_x == rhs.max_x && min_y == rhs.min_y && max_y == rhs.max_y; }
- bool operator!=(const rectangle &rhs) const { return min_x != rhs.min_x || max_x != rhs.max_x || min_y != rhs.min_y || max_y != rhs.max_y; }
- bool operator>(const rectangle &rhs) const { return min_x < rhs.min_x && min_y < rhs.min_y && max_x > rhs.max_x && max_y > rhs.max_y; }
- bool operator>=(const rectangle &rhs) const { return min_x <= rhs.min_x && min_y <= rhs.min_y && max_x >= rhs.max_x && max_y >= rhs.max_y; }
- bool operator<(const rectangle &rhs) const { return min_x >= rhs.min_x || min_y >= rhs.min_y || max_x <= rhs.max_x || max_y <= rhs.max_y; }
- bool operator<=(const rectangle &rhs) const { return min_x > rhs.min_x || min_y > rhs.min_y || max_x < rhs.max_x || max_y < rhs.max_y; }
+ constexpr bool operator==(const rectangle &rhs) const { return min_x == rhs.min_x && max_x == rhs.max_x && min_y == rhs.min_y && max_y == rhs.max_y; }
+ constexpr bool operator!=(const rectangle &rhs) const { return min_x != rhs.min_x || max_x != rhs.max_x || min_y != rhs.min_y || max_y != rhs.max_y; }
+ constexpr bool operator>(const rectangle &rhs) const { return min_x < rhs.min_x && min_y < rhs.min_y && max_x > rhs.max_x && max_y > rhs.max_y; }
+ constexpr bool operator>=(const rectangle &rhs) const { return min_x <= rhs.min_x && min_y <= rhs.min_y && max_x >= rhs.max_x && max_y >= rhs.max_y; }
+ constexpr bool operator<(const rectangle &rhs) const { return min_x >= rhs.min_x || min_y >= rhs.min_y || max_x <= rhs.max_x || max_y <= rhs.max_y; }
+ constexpr bool operator<=(const rectangle &rhs) const { return min_x > rhs.min_x || min_y > rhs.min_y || max_x < rhs.max_x || max_y < rhs.max_y; }
// other helpers
- bool empty() const { return (min_x > max_x || min_y > max_y); }
- bool contains(int32_t x, int32_t y) const { return (x >= min_x && x <= max_x && y >= min_y && y <= max_y); }
- bool contains(const rectangle &rect) const { return (min_x <= rect.min_x && max_x >= rect.max_x && min_y <= rect.min_y && max_y >= rect.max_y); }
- int32_t width() const { return max_x + 1 - min_x; }
- int32_t height() const { return max_y + 1 - min_y; }
- int32_t xcenter() const { return (min_x + max_x + 1) / 2; }
- int32_t ycenter() const { return (min_y + max_y + 1) / 2; }
+ constexpr bool empty() const { return (min_x > max_x) || (min_y > max_y); }
+ constexpr bool contains(int32_t x, int32_t y) const { return (x >= min_x) && (x <= max_x) && (y >= min_y) && (y <= max_y); }
+ constexpr bool contains(const rectangle &rect) const { return (min_x <= rect.min_x) && (max_x >= rect.max_x) && (min_y <= rect.min_y) && (max_y >= rect.max_y); }
+ constexpr int32_t width() const { return max_x + 1 - min_x; }
+ constexpr int32_t height() const { return max_y + 1 - min_y; }
+ constexpr int32_t xcenter() const { return (min_x + max_x + 1) / 2; }
+ constexpr int32_t ycenter() const { return (min_y + max_y + 1) / 2; }
// setters
void set(int32_t minx, int32_t maxx, int32_t miny, int32_t maxy) { min_x = minx; max_x = maxx; min_y = miny; max_y = maxy; }
@@ -106,10 +106,10 @@ public:
void offsety(int32_t delta) { min_y += delta; max_y += delta; }
// internal state
- int32_t min_x; // minimum X, or left coordinate
- int32_t max_x; // maximum X, or right coordinate (inclusive)
- int32_t min_y; // minimum Y, or top coordinate
- int32_t max_y; // maximum Y, or bottom coordinate (inclusive)
+ int32_t min_x = 0; // minimum X, or left coordinate
+ int32_t max_x = 0; // maximum X, or right coordinate (inclusive)
+ int32_t min_y = 0; // minimum Y, or top coordinate
+ int32_t max_y = 0; // maximum Y, or bottom coordinate (inclusive)
};
diff --git a/src/mame/drivers/accomm.cpp b/src/mame/drivers/accomm.cpp
index 4670a882007..9ef4100f7d1 100644
--- a/src/mame/drivers/accomm.cpp
+++ b/src/mame/drivers/accomm.cpp
@@ -238,17 +238,15 @@ uint32_t accomm_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap
{
int i;
int x = 0;
- int pal[16];
int scanline = screen.vpos();
rectangle r = cliprect;
- r.min_y = r.max_y = scanline;
+ r.sety(scanline, scanline);
if (scanline == 0)
- {
m_ula.screen_addr = m_ula.screen_start - m_ula.screen_base;
- }
/* set up palette */
+ int pal[16];
switch( m_ula.screen_mode )
{
case 0: case 3: case 4: case 6: case 7: /* 2 colour mode */
diff --git a/src/mame/drivers/alg.cpp b/src/mame/drivers/alg.cpp
index b72d8a61b3a..96dc185ba6b 100644
--- a/src/mame/drivers/alg.cpp
+++ b/src/mame/drivers/alg.cpp
@@ -102,8 +102,8 @@ int alg_state::get_lightgun_pos(int player, int *x, int *y)
if (xpos == -1 || ypos == -1)
return false;
- *x = visarea.min_x + xpos * visarea.width() / 255;
- *y = visarea.min_y + ypos * visarea.height() / 255;
+ *x = visarea.left() + xpos * visarea.width() / 255;
+ *y = visarea.top() + ypos * visarea.height() / 255;
return true;
}
diff --git a/src/mame/drivers/apple1.cpp b/src/mame/drivers/apple1.cpp
index bb81a6bdc85..36b9ecf6fa3 100644
--- a/src/mame/drivers/apple1.cpp
+++ b/src/mame/drivers/apple1.cpp
@@ -358,14 +358,14 @@ uint32_t apple1_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap
// the cursor 555 timer counts 0.52 of a second; the cursor is ON for
// 2 of those counts and OFF for the last one.
- if (((int)(machine().time().as_double() / (0.52 / 3.0)) % 3) < 2)
+ if ((int(machine().time().as_double() / (0.52 / 3.0)) % 3) < 2)
{
curs_save = m_vram[(m_cursy * 40) + m_cursx];
m_vram[(m_cursy * 40) + m_cursx] = 0x40;
cursor_blink = 1;
}
- for (int row = 0; row < cliprect.max_y; row += 8)
+ for (int row = 0; row < cliprect.bottom(); row += 8)
{
for (int col = 0; col < 40; col++)
{
diff --git a/src/mame/drivers/astrof.cpp b/src/mame/drivers/astrof.cpp
index c6f3f85802b..954418c4465 100644
--- a/src/mame/drivers/astrof.cpp
+++ b/src/mame/drivers/astrof.cpp
@@ -374,7 +374,7 @@ void astrof_state::video_update_common( bitmap_rgb32 &bitmap, const rectangle &c
if (!m_flipscreen)
y = ~y;
- if ((y <= cliprect.min_y) || (y >= cliprect.max_y))
+ if ((y <= cliprect.top()) || (y >= cliprect.bottom()))
continue;
if (m_screen_off)
diff --git a/src/mame/drivers/atarisy4.cpp b/src/mame/drivers/atarisy4.cpp
index 977845b7795..4ccb756928e 100644
--- a/src/mame/drivers/atarisy4.cpp
+++ b/src/mame/drivers/atarisy4.cpp
@@ -245,13 +245,13 @@ uint32_t atarisy4_state::screen_update_atarisy4(screen_device &screen, bitmap_rg
//uint32_t offset = m_gpu.dpr << 5;
- for (y = cliprect.min_y; y <= cliprect.max_y; ++y)
+ for (y = cliprect.top(); y <= cliprect.bottom(); ++y)
{
uint16_t *src = &m_screen_ram[(offset + (4096 * y)) / 2];
- uint32_t *dest = &bitmap.pix32(y, cliprect.min_x);
+ uint32_t *dest = &bitmap.pix32(y, cliprect.left());
int x;
- for (x = cliprect.min_x; x < cliprect.max_x; x += 2)
+ for (x = cliprect.left(); x < cliprect.right(); x += 2)
{
uint16_t data = *src++;
diff --git a/src/mame/drivers/bfcobra.cpp b/src/mame/drivers/bfcobra.cpp
index 0215b85ce1c..c38ea142449 100644
--- a/src/mame/drivers/bfcobra.cpp
+++ b/src/mame/drivers/bfcobra.cpp
@@ -408,13 +408,13 @@ uint32_t bfcobra_state::screen_update_bfcobra(screen_device &screen, bitmap_rgb3
lorescol = m_col8bit;
}
- for (y = cliprect.min_y; y <= cliprect.max_y; ++y)
+ for (y = cliprect.top(); y <= cliprect.bottom(); ++y)
{
uint16_t y_offset = (y + m_v_scroll) * 256;
src = &m_video_ram[offset + y_offset];
dest = &bitmap.pix32(y);
- for (x = cliprect.min_x; x <= cliprect.max_x / 2; ++x)
+ for (x = cliprect.left(); x <= cliprect.right() / 2; ++x)
{
uint8_t x_offset = x + m_h_scroll;
uint8_t pen = *(src + x_offset);
diff --git a/src/mame/drivers/bmcpokr.cpp b/src/mame/drivers/bmcpokr.cpp
index 288882bc8de..fcd3c212560 100644
--- a/src/mame/drivers/bmcpokr.cpp
+++ b/src/mame/drivers/bmcpokr.cpp
@@ -236,11 +236,10 @@ void bmcpokr_state::draw_layer(screen_device &screen, bitmap_ind16 &bitmap, cons
{
if (linescroll)
{
- if ( (y < cliprect.min_y) || (y > cliprect.max_y) )
+ if ( (y < cliprect.top()) || (y > cliprect.bottom()) )
continue;
- clip.min_y = y;
- clip.max_y = y;
+ clip.sety(y, y);
}
int sx = (scroll[y] & 0xff) * 4;
diff --git a/src/mame/drivers/c65.cpp b/src/mame/drivers/c65.cpp
index 770b4a7fd61..597a6ed16c1 100644
--- a/src/mame/drivers/c65.cpp
+++ b/src/mame/drivers/c65.cpp
@@ -147,9 +147,9 @@ uint32_t c65_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap,
uint8_t *cptr = &m_iplrom[((m_VIC3_ControlA & 0x40) ? 0x9000: 0xd000) + ((m_VIC2_VS_CB_Base & 0x2) << 10)];
// TODO: border area
- for(int y=cliprect.min_y;y<=cliprect.max_y;y++)
+ for(int y=cliprect.top();y<=cliprect.bottom();y++)
{
- for(int x=cliprect.min_x;x<=cliprect.max_x;x++)
+ for(int x=cliprect.left();x<=cliprect.right();x++)
{
//int, xi,yi,xm,ym,dot_x;
int xi = inner_x_char(x / pixel_width);
diff --git a/src/mame/drivers/casloopy.cpp b/src/mame/drivers/casloopy.cpp
index ff2df37a817..060dfdd4a95 100644
--- a/src/mame/drivers/casloopy.cpp
+++ b/src/mame/drivers/casloopy.cpp
@@ -297,7 +297,7 @@ uint32_t casloopy_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
count = test;
- for (y=cliprect.min_y;y<cliprect.max_y;y++)
+ for (y=cliprect.top(); y<cliprect.bottom(); y++) // FIXME: off-by-one?
{
for(x=0;x<256;x++)
{
diff --git a/src/mame/drivers/cps3.cpp b/src/mame/drivers/cps3.cpp
index 5f5ece2d0b9..78b470f1aab 100644
--- a/src/mame/drivers/cps3.cpp
+++ b/src/mame/drivers/cps3.cpp
@@ -564,26 +564,26 @@ inline void cps3_state::cps3_drawgfxzoom(bitmap_rgb32 &dest_bmp,const rectangle
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;
}
- 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;
}
@@ -985,11 +985,11 @@ void cps3_state::cps3_draw_tilemapsprite_line(int tmnum, int drawline, bitmap_rg
drawline&=0x3ff;
- if (drawline>cliprect.max_y+4) return;
+ if (drawline>cliprect.bottom()+4) return;
- clip.set(cliprect.min_x, cliprect.max_x, drawline, drawline);
+ clip.set(cliprect.left(), cliprect.right(), drawline, drawline);
- for (x=0;x<(cliprect.max_x/16)+2;x++)
+ for (x=0;x<(cliprect.right()/16)+2;x++)
{
uint32_t dat;
int tileno;
@@ -1057,10 +1057,9 @@ uint32_t cps3_state::screen_update_cps3(screen_device &screen, bitmap_rgb32 &bit
fszx = (fullscreenzoomx<<16)/0x40;
fszy = (fullscreenzoomy<<16)/0x40;
- m_renderbuffer_clip.min_x = 0;
- m_renderbuffer_clip.max_x = ((m_screenwidth*fszx)>>16)-1;
- m_renderbuffer_clip.min_y = 0;
- m_renderbuffer_clip.max_y = ((224*fszx)>>16)-1;
+ m_renderbuffer_clip.set(
+ 0, ((m_screenwidth*fszx)>>16)-1,
+ 0, ((224*fszx)>>16)-1);
m_renderbuffer_bitmap.fill(0, m_renderbuffer_clip);
diff --git a/src/mame/drivers/ddenlovr.cpp b/src/mame/drivers/ddenlovr.cpp
index fce55440bad..0097e04ec0d 100644
--- a/src/mame/drivers/ddenlovr.cpp
+++ b/src/mame/drivers/ddenlovr.cpp
@@ -1633,9 +1633,9 @@ void ddenlovr_state::copylayer(bitmap_ind16 &bitmap, const rectangle &cliprect,
if (((m_ddenlovr_layer_enable2 << 4) | m_ddenlovr_layer_enable) & (1 << layer))
{
- for (y = cliprect.min_y; y <= cliprect.max_y; y++)
+ for (y = cliprect.top(); y <= cliprect.bottom(); y++)
{
- for (x = cliprect.min_x; x <= cliprect.max_x; x++)
+ for (x = cliprect.left(); x <= cliprect.right(); x++)
{
int pen = m_ddenlovr_pixmap[layer][512 * ((y + scrolly) & 0x1ff) + ((x + scrollx) & 0x1ff)];
if ((pen & transmask) != transpen)
diff --git a/src/mame/drivers/dooyong.cpp b/src/mame/drivers/dooyong.cpp
index 148e828b8c5..fa73754a06d 100644
--- a/src/mame/drivers/dooyong.cpp
+++ b/src/mame/drivers/dooyong.cpp
@@ -691,7 +691,7 @@ void dooyong_68k_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap
int const color = buffered_spriteram[offs+7] & 0x000f;
//TODO: This priority mechanism works for known games, but seems a bit strange.
//Are we missing something? (The obvious spare palette bit isn't it.)
- int const pri = (((color == 0x00) || (color == 0x0f)) ? 0xfc : 0xf0);
+ int const pri = GFX_PMASK_4 | (((color == 0x00) || (color == 0x0f)) ? GFX_PMASK_2 : 0);
int const width = buffered_spriteram[offs+1] & 0x000f;
int const height = (buffered_spriteram[offs+1] & 0x00f0) >> 4;
@@ -753,12 +753,12 @@ uint32_t popbingo_state::screen_update_popbingo(screen_device &screen, bitmap_in
m_bg_bitmap[1].fill(m_palette->black_pen(), cliprect);
m_bg[1]->draw(screen, m_bg_bitmap[1], cliprect, 0, 1);
- for (int y = cliprect.min_y; cliprect.max_y >= y; y++)
+ for (int y = cliprect.top(); cliprect.bottom() >= y; y++)
{
uint16_t const *const bg_src(&m_bg_bitmap[0].pix16(y, 0));
uint16_t const *const bg2_src(&m_bg_bitmap[1].pix16(y, 0));
uint16_t *const dst(&bitmap.pix16(y, 0));
- for (int x = cliprect.min_x; cliprect.max_x >= x; x++)
+ for (int x = cliprect.left(); cliprect.right() >= x; x++)
dst[x] = 0x100U | (bg_src[x] << 4) | bg2_src[x];
}
diff --git a/src/mame/drivers/firefox.cpp b/src/mame/drivers/firefox.cpp
index 994b6f47edb..bbd1994f3f9 100644
--- a/src/mame/drivers/firefox.cpp
+++ b/src/mame/drivers/firefox.cpp
@@ -251,14 +251,14 @@ void firefox_state::video_start()
{
m_bgtiles = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(firefox_state::bgtile_get_info),this), TILEMAP_SCAN_ROWS, 8,8, 64,64);
m_bgtiles->set_transparent_pen(0);
- m_bgtiles->set_scrolldy(m_screen->visible_area().min_y, 0);
+ m_bgtiles->set_scrolldy(m_screen->visible_area().top(), 0);
}
uint32_t firefox_state::screen_update_firefox(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
int sprite;
- int gfxtop = screen.visible_area().min_y;
+ int gfxtop = screen.visible_area().top();
bitmap.fill(m_palette->pen_color(256), cliprect);
diff --git a/src/mame/drivers/fp200.cpp b/src/mame/drivers/fp200.cpp
index 478ac7c536a..61753f3f7ad 100644
--- a/src/mame/drivers/fp200.cpp
+++ b/src/mame/drivers/fp200.cpp
@@ -98,7 +98,7 @@ uint32_t fp200_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap
l_offs = 0;
r_offs = 0;
- for(int y=cliprect.min_y;y<cliprect.max_y;y++)
+ for(int y=cliprect.top(); y<cliprect.bottom(); y++) // FIXME: off-by-one?
{
for(int x=0;x<80;x++)
{
@@ -110,7 +110,7 @@ uint32_t fp200_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap
}
}
- for(int y=cliprect.min_y;y<cliprect.max_y;y++)
+ for(int y=cliprect.top(); y<cliprect.bottom(); y++) // FIXME: off-by-one?
{
for(int x=80;x<160;x++)
{
@@ -122,7 +122,7 @@ uint32_t fp200_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap
}
}
- for(int y=cliprect.min_y;y<cliprect.max_y;y++)
+ for(int y=cliprect.top(); y<cliprect.bottom(); y++) // FIXME: off-by-one?
{
for(int x=0;x<80;x++)
{
@@ -153,7 +153,7 @@ uint32_t fp200_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap
}
}
- for(int y=cliprect.min_y;y<cliprect.max_y;y++)
+ for(int y=cliprect.top(); y<cliprect.bottom(); y++) // FIXME: off-by-one?
{
for(int x=80;x<160;x++)
{
diff --git a/src/mame/drivers/missile.cpp b/src/mame/drivers/missile.cpp
index 0cb8247b342..ceb7416cab1 100644
--- a/src/mame/drivers/missile.cpp
+++ b/src/mame/drivers/missile.cpp
@@ -685,8 +685,8 @@ uint32_t missile_state::screen_update_missile(screen_device &screen, bitmap_ind1
uint8_t *videoram = m_videoram;
int x, y;
- /* draw the bitmap to the screen, looping over Y */
- for (y = cliprect.min_y; y <= cliprect.max_y; y++)
+ // draw the bitmap to the screen, looping over Y
+ for (y = cliprect.top(); y <= cliprect.bottom(); y++)
{
uint16_t *dst = &bitmap.pix16(y);
@@ -694,18 +694,18 @@ uint32_t missile_state::screen_update_missile(screen_device &screen, bitmap_ind1
uint8_t *src = &videoram[effy * 64];
uint8_t *src3 = nullptr;
- /* compute the base of the 3rd pixel row */
+ // compute the base of the 3rd pixel row
if (effy >= 224)
src3 = &videoram[get_bit3_addr(effy << 8)];
- /* loop over X */
- for (x = cliprect.min_x; x <= cliprect.max_x; x++)
+ // loop over X
+ for (x = cliprect.left(); x <= cliprect.right(); x++)
{
uint8_t pix = src[x / 4] >> (x & 3);
pix = ((pix >> 2) & 4) | ((pix << 1) & 2);
- /* if we're in the lower region, get the 3rd bit */
- if (src3 != nullptr)
+ // if we're in the lower region, get the 3rd bit
+ if (src3)
pix |= (src3[(x / 8) * 2] >> (x & 7)) & 1;
dst[x] = pix;
diff --git a/src/mame/drivers/popobear.cpp b/src/mame/drivers/popobear.cpp
index f973e7daa78..de8ae698ff4 100644
--- a/src/mame/drivers/popobear.cpp
+++ b/src/mame/drivers/popobear.cpp
@@ -414,7 +414,7 @@ uint32_t popobear_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
uint16_t val = m_vram[scrollbase/2 + line];
uint16_t upper = (m_vram[scrollbase2/2 + line]&0xff00)>>8;
- clip.min_y = clip.max_y = line;
+ clip.sety(line, line);
m_bg_tilemap[1]->set_scrollx(0,(val&0x00ff) | (upper << 8));
m_bg_tilemap[1]->set_scrolly(0,((val&0xff00)>>8)-line);
@@ -439,7 +439,7 @@ uint32_t popobear_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
uint16_t val = m_vram[scrollbase/2 + line];
uint16_t upper = (m_vram[scrollbase2/2 + line]&0x00ff)>>0;
- clip.min_y = clip.max_y = line;
+ clip.sety(line, line);
m_bg_tilemap[0]->set_scrollx(0,(val&0x00ff) | (upper << 8));
m_bg_tilemap[0]->set_scrolly(0,((val&0xff00)>>8)-line);
diff --git a/src/mame/drivers/riscpc.cpp b/src/mame/drivers/riscpc.cpp
index 0ccd9663b15..b08056fdbfa 100644
--- a/src/mame/drivers/riscpc.cpp
+++ b/src/mame/drivers/riscpc.cpp
@@ -196,10 +196,11 @@ void riscpc_state::vidc20_dynamic_screen_change()
hblank_period = (m_vidc20_horz_reg[HCR] & 0x3ffc);
vblank_period = (m_vidc20_vert_reg[VCR] & 0x3fff);
/* note that we use the border registers as the visible area */
- visarea.min_x = (m_vidc20_horz_reg[HBSR] & 0x3ffe);
- visarea.max_x = (m_vidc20_horz_reg[HBER] & 0x3ffe)-1;
- visarea.min_y = (m_vidc20_vert_reg[VBSR] & 0x1fff);
- visarea.max_y = (m_vidc20_vert_reg[VBER] & 0x1fff)-1;
+ visarea.set(
+ (m_vidc20_horz_reg[HBSR] & 0x3ffe),
+ (m_vidc20_horz_reg[HBER] & 0x3ffe) - 1,
+ (m_vidc20_vert_reg[VBSR] & 0x1fff),
+ (m_vidc20_vert_reg[VBER] & 0x1fff) - 1);
m_screen->configure(hblank_period, vblank_period, visarea, m_screen->frame_period().attoseconds() );
logerror("VIDC20: successfully changed the screen to:\n Display Size = %d x %d\n Border Size %d x %d\n Cycle Period %d x %d\n",
diff --git a/src/mame/drivers/sbrkout.cpp b/src/mame/drivers/sbrkout.cpp
index a4f68428d88..3ad241a169a 100644
--- a/src/mame/drivers/sbrkout.cpp
+++ b/src/mame/drivers/sbrkout.cpp
@@ -182,7 +182,7 @@ TIMER_CALLBACK_MEMBER(sbrkout_state::scanline_callback)
m_dac->write((videoram[0x380 + 0x11] & (scanline >> 2)) != 0);
/* on the VBLANK, read the pot and schedule an interrupt time for it */
- if (scanline == m_screen->visible_area().max_y + 1)
+ if (scanline == m_screen->visible_area().bottom() + 1)
{
uint8_t potvalue = ioport("PADDLE")->read();
m_pot_timer->adjust(m_screen->time_until_pos(56 + (potvalue / 2), (potvalue % 2) * 128));
@@ -322,7 +322,7 @@ WRITE_LINE_MEMBER(sbrkout_state::coincount_w)
READ8_MEMBER(sbrkout_state::sync_r)
{
int hpos = m_screen->hpos();
- m_sync2_value = (hpos >= 128 && hpos <= m_screen->visible_area().max_x);
+ m_sync2_value = (hpos >= 128 && hpos <= m_screen->visible_area().right());
return m_screen->vpos();
}
diff --git a/src/mame/includes/realbrk.h b/src/mame/includes/realbrk.h
index 6e40143e1e0..14a548366eb 100644
--- a/src/mame/includes/realbrk.h
+++ b/src/mame/includes/realbrk.h
@@ -1,5 +1,10 @@
// license:BSD-3-Clause
// copyright-holders:Luca Elia
+#ifndef MAME_INCLUDES_REALBRK_H
+#define MAME_INCLUDES_REALBRK_H
+
+#pragma once
+
#include "machine/tmp68301.h"
#include "emupal.h"
#include "screen.h"
@@ -79,8 +84,7 @@ private:
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_dai2kaku(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect, int layer);
- void dai2kaku_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect, int layer);
+ template <bool Rotatable> void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect, int layer);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
void base_mem(address_map &map);
@@ -89,3 +93,5 @@ private:
void pkgnshdx_mem(address_map &map);
void realbrk_mem(address_map &map);
};
+
+#endif // MAME_INCLUDES_REALBRK_H
diff --git a/src/mame/machine/amiga.cpp b/src/mame/machine/amiga.cpp
index 89c7f28ae8c..bcda93d108c 100644
--- a/src/mame/machine/amiga.cpp
+++ b/src/mame/machine/amiga.cpp
@@ -278,7 +278,7 @@ TIMER_CALLBACK_MEMBER( amiga_state::scanline_callback )
}
// vblank end
- if (scanline == m_screen->visible_area().min_y)
+ if (scanline == m_screen->visible_area().top())
{
m_cia_0->tod_w(0);
}
diff --git a/src/mame/machine/archimds.cpp b/src/mame/machine/archimds.cpp
index 18168ddeb59..088c2bc21e1 100644
--- a/src/mame/machine/archimds.cpp
+++ b/src/mame/machine/archimds.cpp
@@ -884,22 +884,18 @@ void archimedes_state::vidc_dynamic_res_change()
(m_vidc_regs[VIDC_HBER] >= m_vidc_regs[VIDC_HBSR]) &&
(m_vidc_regs[VIDC_VBER] >= m_vidc_regs[VIDC_VBSR]))
{
- rectangle visarea;
- attoseconds_t refresh;
-
- visarea.min_x = 0;
- visarea.min_y = 0;
- visarea.max_x = m_vidc_regs[VIDC_HBER] - m_vidc_regs[VIDC_HBSR] - 1;
- visarea.max_y = (m_vidc_regs[VIDC_VBER] - m_vidc_regs[VIDC_VBSR]) * (m_vidc_interlace+1);
+ rectangle const visarea(
+ 0, m_vidc_regs[VIDC_HBER] - m_vidc_regs[VIDC_HBSR] - 1,
+ 0, (m_vidc_regs[VIDC_VBER] - m_vidc_regs[VIDC_VBSR]) * (m_vidc_interlace + 1));
m_vidc_vblank_time = m_vidc_regs[VIDC_VBER] * (m_vidc_interlace+1);
//logerror("Configuring: htotal %d vtotal %d border %d x %d display origin %d x %d vblank = %d\n",
// m_vidc_regs[VIDC_HCR], m_vidc_regs[VIDC_VCR],
- // visarea.max_x, visarea.max_y,
+ // visarea.right(), visarea.bottom(),
// m_vidc_regs[VIDC_HDER]-m_vidc_regs[VIDC_HDSR],m_vidc_regs[VIDC_VDER]-m_vidc_regs[VIDC_VDSR]+1,
// m_vidc_vblank_time);
- refresh = HZ_TO_ATTOSECONDS(pixel_rate[m_vidc_pixel_clk]) * m_vidc_regs[VIDC_HCR] * m_vidc_regs[VIDC_VCR];
+ attoseconds_t const refresh = HZ_TO_ATTOSECONDS(pixel_rate[m_vidc_pixel_clk]) * m_vidc_regs[VIDC_HCR] * m_vidc_regs[VIDC_VCR];
m_screen->configure(m_vidc_regs[VIDC_HCR], m_vidc_regs[VIDC_VCR] * (m_vidc_interlace+1), visarea, refresh);
}
diff --git a/src/mame/machine/deco_irq.cpp b/src/mame/machine/deco_irq.cpp
index c22ca908adc..0654edc8755 100644
--- a/src/mame/machine/deco_irq.cpp
+++ b/src/mame/machine/deco_irq.cpp
@@ -108,14 +108,14 @@ TIMER_CALLBACK_MEMBER( deco_irq_device::scanline_callback )
}
// lightgun?
- if (m_lightgun_latch >= visible.min_y && m_lightgun_latch <= visible.max_y && y == m_lightgun_latch)
+ if (m_lightgun_latch >= visible.top() && m_lightgun_latch <= visible.bottom() && y == m_lightgun_latch)
{
m_lightgun_irq = true;
m_lightgun_irq_cb(ASSERT_LINE);
}
// vblank-in?
- if (y == (visible.max_y + 1))
+ if (y == (visible.bottom() + 1))
{
m_vblank_irq = true;
m_vblank_irq_cb(ASSERT_LINE);
diff --git a/src/mame/machine/electron.cpp b/src/mame/machine/electron.cpp
index 725a57bb467..269ba54aa98 100644
--- a/src/mame/machine/electron.cpp
+++ b/src/mame/machine/electron.cpp
@@ -18,9 +18,9 @@ void electron_state::waitforramsync()
{
int cycles = 0;
- if (!(m_ula.screen_mode & 4) && (m_screen->vpos() > m_screen->visible_area().min_y) && (m_screen->vpos() < m_screen->visible_area().max_y) && !m_screen->hblank())
+ if (!(m_ula.screen_mode & 4) && (m_screen->vpos() > m_screen->visible_area().top()) && (m_screen->vpos() < m_screen->visible_area().bottom()) && !m_screen->hblank())
{
- cycles += (m_screen->visible_area().max_x - m_screen->hpos()) / 16;
+ cycles += (m_screen->visible_area().right() - m_screen->hpos()) / 16;
}
if (cycles & 1) cycles++;
diff --git a/src/mame/video/agat7.cpp b/src/mame/video/agat7.cpp
index da54f00fdde..e165ae96c60 100644
--- a/src/mame/video/agat7.cpp
+++ b/src/mame/video/agat7.cpp
@@ -168,8 +168,8 @@ void agat7video_device::text_update_lores(screen_device &screen, bitmap_ind16 &b
int fg = 0;
int bg = 0;
- beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8));
- endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7);
+ beginrow = std::max(beginrow, cliprect.top() - (cliprect.top() % 8));
+ endrow = std::min(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7);
for (row = beginrow; row <= endrow; row += 8)
{
@@ -198,8 +198,8 @@ void agat7video_device::text_update_hires(screen_device &screen, bitmap_ind16 &b
uint8_t ch;
int fg, bg;
- beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8));
- endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7);
+ beginrow = std::max(beginrow, cliprect.top() - (cliprect.top() % 8));
+ endrow = std::min(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7);
if (m_start_address & 0x800) {
fg = 7; bg = 0;
@@ -227,8 +227,8 @@ void agat7video_device::graph_update_mono(screen_device &screen, bitmap_ind16 &b
uint8_t gfx, v;
int fg = 7, bg = 0;
- beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8));
- endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7);
+ beginrow = std::max(beginrow, cliprect.top() - (cliprect.top() % 8));
+ endrow = std::min(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7);
for (row = beginrow; row <= endrow; row++)
{
@@ -256,8 +256,8 @@ void agat7video_device::graph_update_hires(screen_device &screen, bitmap_ind16 &
uint16_t *p;
uint8_t gfx, v;
- beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8));
- endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7);
+ beginrow = std::max(beginrow, cliprect.top() - (cliprect.top() % 8));
+ endrow = std::min(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7);
for (row = beginrow; row <= endrow; row++)
{
@@ -287,8 +287,8 @@ void agat7video_device::graph_update_lores(screen_device &screen, bitmap_ind16 &
uint16_t *p;
uint8_t gfx, v;
- beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8));
- endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7);
+ beginrow = std::max(beginrow, cliprect.top() - (cliprect.top() % 8));
+ endrow = std::min(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7);
for (row = beginrow; row <= endrow; row++)
{
diff --git a/src/mame/video/amiga.cpp b/src/mame/video/amiga.cpp
index 83bf7d1dc8f..7409e5d471e 100644
--- a/src/mame/video/amiga.cpp
+++ b/src/mame/video/amiga.cpp
@@ -817,7 +817,7 @@ void amiga_state::render_scanline(bitmap_ind16 &bitmap, int scanline)
/* to render, we must have bitplane DMA enabled, at least 1 plane, and be within the */
/* vertical display window */
if ((CUSTOM_REG(REG_DMACON) & (DMACON_BPLEN | DMACON_DMAEN)) == (DMACON_BPLEN | DMACON_DMAEN) &&
- planes > 0 && scanline >= m_diw.min_y && scanline < m_diw.max_y)
+ planes > 0 && scanline >= m_diw.top() && scanline < m_diw.bottom())
{
int pfpix0 = 0, pfpix1 = 0, collide;
@@ -922,7 +922,7 @@ void amiga_state::render_scanline(bitmap_ind16 &bitmap, int scanline)
CUSTOM_REG(REG_CLXDAT) |= 0x001;
/* if we are within the display region, render */
- if (dst != nullptr && x >= m_diw.min_x && x < m_diw.max_x)
+ if (dst != nullptr && x >= m_diw.left() && x < m_diw.right())
{
int pix, pri;
@@ -1012,7 +1012,7 @@ void amiga_state::render_scanline(bitmap_ind16 &bitmap, int scanline)
}
// end of the line: time to add the modulos
- if (scanline >= m_diw.min_y && scanline < m_diw.max_y)
+ if (scanline >= m_diw.top() && scanline < m_diw.bottom())
{
// update odd planes
for (pl = 0; pl < planes; pl += 2)
@@ -1054,11 +1054,11 @@ uint32_t amiga_state::screen_update_amiga(screen_device &screen, bitmap_ind16 &b
{
// sometimes the core tells us to render a bunch of lines to keep up (resolution change, for example)
// this causes trouble for us since it can happen at any time
- if (cliprect.min_y != cliprect.max_y)
+ if (cliprect.top() != cliprect.bottom())
return 0;
// render each scanline in the visible region
- for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
+ for (int y = cliprect.top(); y <= cliprect.bottom(); y++)
render_scanline(bitmap, y);
return 0;
diff --git a/src/mame/video/amigaaga.cpp b/src/mame/video/amigaaga.cpp
index 0cfc1f23c87..987cbdeb4ad 100644
--- a/src/mame/video/amigaaga.cpp
+++ b/src/mame/video/amigaaga.cpp
@@ -596,7 +596,7 @@ void amiga_state::aga_render_scanline(bitmap_rgb32 &bitmap, int scanline)
/* to render, we must have bitplane DMA enabled, at least 1 plane, and be within the */
/* vertical display window */
if ((CUSTOM_REG(REG_DMACON) & (DMACON_BPLEN | DMACON_DMAEN)) == (DMACON_BPLEN | DMACON_DMAEN) &&
- planes > 0 && scanline >= m_diw.min_y && scanline < m_diw.max_y)
+ planes > 0 && scanline >= m_diw.top() && scanline < m_diw.bottom())
{
int pfpix0 = 0, pfpix1 = 0, collide;
@@ -701,7 +701,7 @@ void amiga_state::aga_render_scanline(bitmap_rgb32 &bitmap, int scanline)
CUSTOM_REG(REG_CLXDAT) |= 0x001;
/* if we are within the display region, render */
- if (dst != nullptr && x >= m_diw.min_x && x < m_diw.max_x)
+ if (dst != nullptr && x >= m_diw.left() && x < m_diw.right())
{
int pix, pri;
@@ -814,7 +814,7 @@ void amiga_state::aga_render_scanline(bitmap_rgb32 &bitmap, int scanline)
#endif
/* end of the line: time to add the modulos */
- if (scanline >= m_diw.min_y && scanline < m_diw.max_y)
+ if (scanline >= m_diw.top() && scanline < m_diw.bottom())
{
/* update odd planes */
for (pl = 0; pl < planes; pl += 2)
@@ -853,11 +853,11 @@ void amiga_state::aga_render_scanline(bitmap_rgb32 &bitmap, int scanline)
uint32_t amiga_state::screen_update_amiga_aga(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- if (cliprect.min_y != cliprect.max_y)
+ if (cliprect.top() != cliprect.bottom())
return 0;
// render each scanline in the visible region
- for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
+ for (int y = cliprect.top(); y <= cliprect.bottom(); y++)
aga_render_scanline(bitmap, y);
return 0;
diff --git a/src/mame/video/apple2.cpp b/src/mame/video/apple2.cpp
index be61550aa25..31229729742 100644
--- a/src/mame/video/apple2.cpp
+++ b/src/mame/video/apple2.cpp
@@ -361,8 +361,8 @@ void a2_video_device::lores_update(screen_device &screen, bitmap_ind16 &bitmap,
}
/* perform adjustments */
- beginrow = std::max(beginrow, cliprect.min_y);
- endrow = std::min(endrow, cliprect.max_y);
+ beginrow = (std::max)(beginrow, cliprect.top());
+ endrow = (std::min)(endrow, cliprect.bottom());
if (!(m_sysconfig & 0x03))
{
@@ -461,8 +461,8 @@ void a2_video_device::dlores_update(screen_device &screen, bitmap_ind16 &bitmap,
}
/* perform adjustments */
- beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8));
- endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7);
+ beginrow = (std::max)(beginrow, cliprect.top() - (cliprect.top() % 8));
+ endrow = (std::min)(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7);
if (!(m_sysconfig & 0x03))
{
@@ -607,8 +607,8 @@ void a2_video_device::text_update(screen_device &screen, bitmap_ind16 &bitmap, c
start_address = m_page2 ? 0x800 : 0x400;
}
- beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8));
- endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7);
+ beginrow = (std::max)(beginrow, cliprect.top() - (cliprect.top() % 8));
+ endrow = (std::min)(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7);
switch (m_sysconfig & 0x03)
{
@@ -654,8 +654,8 @@ void a2_video_device::text_update_orig(screen_device &screen, bitmap_ind16 &bitm
int fg = 0;
int bg = 0;
- beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8));
- endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7);
+ beginrow = (std::max)(beginrow, cliprect.top() - (cliprect.top() % 8));
+ endrow = (std::min)(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7);
switch (m_sysconfig & 0x03)
{
@@ -685,8 +685,8 @@ void a2_video_device::text_update_jplus(screen_device &screen, bitmap_ind16 &bit
int fg = 0;
int bg = 0;
- beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8));
- endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7);
+ beginrow = (std::max)(beginrow, cliprect.top() - (cliprect.top() % 8));
+ endrow = (std::min)(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7);
switch (m_sysconfig & 0x03)
{
@@ -716,8 +716,8 @@ void a2_video_device::text_update_ultr(screen_device &screen, bitmap_ind16 &bitm
int fg = 0;
int bg = 0;
- beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8));
- endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7);
+ beginrow = (std::max)(beginrow, cliprect.top() - (cliprect.top() % 8));
+ endrow = (std::min)(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7);
switch (m_sysconfig & 0x03)
{
@@ -753,19 +753,19 @@ void a2_video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, co
int begincol = 0, endcol = 40;
/* sanity checks */
- if (beginrow < cliprect.min_y)
- beginrow = cliprect.min_y;
- if (endrow > cliprect.max_y)
- endrow = cliprect.max_y;
+ if (beginrow < cliprect.top())
+ beginrow = cliprect.top();
+ if (endrow > cliprect.bottom())
+ endrow = cliprect.bottom();
if (endrow < beginrow)
return;
// we generate 2 pixels per "column" so adjust
- if (begincol < (cliprect.min_x/14))
- begincol = (cliprect.min_x/14);
- if (endcol > (cliprect.max_x/14))
- endcol = (cliprect.max_x/14);
- if (cliprect.max_x > 39*14)
+ if (begincol < (cliprect.left()/14))
+ begincol = (cliprect.left()/14);
+ if (endcol > (cliprect.right()/14))
+ endcol = (cliprect.right()/14);
+ if (cliprect.right() > 39*14)
endcol = 40;
if (endcol < begincol)
return;
@@ -872,10 +872,10 @@ void a2_video_device::hgr_update_tk2000(screen_device &screen, bitmap_ind16 &bit
int mon_type = m_sysconfig & 0x03;
/* sanity checks */
- if (beginrow < cliprect.min_y)
- beginrow = cliprect.min_y;
- if (endrow > cliprect.max_y)
- endrow = cliprect.max_y;
+ if (beginrow < cliprect.top())
+ beginrow = cliprect.top();
+ if (endrow > cliprect.bottom())
+ endrow = cliprect.bottom();
if (endrow < beginrow)
return;
@@ -962,10 +962,10 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c
int mon_type = m_sysconfig & 0x03;
/* sanity checks */
- if (beginrow < cliprect.min_y)
- beginrow = cliprect.min_y;
- if (endrow > cliprect.max_y)
- endrow = cliprect.max_y;
+ if (beginrow < cliprect.top())
+ beginrow = cliprect.top();
+ if (endrow > cliprect.bottom())
+ endrow = cliprect.bottom();
if (endrow < beginrow)
return;
@@ -1084,7 +1084,7 @@ uint32_t a2_video_device::screen_update_GS(screen_device &screen, bitmap_rgb32 &
int beamy;
uint16_t *a2pixel;
- beamy = cliprect.min_y;
+ beamy = cliprect.top();
if (m_newvideo & 0x80)
{
@@ -1302,8 +1302,8 @@ void a2_video_device::text_updateGS(screen_device &screen, bitmap_ind16 &bitmap,
start_address = m_page2 ? 0x800 : 0x400;
}
- beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8));
- endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7);
+ beginrow = (std::max)(beginrow, cliprect.top() - (cliprect.top() % 8));
+ endrow = (std::min)(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7);
for (row = beginrow; row <= endrow; row += 8)
{
diff --git a/src/mame/video/apple3.cpp b/src/mame/video/apple3.cpp
index 724907d6c23..cfc4a675c5b 100644
--- a/src/mame/video/apple3.cpp
+++ b/src/mame/video/apple3.cpp
@@ -149,8 +149,8 @@ void apple3_state::text40(bitmap_ind16 &bitmap, const rectangle &cliprect)
uint8_t *ram = m_ram->pointer();
uint32_t ram_size = m_ram->size();
int smooth = m_va | (m_vb << 1) | (m_vc << 2);
- int beginrow = (cliprect.min_y - (cliprect.min_y % 8)) / 8;
- int endrow = (cliprect.max_y - (cliprect.max_y % 8) + 7) / 8;
+ int beginrow = (cliprect.top() - (cliprect.top() % 8)) / 8;
+ int endrow = (cliprect.bottom() - (cliprect.bottom() % 8) + 7) / 8;
for (y = beginrow; y <= endrow; y++)
{
@@ -220,8 +220,8 @@ void apple3_state::text80(bitmap_ind16 &bitmap, const rectangle &cliprect)
uint8_t *ram = m_ram->pointer();
uint32_t ram_size = m_ram->size();
int smooth = m_va | (m_vb << 1) | (m_vc << 2);
- int beginrow = (cliprect.min_y - (cliprect.min_y % 8)) / 8;
- int endrow = (cliprect.max_y - (cliprect.max_y % 8) + 7) / 8;
+ int beginrow = (cliprect.top() - (cliprect.top() % 8)) / 8;
+ int endrow = (cliprect.bottom() - (cliprect.bottom() % 8) + 7) / 8;
for (y = beginrow; y <= endrow; y++)
{
@@ -284,7 +284,7 @@ void apple3_state::graphics_hgr(bitmap_ind16 &bitmap, const rectangle &cliprect)
uint8_t *ram = m_ram->pointer();
int smooth = m_va | (m_vb << 1) | (m_vc << 2);
- for (y = cliprect.min_y; y <= cliprect.max_y; y++)
+ for (y = cliprect.top(); y <= cliprect.bottom(); y++)
{
ly = y;
if (m_smoothscr)
@@ -329,7 +329,7 @@ void apple3_state::graphics_chgr(bitmap_ind16 &bitmap, const rectangle &cliprect
uint8_t *ram = m_ram->pointer();
int smooth = m_va | (m_vb << 1) | (m_vc << 2);
- for (y = cliprect.min_y; y <= cliprect.max_y; y++)
+ for (y = cliprect.top(); y <= cliprect.bottom(); y++)
{
ly = y;
if (m_smoothscr)
@@ -386,7 +386,7 @@ void apple3_state::graphics_shgr(bitmap_ind16 &bitmap, const rectangle &cliprect
uint8_t *ram = m_ram->pointer();
int smooth = m_va | (m_vb << 1) | (m_vc << 2);
- for (y = cliprect.min_y; y <= cliprect.max_y; y++)
+ for (y = cliprect.top(); y <= cliprect.bottom(); y++)
{
ly = y;
if (m_smoothscr)
@@ -441,7 +441,7 @@ void apple3_state::graphics_chires(bitmap_ind16 &bitmap, const rectangle &clipre
uint8_t *ram = m_ram->pointer();
int smooth = m_va | (m_vb << 1) | (m_vc << 2);
- for (y = cliprect.min_y; y <= cliprect.max_y; y++)
+ for (y = cliprect.top(); y <= cliprect.bottom(); y++)
{
ly = y;
if (m_smoothscr)
diff --git a/src/mame/video/aquarium.cpp b/src/mame/video/aquarium.cpp
index 75562c6386f..89a2929e6b5 100644
--- a/src/mame/video/aquarium.cpp
+++ b/src/mame/video/aquarium.cpp
@@ -80,12 +80,12 @@ void aquarium_state::video_start()
void aquarium_state::mix_sprite_bitmap(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority_mask, int priority_value)
{
- for (int y = cliprect.min_y;y <= cliprect.max_y;y++)
+ for (int y = cliprect.top();y <= cliprect.bottom();y++)
{
uint16_t* srcline = &m_temp_sprite_bitmap.pix16(y);
uint16_t* dstline = &bitmap.pix16(y);
- for (int x = cliprect.min_x;x <= cliprect.max_x;x++)
+ for (int x = cliprect.left();x <= cliprect.right();x++)
{
uint16_t pixel = srcline[x];
diff --git a/src/mame/video/arcadecl.cpp b/src/mame/video/arcadecl.cpp
index 57569f0040d..446ebb928a5 100644
--- a/src/mame/video/arcadecl.cpp
+++ b/src/mame/video/arcadecl.cpp
@@ -78,11 +78,11 @@ uint32_t arcadecl_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
// draw and merge the MO
bitmap_ind16 &mobitmap = m_mob->bitmap();
for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next())
- for (int y = rect->min_y; y <= rect->max_y; y++)
+ for (int y = rect->top(); y <= rect->bottom(); y++)
{
uint16_t *mo = &mobitmap.pix16(y);
uint16_t *pf = &bitmap.pix16(y);
- for (int x = rect->min_x; x <= rect->max_x; x++)
+ for (int x = rect->left(); x <= rect->right(); x++)
if (mo[x] != 0xffff)
{
// not yet verified
@@ -104,13 +104,13 @@ uint32_t arcadecl_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
uint32_t sparkz_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
// update any dirty scanlines
- for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
+ for (int y = cliprect.top(); y <= cliprect.bottom(); y++)
{
const uint16_t *const src = &m_bitmap[256 * y];
uint16_t *const dst = &bitmap.pix16(y);
/* regenerate the line */
- for (int x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2)
+ for (int x = cliprect.left() & ~1; x <= cliprect.right(); x += 2)
{
int bits = src[(x - 8) / 2];
dst[x + 0] = bits >> 8;
diff --git a/src/mame/video/atarig42.cpp b/src/mame/video/atarig42.cpp
index b553cc0f512..aa427b3d088 100644
--- a/src/mame/video/atarig42.cpp
+++ b/src/mame/video/atarig42.cpp
@@ -174,10 +174,10 @@ uint32_t atarig42_state::screen_update_atarig42(screen_device &screen, bitmap_in
/* copy the motion objects on top */
{
bitmap_ind16 &mo_bitmap = m_rle->vram(0);
- int left = cliprect.min_x;
- int top = cliprect.min_y;
- int right = cliprect.max_x + 1;
- int bottom = cliprect.max_y + 1;
+ int left = cliprect.left();
+ int top = cliprect.top();
+ int right = cliprect.right() + 1;
+ int bottom = cliprect.bottom() + 1;
int x, y;
/* now blend with the playfield */
diff --git a/src/mame/video/atarigt.cpp b/src/mame/video/atarigt.cpp
index d9cab371fb3..67563b639c5 100644
--- a/src/mame/video/atarigt.cpp
+++ b/src/mame/video/atarigt.cpp
@@ -503,7 +503,7 @@ uint32_t atarigt_state::screen_update_atarigt(screen_device &screen, bitmap_rgb3
const pen_t *mram = &m_palette->pens()[(color_latch & 0xc0) << 7];
/* now do the nasty blend */
- for (y = cliprect.min_y; y <= cliprect.max_y; y++)
+ for (y = cliprect.top(); y <= cliprect.bottom(); y++)
{
uint16_t *an = &m_an_bitmap.pix16(y);
uint16_t *pf = &m_pf_bitmap.pix16(y);
@@ -514,7 +514,7 @@ uint32_t atarigt_state::screen_update_atarigt(screen_device &screen, bitmap_rgb3
/* Primal Rage: no TRAM, slightly different priorities */
if (m_is_primrage)
{
- for (x = cliprect.min_x; x <= cliprect.max_x; x++)
+ for (x = cliprect.left(); x <= cliprect.right(); x++)
{
uint8_t pfpri = (pf[x] >> 10) & 7;
uint8_t mopri = mo[x] >> ATARIRLE_PRIORITY_SHIFT;
@@ -548,7 +548,7 @@ uint32_t atarigt_state::screen_update_atarigt(screen_device &screen, bitmap_rgb3
/* T-Mek: full TRAM and all effects */
else
{
- for (x = cliprect.min_x; x <= cliprect.max_x; x++)
+ for (x = cliprect.left(); x <= cliprect.right(); x++)
{
uint8_t pfpri = (pf[x] >> 10) & 7;
uint8_t mopri = mo[x] >> ATARIRLE_PRIORITY_SHIFT;
diff --git a/src/mame/video/atarigx2.cpp b/src/mame/video/atarigx2.cpp
index 3159d1980a5..7a0d8229f27 100644
--- a/src/mame/video/atarigx2.cpp
+++ b/src/mame/video/atarigx2.cpp
@@ -182,10 +182,10 @@ uint32_t atarigx2_state::screen_update_atarigx2(screen_device &screen, bitmap_in
/* copy the motion objects on top */
{
bitmap_ind16 &mo_bitmap = m_rle->vram(0);
- int left = cliprect.min_x;
- int top = cliprect.min_y;
- int right = cliprect.max_x + 1;
- int bottom = cliprect.max_y + 1;
+ int left = cliprect.left();
+ int top = cliprect.top();
+ int right = cliprect.left() + 1;
+ int bottom = cliprect.bottom() + 1;
int x, y;
/* now blend with the playfield */
diff --git a/src/mame/video/atarimo.cpp b/src/mame/video/atarimo.cpp
index 35a63f30a38..589da0a3c5d 100644
--- a/src/mame/video/atarimo.cpp
+++ b/src/mame/video/atarimo.cpp
@@ -161,8 +161,8 @@ atari_motion_objects_device::atari_motion_objects_device(const machine_config &m
void atari_motion_objects_device::draw(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
// compute start/stop bands
- int startband = ((cliprect.min_y + m_yscroll - m_slipoffset) & m_bitmapymask) >> m_slipshift;
- int stopband = ((cliprect.max_y + m_yscroll - m_slipoffset) & m_bitmapymask) >> m_slipshift;
+ int startband = ((cliprect.top() + m_yscroll - m_slipoffset) & m_bitmapymask) >> m_slipshift;
+ int stopband = ((cliprect.bottom() + m_yscroll - m_slipoffset) & m_bitmapymask) >> m_slipshift;
if (startband > stopband)
startband -= m_bitmapheight >> m_slipshift;
if (m_slipshift == 0)
@@ -358,7 +358,7 @@ void atari_motion_objects_device::device_timer(emu_timer &timer, device_timer_id
if (param > 0)
screen().update_partial(param - 1);
param += 64;
- if (param >= screen().visible_area().max_y)
+ if (param >= screen().visible_area().bottom())
param = 0;
timer.adjust(screen().time_until_pos(param), param);
break;
@@ -504,19 +504,19 @@ void atari_motion_objects_device::render_object(bitmap_ind16 &bitmap, const rect
for (int y = 0, sy = ypos; y < height; y++, sy += yadv)
{
// clip the Y coordinate
- if (sy <= cliprect.min_y - m_tileheight)
+ if (sy <= cliprect.top() - m_tileheight)
{
code += width;
continue;
}
- else if (sy > cliprect.max_y)
+ else if (sy > cliprect.bottom())
break;
// loop over the width
for (int x = 0, sx = xpos; x < width; x++, sx += xadv, code++)
{
// clip the X coordinate
- if (sx <= -cliprect.min_x - m_tilewidth || sx > cliprect.max_x)
+ if (sx <= -cliprect.left() - m_tilewidth || sx > cliprect.right())
continue;
// draw the sprite
@@ -533,19 +533,19 @@ void atari_motion_objects_device::render_object(bitmap_ind16 &bitmap, const rect
for (int x = 0, sx = xpos; x < width; x++, sx += xadv)
{
// clip the X coordinate
- if (sx <= cliprect.min_x - m_tilewidth)
+ if (sx <= cliprect.left() - m_tilewidth)
{
code += height;
continue;
}
- else if (sx > cliprect.max_x)
+ else if (sx > cliprect.right())
break;
// loop over the height
for (int y = 0, sy = ypos; y < height; y++, sy += yadv, code++)
{
// clip the X coordinate
- if (sy <= -cliprect.min_y - m_tileheight || sy > cliprect.max_y)
+ if (sy <= -cliprect.top() - m_tileheight || sy > cliprect.bottom())
continue;
// draw the sprite
diff --git a/src/mame/video/atarirle.cpp b/src/mame/video/atarirle.cpp
index 5c54a2a785d..fb5240f2b62 100644
--- a/src/mame/video/atarirle.cpp
+++ b/src/mame/video/atarirle.cpp
@@ -103,7 +103,7 @@ WRITE8_MEMBER(atari_rle_objects_device::control_write)
if (scanline < cliprect.max_y)
cliprect.max_y = scanline;
-//logerror(" partial erase %d-%d (frame %d)\n", cliprect.min_y, cliprect.max_y, (oldbits & ATARIRLE_CONTROL_FRAME) >> 2);
+ //logerror(" partial erase %d-%d (frame %d)\n", cliprect.top(), cliprect.bottom(), (oldbits & ATARIRLE_CONTROL_FRAME) >> 2);
// erase the bitmap
m_vram[0][(oldbits & ATARIRLE_CONTROL_FRAME) >> 2].fill(0, cliprect);
@@ -155,7 +155,7 @@ void atari_rle_objects_device::vblank_callback(screen_device &screen, bool state
if (m_partial_scanline + 1 > cliprect.min_y)
cliprect.min_y = m_partial_scanline + 1;
- //logerror(" partial erase %d-%d (frame %d)\n", cliprect.min_y, cliprect.max_y, (m_control_bits & ATARIRLE_CONTROL_FRAME) >> 2);
+ //logerror(" partial erase %d-%d (frame %d)\n", cliprect.top(), cliprect.bottom(), (m_control_bits & ATARIRLE_CONTROL_FRAME) >> 2);
// erase the bitmap
m_vram[0][(m_control_bits & ATARIRLE_CONTROL_FRAME) >> 2].fill(0, cliprect);
@@ -213,10 +213,7 @@ void atari_rle_objects_device::device_start()
// set up a cliprect
m_cliprect = screen().visible_area();
if (m_rightclip != 0)
- {
- m_cliprect.min_x = m_leftclip;
- m_cliprect.max_x = m_rightclip;
- }
+ m_cliprect.setx(m_leftclip, m_rightclip);
// compute the checksums
memset(m_checksums, 0, sizeof(m_checksums));
@@ -500,7 +497,7 @@ if (count++ == atarirle_hilite_index)
x = (int16_t)(x | ~m_xposmask.mask());
if (y & ((m_yposmask.mask() + 1) >> 1))
y = (int16_t)(y | ~m_yposmask.mask());
- x += m_cliprect.min_x;
+ x += m_cliprect.left();
// merge priority and color
color = (color << 4) | (priority << ATARIRLE_PRIORITY_SHIFT);
@@ -536,7 +533,7 @@ void atari_rle_objects_device::draw_rle(bitmap_ind16 &bitmap, const rectangle &c
if (hflip)
scaled_xoffs = ((xscale * info.width) >> 12) - scaled_xoffs;
-//if (clip.min_y == screen().visible_area().min_y)
+//if (clip.top() == screen().visible_area().top())
//logerror(" Sprite: c=%04X l=%04X h=%d X=%4d (o=%4d w=%3d) Y=%4d (o=%4d h=%d) s=%04X\n",
// code, color, hflip,
// x, -scaled_xoffs, (xscale * info.width) >> 12,
@@ -579,30 +576,30 @@ void atari_rle_objects_device::draw_rle_zoom(bitmap_ind16 &bitmap, const rectang
// left edge clip
int pixels_to_skip = 0;
bool xclipped = false;
- if (sx < clip.min_x)
- pixels_to_skip = clip.min_x - sx, xclipped = true;
- if (sx > clip.max_x)
+ if (sx < clip.left())
+ pixels_to_skip = clip.left() - sx, xclipped = true;
+ if (sx > clip.right())
return;
// right edge clip
- if (ex > clip.max_x)
- ex = clip.max_x, xclipped = true;
- else if (ex < clip.min_x)
+ if (ex > clip.right())
+ ex = clip.right(), xclipped = true;
+ else if (ex < clip.left())
return;
// top edge clip
- if (sy < clip.min_y)
+ if (sy < clip.top())
{
- sourcey += (clip.min_y - sy) * dy;
- sy = clip.min_y;
+ sourcey += (clip.top() - sy) * dy;
+ sy = clip.top();
}
- else if (sy > clip.max_y)
+ else if (sy > clip.bottom())
return;
// bottom edge clip
- if (ey > clip.max_y)
- ey = clip.max_y;
- else if (ey < clip.min_y)
+ if (ey > clip.bottom())
+ ey = clip.bottom();
+ else if (ey < clip.top())
return;
// loop top to bottom
@@ -758,30 +755,30 @@ void atari_rle_objects_device::draw_rle_zoom_hflip(bitmap_ind16 &bitmap, const r
// left edge clip
int pixels_to_skip = 0;
bool xclipped = false;
- if (sx < clip.min_x)
- sx = clip.min_x, xclipped = true;
- if (sx > clip.max_x)
+ if (sx < clip.left())
+ sx = clip.left(), xclipped = true;
+ if (sx > clip.right())
return;
// right edge clip
- if (ex > clip.max_x)
- pixels_to_skip = ex - clip.max_x, xclipped = true;
- else if (ex < clip.min_x)
+ if (ex > clip.right())
+ pixels_to_skip = ex - clip.right(), xclipped = true;
+ else if (ex < clip.left())
return;
// top edge clip
- if (sy < clip.min_y)
+ if (sy < clip.top())
{
- sourcey += (clip.min_y - sy) * dy;
- sy = clip.min_y;
+ sourcey += (clip.top() - sy) * dy;
+ sy = clip.top();
}
- else if (sy > clip.max_y)
+ else if (sy > clip.bottom())
return;
// bottom edge clip
- if (ey > clip.max_y)
- ey = clip.max_y;
- else if (ey < clip.min_y)
+ if (ey > clip.bottom())
+ ey = clip.bottom();
+ else if (ey < clip.top())
return;
// loop top to bottom
@@ -933,10 +930,10 @@ void atari_rle_objects_device::hilite_object(bitmap_ind16 &bitmap, int hilite)
int y = m_yposmask.extract(m_ram, hilite);
if (x & ((m_xposmask.mask() + 1) >> 1))
- x = (int16_t)(x | ~m_xposmask.mask());
+ x = int16_t(x | ~m_xposmask.mask());
if (y & ((m_yposmask.mask() + 1) >> 1))
- y = (int16_t)(y | ~m_yposmask.mask());
- x += m_cliprect.min_x;
+ y = int16_t(y | ~m_yposmask.mask());
+ x += m_cliprect.left();
// merge priority and color
color = (color << 4) | (priority << ATARIRLE_PRIORITY_SHIFT);
@@ -969,27 +966,27 @@ void atari_rle_objects_device::hilite_object(bitmap_ind16 &bitmap, int hilite)
// left edge clip
const rectangle &visarea = screen().visible_area();
- if (sx < visarea.min_x)
- sx = visarea.min_x;
- if (sx > visarea.max_x)
+ if (sx < visarea.left())
+ sx = visarea.left();
+ if (sx > visarea.right())
break;
// right edge clip
- if (ex > visarea.max_x)
- ex = visarea.max_x;
- else if (ex < visarea.min_x)
+ if (ex > visarea.right())
+ ex = visarea.right();
+ else if (ex < visarea.left())
break;
// top edge clip
- if (sy < visarea.min_y)
- sy = visarea.min_y;
- else if (sy > visarea.max_y)
+ if (sy < visarea.top())
+ sy = visarea.top();
+ else if (sy > visarea.bottom())
break;
// bottom edge clip
- if (ey > visarea.max_y)
- ey = visarea.max_y;
- else if (ey < visarea.min_y)
+ if (ey > visarea.bottom())
+ ey = visarea.bottom();
+ else if (ey < visarea.left())
break;
for (int ty = sy; ty <= ey; ty++)
diff --git a/src/mame/video/atarisy1.cpp b/src/mame/video/atarisy1.cpp
index be249e8e873..d5f550200b5 100644
--- a/src/mame/video/atarisy1.cpp
+++ b/src/mame/video/atarisy1.cpp
@@ -291,7 +291,7 @@ WRITE16_MEMBER( atarisy1_state::atarisy1_yscroll_w )
/* because this latches a new value into the scroll base,
we need to adjust for the scanline */
adjusted_scroll = newscroll;
- if (scanline <= m_screen->visible_area().max_y)
+ if (scanline <= m_screen->visible_area().bottom())
adjusted_scroll -= (scanline + 1);
m_playfield_tilemap->set_scrolly(0, adjusted_scroll);
@@ -472,11 +472,11 @@ uint32_t atarisy1_state::screen_update_atarisy1(screen_device &screen, bitmap_in
// draw and merge the MO
bitmap_ind16 &mobitmap = m_mob->bitmap();
for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next())
- for (int y = rect->min_y; y <= rect->max_y; y++)
+ for (int y = rect->top(); y <= rect->bottom(); y++)
{
uint16_t *mo = &mobitmap.pix16(y);
uint16_t *pf = &bitmap.pix16(y);
- for (int x = rect->min_x; x <= rect->max_x; x++)
+ for (int x = rect->left(); x <= rect->right(); x++)
if (mo[x] != 0xffff)
{
/* high priority MO? */
diff --git a/src/mame/video/atarisy2.cpp b/src/mame/video/atarisy2.cpp
index 0c735cccc4f..4dc92540ca8 100644
--- a/src/mame/video/atarisy2.cpp
+++ b/src/mame/video/atarisy2.cpp
@@ -248,12 +248,12 @@ uint32_t atarisy2_state::screen_update_atarisy2(screen_device &screen, bitmap_in
/* draw and merge the MO */
bitmap_ind16 &mobitmap = m_mob->bitmap();
for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next())
- for (int y = rect->min_y; y <= rect->max_y; y++)
+ for (int y = rect->top(); y <= rect->bottom(); y++)
{
uint16_t *mo = &mobitmap.pix16(y);
uint16_t *pf = &bitmap.pix16(y);
uint8_t *pri = &priority_bitmap.pix8(y);
- for (int x = rect->min_x; x <= rect->max_x; x++)
+ for (int x = rect->left(); x <= rect->right(); x++)
if (mo[x] != 0xffff)
{
int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT;
diff --git a/src/mame/video/atarivad.cpp b/src/mame/video/atarivad.cpp
index 85a80776954..0798a0d7b8a 100644
--- a/src/mame/video/atarivad.cpp
+++ b/src/mame/video/atarivad.cpp
@@ -26,24 +26,24 @@ DEFINE_DEVICE_TYPE(ATARI_VAD, atari_vad_device, "atarivad", "Atari VAD")
//-------------------------------------------------
atari_vad_device::atari_vad_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, ATARI_VAD, tag, owner, clock),
- device_video_interface(mconfig, *this),
- m_scanline_int_cb(*this),
- m_alpha_tilemap(*this, "alpha"),
- m_playfield_tilemap(*this, "playfield"),
- m_playfield2_tilemap(*this, "playfield2"),
- m_mob(*this, "mob"),
- m_eof_data(*this, "eof"),
- m_scanline_int_timer(nullptr),
- m_tilerow_update_timer(nullptr),
- m_eof_timer(nullptr),
- m_palette_bank(0),
- m_pf0_xscroll_raw(0),
- m_pf0_yscroll(0),
- m_pf1_xscroll_raw(0),
- m_pf1_yscroll(0),
- m_mo_xscroll(0),
- m_mo_yscroll(0)
+ : device_t(mconfig, ATARI_VAD, tag, owner, clock)
+ , device_video_interface(mconfig, *this)
+ , m_scanline_int_cb(*this)
+ , m_alpha_tilemap(*this, "alpha")
+ , m_playfield_tilemap(*this, "playfield")
+ , m_playfield2_tilemap(*this, "playfield2")
+ , m_mob(*this, "mob")
+ , m_eof_data(*this, "eof")
+ , m_scanline_int_timer(nullptr)
+ , m_tilerow_update_timer(nullptr)
+ , m_eof_timer(nullptr)
+ , m_palette_bank(0)
+ , m_pf0_xscroll_raw(0)
+ , m_pf0_yscroll(0)
+ , m_pf1_xscroll_raw(0)
+ , m_pf1_yscroll(0)
+ , m_mo_xscroll(0)
+ , m_mo_yscroll(0)
{
}
@@ -76,7 +76,7 @@ READ16_MEMBER(atari_vad_device::control_read)
int result = screen().vpos();
if (result > 255)
result = 255;
- if (result > screen().visible_area().max_y)
+ if (result > screen().visible_area().bottom())
result |= 0x4000;
return result;
}
@@ -423,7 +423,7 @@ void atari_vad_device::update_parameter(uint16_t newword)
void atari_vad_device::update_tilerow(emu_timer &timer, int scanline)
{
// skip if out of bounds, or not enabled
- if (scanline <= screen().visible_area().max_y && (m_control[0x0a] & 0x2000) != 0 && m_alpha_tilemap != nullptr)
+ if (scanline <= screen().visible_area().bottom() && (m_control[0x0a] & 0x2000) != 0 && m_alpha_tilemap != nullptr)
{
// iterate over non-visible alpha tiles in this row
int offset = scanline / 8 * 64 + 48 + 2 * (scanline % 8);
diff --git a/src/mame/video/badlands.cpp b/src/mame/video/badlands.cpp
index c8c0a955b99..beab5dd320f 100644
--- a/src/mame/video/badlands.cpp
+++ b/src/mame/video/badlands.cpp
@@ -112,11 +112,11 @@ uint32_t badlands_state::screen_update_badlands(screen_device &screen, bitmap_in
// draw and merge the MO
bitmap_ind16 &mobitmap = m_mob->bitmap();
for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next())
- for (int y = rect->min_y; y <= rect->max_y; y++)
+ for (int y = rect->top(); y <= rect->bottom(); y++)
{
uint16_t *mo = &mobitmap.pix16(y);
uint16_t *pf = &bitmap.pix16(y);
- for (int x = rect->min_x; x <= rect->max_x; x++)
+ for (int x = rect->left(); x <= rect->right(); x++)
if (mo[x] != 0xffff)
{
/* not yet verified
diff --git a/src/mame/video/batman.cpp b/src/mame/video/batman.cpp
index e9ee2caa8e9..1b0d8632864 100644
--- a/src/mame/video/batman.cpp
+++ b/src/mame/video/batman.cpp
@@ -118,12 +118,12 @@ uint32_t batman_state::screen_update_batman(screen_device &screen, bitmap_ind16
// draw and merge the MO
bitmap_ind16 &mobitmap = m_vad->mob().bitmap();
for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next())
- for (int y = rect->min_y; y <= rect->max_y; y++)
+ for (int y = rect->top(); y <= rect->bottom(); y++)
{
uint16_t *mo = &mobitmap.pix16(y);
uint16_t *pf = &bitmap.pix16(y);
uint8_t *pri = &priority_bitmap.pix8(y);
- for (int x = rect->min_x; x <= rect->max_x; x++)
+ for (int x = rect->left(); x <= rect->right(); x++)
if (mo[x] != 0xffff)
{
/* verified on real hardware:
@@ -190,11 +190,11 @@ uint32_t batman_state::screen_update_batman(screen_device &screen, bitmap_ind16
/* now go back and process the upper bit of MO priority */
for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next())
- for (int y = rect->min_y; y <= rect->max_y; y++)
+ for (int y = rect->top(); y <= rect->bottom(); y++)
{
uint16_t *mo = &mobitmap.pix16(y);
uint16_t *pf = &bitmap.pix16(y);
- for (int x = rect->min_x; x <= rect->max_x; x++)
+ for (int x = rect->left(); x <= rect->right(); x++)
if (mo[x] != 0xffff)
{
int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT;
diff --git a/src/mame/video/beathead.cpp b/src/mame/video/beathead.cpp
index 5c6586b4fdc..daff388b72a 100644
--- a/src/mame/video/beathead.cpp
+++ b/src/mame/video/beathead.cpp
@@ -145,29 +145,29 @@ uint32_t beathead_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
int x, y;
/* generate the final screen */
- for (y = cliprect.min_y; y <= cliprect.max_y; y++)
+ for (y = cliprect.top(); y <= cliprect.bottom(); y++)
{
pen_t pen_base = (*m_palette_select & 0x7f) * 256;
uint16_t scanline[336];
/* blanking */
if (m_finescroll & 8)
- for (x = cliprect.min_x; x <= cliprect.max_x; x++)
+ for (x = cliprect.left(); x <= cliprect.right(); x++)
scanline[x] = pen_base;
/* non-blanking */
else
{
offs_t scanline_offset = m_vram_latch_offset + (m_finescroll & 3);
- offs_t src = scanline_offset + cliprect.min_x;
+ offs_t src = scanline_offset + cliprect.left();
/* unswizzle the scanline first */
- for (x = cliprect.min_x; x <= cliprect.max_x; x++)
+ for (x = cliprect.left(); x <= cliprect.right(); x++)
scanline[x] = pen_base | videoram[BYTE4_XOR_LE(src++)];
}
/* then draw it */
- draw_scanline16(bitmap, cliprect.min_x, y, cliprect.width(), &scanline[cliprect.min_x], nullptr);
+ draw_scanline16(bitmap, cliprect.left(), y, cliprect.width(), &scanline[cliprect.left()], nullptr);
}
return 0;
}
diff --git a/src/mame/video/blstroid.cpp b/src/mame/video/blstroid.cpp
index af8c6b9a12e..19c8307f2b8 100644
--- a/src/mame/video/blstroid.cpp
+++ b/src/mame/video/blstroid.cpp
@@ -149,11 +149,11 @@ uint32_t blstroid_state::screen_update_blstroid(screen_device &screen, bitmap_in
/* draw and merge the MO */
bitmap_ind16 &mobitmap = m_mob->bitmap();
for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next())
- for (int y = rect->min_y; y <= rect->max_y; y++)
+ for (int y = rect->top(); y <= rect->bottom(); y++)
{
uint16_t *mo = &mobitmap.pix16(y);
uint16_t *pf = &bitmap.pix16(y);
- for (int x = rect->min_x; x <= rect->max_x; x++)
+ for (int x = rect->left(); x <= rect->right(); x++)
if (mo[x] != 0xffff)
{
/* verified via schematics
diff --git a/src/mame/video/boogwing.cpp b/src/mame/video/boogwing.cpp
index 407d47b6085..52564201416 100644
--- a/src/mame/video/boogwing.cpp
+++ b/src/mame/video/boogwing.cpp
@@ -40,7 +40,7 @@ void boogwing_state::mix_boogwing(screen_device &screen, bitmap_rgb32 &bitmap, c
uint16_t *srcline1, *srcline2;
uint8_t *srcpriline;
- for (y=cliprect.min_y;y<=cliprect.max_y;y++)
+ for (y=cliprect.top();y<=cliprect.bottom();y++)
{
srcline1=&sprite_bitmap1->pix16(y,0);
srcline2=&sprite_bitmap2->pix16(y,0);
@@ -48,7 +48,7 @@ void boogwing_state::mix_boogwing(screen_device &screen, bitmap_rgb32 &bitmap, c
dstline=&bitmap.pix32(y,0);
- for (x=cliprect.min_x;x<=cliprect.max_x;x++)
+ for (x=cliprect.left();x<=cliprect.right();x++)
{
uint16_t pix1 = srcline1[x];
uint16_t pix2 = srcline2[x];
diff --git a/src/mame/video/ccastles.cpp b/src/mame/video/ccastles.cpp
index 99bab35d18e..96981f086d2 100644
--- a/src/mame/video/ccastles.cpp
+++ b/src/mame/video/ccastles.cpp
@@ -272,14 +272,14 @@ uint32_t ccastles_state::screen_update_ccastles(screen_device &screen, bitmap_in
}
/* draw the bitmap to the screen, looping over Y */
- for (y = cliprect.min_y; y <= cliprect.max_y; y++)
+ for (y = cliprect.top(); y <= cliprect.bottom(); y++)
{
uint16_t *dst = &bitmap.pix16(y);
/* if we're in the VBLANK region, just fill with black */
if (m_syncprom[y] & 1)
{
- for (x = cliprect.min_x; x <= cliprect.max_x; x++)
+ for (x = cliprect.left(); x <= cliprect.right(); x++)
dst[x] = black;
}
@@ -296,7 +296,7 @@ uint32_t ccastles_state::screen_update_ccastles(screen_device &screen, bitmap_in
src = &m_videoram[effy * 128];
/* loop over X */
- for (x = cliprect.min_x; x <= cliprect.max_x; x++)
+ for (x = cliprect.left(); x <= cliprect.right(); x++)
{
/* if we're in the HBLANK region, just store black */
if (x >= 256)
diff --git a/src/mame/video/cinemat.cpp b/src/mame/video/cinemat.cpp
index e1f9c120e3a..5d38416f280 100644
--- a/src/mame/video/cinemat.cpp
+++ b/src/mame/video/cinemat.cpp
@@ -22,10 +22,10 @@ void cinemat_state::cinemat_vector_callback(int16_t sx, int16_t sy, int16_t ex,
int intensity = 0xff;
/* adjust for slop */
- sx = sx - visarea.min_x;
- ex = ex - visarea.min_x;
- sy = sy - visarea.min_y;
- ey = ey - visarea.min_y;
+ sx -= visarea.left();
+ ex -= visarea.left();
+ sy -= visarea.top();
+ ey -= visarea.top();
/* point intensity is determined by the shift value */
if (sx == ex && sy == ey)
diff --git a/src/mame/video/cloak.cpp b/src/mame/video/cloak.cpp
index ae98e819927..d550499533f 100644
--- a/src/mame/video/cloak.cpp
+++ b/src/mame/video/cloak.cpp
@@ -182,8 +182,8 @@ void cloak_state::draw_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int x, y;
- for (y = cliprect.min_y; y <= cliprect.max_y; y++)
- for (x = cliprect.min_x; x <= cliprect.max_x; x++)
+ for (y = cliprect.top(); y <= cliprect.bottom(); y++)
+ for (x = cliprect.left(); x <= cliprect.right(); x++)
{
pen_t pen = m_current_bitmap_videoram_displayed[(y << 8) | x] & 0x07;
diff --git a/src/mame/video/cloud9.cpp b/src/mame/video/cloud9.cpp
index 5a6eea3e0cb..af1d5d5c6d1 100644
--- a/src/mame/video/cloud9.cpp
+++ b/src/mame/video/cloud9.cpp
@@ -246,14 +246,14 @@ uint32_t cloud9_state::screen_update_cloud9(screen_device &screen, bitmap_ind16
}
/* draw the bitmap to the screen, looping over Y */
- for (y = cliprect.min_y; y <= cliprect.max_y; y++)
+ for (y = cliprect.top(); y <= cliprect.bottom(); y++)
{
uint16_t *dst = &bitmap.pix16(y);
/* if we're in the VBLANK region, just fill with black */
if (~m_syncprom[y] & 2)
{
- for (x = cliprect.min_x; x <= cliprect.max_x; x++)
+ for (x = cliprect.left(); x <= cliprect.right(); x++)
dst[x] = black;
}
@@ -269,7 +269,7 @@ uint32_t cloud9_state::screen_update_cloud9(screen_device &screen, bitmap_ind16
src[1] = &m_videoram[0x0000 | (effy * 64)];
/* loop over X */
- for (x = cliprect.min_x; x <= cliprect.max_x; x++)
+ for (x = cliprect.left(); x <= cliprect.right(); x++)
{
/* if we're in the HBLANK region, just store black */
if (x >= 256)
diff --git a/src/mame/video/copsnrob.cpp b/src/mame/video/copsnrob.cpp
index 66bb9e0ebd5..109f13fcf9b 100644
--- a/src/mame/video/copsnrob.cpp
+++ b/src/mame/video/copsnrob.cpp
@@ -122,7 +122,7 @@ uint32_t copsnrob_state::screen_update_copsnrob(screen_device &screen, bitmap_in
{
if (val & mask1)
{
- for (y = cliprect.min_y; y <= cliprect.max_y; y++)
+ for (y = cliprect.top(); y <= cliprect.bottom(); y++)
if (m_bulletsram[y] & mask2)
bitmap.pix16(y, 256 - x) = 1;
}
diff --git a/src/mame/video/cvs.cpp b/src/mame/video/cvs.cpp
index a88258bcd67..47645bb080a 100644
--- a/src/mame/video/cvs.cpp
+++ b/src/mame/video/cvs.cpp
@@ -224,11 +224,11 @@ uint32_t cvs_state::screen_update_cvs(screen_device &screen, bitmap_ind16 &bitma
{
int y;
- for (y = cliprect.min_y; y <= cliprect.max_y; y++)
+ for (y = cliprect.top(); y <= cliprect.bottom(); y++)
{
int x;
- for (x = cliprect.min_x; x <= cliprect.max_x; x++)
+ for (x = cliprect.left(); x <= cliprect.right(); x++)
{
int pixel0 = s2636_0_bitmap.pix16(y, x);
int pixel1 = s2636_1_bitmap.pix16(y, x);
@@ -328,7 +328,7 @@ void cvs_state::cvs_update_stars(bitmap_ind16 &bitmap, const rectangle &cliprect
if (flip_screen_y())
y = ~y;
- if ((y >= cliprect.min_y) && (y <= cliprect.max_y) &&
+ if ((y >= cliprect.top()) && (y <= cliprect.bottom()) &&
(update_always || (m_palette->pen_indirect(bitmap.pix16(y, x)) == 0)))
bitmap.pix16(y, x) = star_pen;
}
diff --git a/src/mame/video/cyberbal.cpp b/src/mame/video/cyberbal.cpp
index bce32eb631a..0f470c6b7ff 100644
--- a/src/mame/video/cyberbal.cpp
+++ b/src/mame/video/cyberbal.cpp
@@ -233,11 +233,11 @@ uint32_t cyberbal_base_state::update_one_screen(screen_device &screen, bitmap_in
/* draw and merge the MO */
bitmap_ind16 &mobitmap = curmob.bitmap();
for (const sparse_dirty_rect *rect = curmob.first_dirty_rect(cliprect); rect != nullptr; rect = rect->next())
- for (int y = rect->min_y; y <= rect->max_y; y++)
+ for (int y = rect->top(); y <= rect->bottom(); y++)
{
uint16_t *mo = &mobitmap.pix16(y);
uint16_t *pf = &bitmap.pix16(y);
- for (int x = rect->min_x; x <= rect->max_x; x++)
+ for (int x = rect->left(); x <= rect->right(); x++)
if (mo[x] != 0xffff)
{
/* not verified: logic is all controlled in a PAL
diff --git a/src/mame/video/cybstorm.cpp b/src/mame/video/cybstorm.cpp
index 4cedc1d9482..ba8b8358965 100644
--- a/src/mame/video/cybstorm.cpp
+++ b/src/mame/video/cybstorm.cpp
@@ -129,12 +129,12 @@ uint32_t cybstorm_state::screen_update_cybstorm(screen_device &screen, bitmap_in
/* draw and merge the MO */
bitmap_ind16 &mobitmap = m_vad->mob().bitmap();
for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next())
- for (int y = rect->min_y; y <= rect->max_y; y++)
+ for (int y = rect->top(); y <= rect->bottom(); y++)
{
uint16_t *mo = &mobitmap.pix16(y);
uint16_t *pf = &bitmap.pix16(y);
uint8_t *pri = &priority_bitmap.pix8(y);
- for (int x = rect->min_x; x <= rect->max_x; x++)
+ for (int x = rect->left(); x <= rect->right(); x++)
if (mo[x])
{
int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT;
@@ -175,12 +175,12 @@ uint32_t cybstorm_state::screen_update_cybstorm(screen_device &screen, bitmap_in
/* now go back and process the upper bit of MO priority */
for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next())
- for (int y = rect->min_y; y <= rect->max_y; y++)
+ for (int y = rect->top(); y <= rect->bottom(); y++)
{
uint16_t *mo = &mobitmap.pix16(y);
uint16_t *pf = &bitmap.pix16(y);
int count = 0;
- for (int x = rect->min_x; x <= rect->max_x || (count && x < bitmap.width()); x++)
+ for (int x = rect->left(); x <= rect->right() || (count && x < bitmap.width()); x++)
{
const uint16_t START_MARKER = ((4 << atari_motion_objects_device::PRIORITY_SHIFT) | 3);
const uint16_t END_MARKER = ((4 << atari_motion_objects_device::PRIORITY_SHIFT) | 7);
diff --git a/src/mame/video/dassault.cpp b/src/mame/video/dassault.cpp
index 94c989f66bc..7c7f8e7b550 100644
--- a/src/mame/video/dassault.cpp
+++ b/src/mame/video/dassault.cpp
@@ -37,12 +37,12 @@ void dassault_state::mixdassaultlayer(bitmap_rgb32 &bitmap, bitmap_ind16* sprite
uint16_t* srcline;
uint32_t* dstline;
- for (y=cliprect.min_y;y<=cliprect.max_y;y++)
+ for (y=cliprect.top();y<=cliprect.bottom();y++)
{
srcline=&sprite_bitmap->pix16(y,0);
dstline=&bitmap.pix32(y,0);
- for (x=cliprect.min_x;x<=cliprect.max_x;x++)
+ for (x=cliprect.left();x<=cliprect.right();x++)
{
uint16_t pix = srcline[x];
diff --git a/src/mame/video/decbac06.cpp b/src/mame/video/decbac06.cpp
index 8f30ba0d737..590a569e245 100644
--- a/src/mame/video/decbac06.cpp
+++ b/src/mame/video/decbac06.cpp
@@ -68,23 +68,23 @@ Priority word (Midres):
DEFINE_DEVICE_TYPE(DECO_BAC06, deco_bac06_device, "deco_back06", "DECO BAC06 Tilemap")
deco_bac06_device::deco_bac06_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, DECO_BAC06, tag, owner, clock),
- m_pf_data(nullptr),
- m_pf_rowscroll(nullptr),
- m_pf_colscroll(nullptr),
- m_tile_region_8(0),
- m_tile_region_16(0),
- m_supports_8x8(true),
- m_supports_16x16(true),
- m_supports_rc_scroll(true),
- m_gfxcolmask(0),
- m_rambank(0),
- m_gfxregion8x8(0),
- m_gfxregion16x16(0),
- m_wide(0),
- m_bppmult(0),
- m_bppmask(0),
- m_gfxdecode(*this, finder_base::DUMMY_TAG)
+ : device_t(mconfig, DECO_BAC06, tag, owner, clock)
+ , m_pf_data(nullptr)
+ , m_pf_rowscroll(nullptr)
+ , m_pf_colscroll(nullptr)
+ , m_tile_region_8(0)
+ , m_tile_region_16(0)
+ , m_supports_8x8(true)
+ , m_supports_16x16(true)
+ , m_supports_rc_scroll(true)
+ , m_gfxcolmask(0)
+ , m_rambank(0)
+ , m_gfxregion8x8(0)
+ , m_gfxregion16x16(0)
+ , m_wide(0)
+ , m_bppmult(0)
+ , m_bppmask(0)
+ , m_gfxdecode(*this, finder_base::DUMMY_TAG)
{
for (int i = 0; i < 8; i++)
{
@@ -282,7 +282,7 @@ void deco_bac06_device::custom_tilemap_draw(bitmap_ind16 &bitmap,
else
src_y = scrolly;
- for (y=0; y<=cliprect.max_y; y++) {
+ for (y=0; y<=cliprect.bottom(); y++) {
if (row_scroll_enabled)
src_x=scrollx + rowscroll_ptr[(src_y >> (control1[3]&0xf))&(0x1ff>>(control1[3]&0xf))];
else
@@ -291,7 +291,7 @@ void deco_bac06_device::custom_tilemap_draw(bitmap_ind16 &bitmap,
if (m_flip_screen)
src_x=(src_bitmap.width() - 256) - src_x;
- for (x=0; x<=cliprect.max_x; x++) {
+ for (x=0; x<=cliprect.right(); x++) {
if (col_scroll_enabled)
column_offset=colscroll_ptr[((src_x >> 3) >> (control1[2]&0xf))&(0x3f>>(control1[2]&0xf))];
diff --git a/src/mame/video/deco16ic.cpp b/src/mame/video/deco16ic.cpp
index 7ff4d8dc5e6..b7e2dca7739 100644
--- a/src/mame/video/deco16ic.cpp
+++ b/src/mame/video/deco16ic.cpp
@@ -460,8 +460,8 @@ void deco16ic_device::custom_tilemap_draw(
if (!BIT(control0, 7))
return;
- int starty = cliprect.min_y;
- int endy = cliprect.max_y+1;
+ int starty = cliprect.top();
+ int endy = cliprect.bottom() + 1;
width_mask = src_bitmap0->width() - 1;
height_mask = src_bitmap0->height() - 1;
diff --git a/src/mame/video/deco32.cpp b/src/mame/video/deco32.cpp
index 75fdba3b035..6db1f9a645d 100644
--- a/src/mame/video/deco32.cpp
+++ b/src/mame/video/deco32.cpp
@@ -184,9 +184,9 @@ uint32_t dragngun_state::screen_update_dragngun(screen_device &screen, bitmap_rg
//
// really, it needs optimizing ..
// so for now we only draw these 2 layers on the last update call
- if (cliprect.max_y == 247)
+ if (cliprect.bottom() == 247)
{
- rectangle clip(cliprect.min_x, cliprect.max_x, 8, 247);
+ rectangle clip(cliprect.left(), cliprect.right(), 8, 247);
m_sprgenzoom->dragngun_draw_sprites(bitmap,clip,m_spriteram->buffer(), m_sprite_layout_ram[0], m_sprite_layout_ram[1], m_sprite_lookup_ram[0], m_sprite_lookup_ram[1], m_sprite_ctrl, screen.priority(), m_temp_render_bitmap );
diff --git a/src/mame/video/deco_mlc.cpp b/src/mame/video/deco_mlc.cpp
index 273fc492444..6c60a5f6e7b 100644
--- a/src/mame/video/deco_mlc.cpp
+++ b/src/mame/video/deco_mlc.cpp
@@ -74,16 +74,16 @@ void deco_mlc_state::drawgfxzoomline(uint32_t* dest,const rectangle &clip,gfx_el
x_index_base = 0;
}
- if( sx < clip.min_x)
+ if( sx < clip.left())
{ /* clip left */
- int pixels = clip.min_x-sx;
+ int pixels = clip.left()-sx;
sx += pixels;
x_index_base += pixels*dx;
}
/* NS 980211 - fixed incorrect clipping */
- if( ex > clip.max_x+1 )
+ if( ex > clip.right()+1 )
{ /* clip right */
- int pixels = ex-clip.max_x-1;
+ int pixels = ex-clip.right()-1;
ex -= pixels;
}
@@ -245,16 +245,11 @@ void deco_mlc_state::draw_sprites( const rectangle &cliprect, int scanline, uint
int min_y = m_clip_ram[(clipper*4)+0];
int max_y = m_clip_ram[(clipper*4)+1];
- if (scanline<min_y)
+ if ((scanline<min_y) || (scanline>max_y))
continue;
- if (scanline>max_y)
- continue;
-
-
- user_clip.min_x=m_clip_ram[(clipper*4)+2];
- user_clip.max_x=m_clip_ram[(clipper*4)+3];
+ user_clip.setx(m_clip_ram[(clipper*4)+2], m_clip_ram[(clipper*4)+3]);
user_clip &= cliprect;
/* Any colours out of range (for the bpp value) trigger 'shadow' mode */
@@ -548,7 +543,7 @@ uint32_t deco_mlc_state::screen_update(screen_device &screen, bitmap_rgb32 &bitm
// temp_bitmap->fill(0, cliprect);
bitmap.fill(m_palette->pen(0), cliprect); /* Pen 0 fill colour confirmed from Skull Fang level 2 */
- for (int i=cliprect.min_y;i<=cliprect.max_y;i++)
+ for (int i=cliprect.top();i<=cliprect.bottom();i++)
{
uint32_t *dest = &bitmap.pix32(i);
diff --git a/src/mame/video/deco_zoomspr.cpp b/src/mame/video/deco_zoomspr.cpp
index d63941c62a4..e930e82d458 100644
--- a/src/mame/video/deco_zoomspr.cpp
+++ b/src/mame/video/deco_zoomspr.cpp
@@ -93,27 +93,27 @@ inline void deco_zoomspr_device::dragngun_drawgfxzoom(
y_index = 0;
}
- if( sx < clip.min_x)
+ if( sx < clip.left())
{ /* clip left */
- int pixels = clip.min_x-sx;
+ int pixels = clip.left()-sx;
sx += pixels;
x_index_base += pixels*dx;
}
- if( sy < clip.min_y )
+ if( sy < clip.top() )
{ /* clip top */
- int pixels = clip.min_y-sy;
+ int pixels = clip.top()-sy;
sy += pixels;
y_index += pixels*dy;
}
/* NS 980211 - fixed incorrect clipping */
- if( ex > clip.max_x+1 )
+ if( ex > clip.right()+1 )
{ /* clip right */
- int pixels = ex-clip.max_x-1;
+ int pixels = ex-clip.right()-1;
ex -= pixels;
}
- if( ey > clip.max_y+1 )
+ if( ey > clip.bottom()+1 )
{ /* clip bottom */
- int pixels = ey-clip.max_y-1;
+ int pixels = ey-clip.bottom()-1;
ey -= pixels;
}
@@ -396,12 +396,12 @@ void deco_zoomspr_device::dragngun_draw_sprites( bitmap_rgb32 &bitmap, const rec
}
}
- for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
+ for (int y = cliprect.top(); y <= cliprect.bottom(); y++)
{
uint32_t *src = &temp_bitmap.pix32(y);
uint32_t *dst = &bitmap.pix32(y);
- for (int x = cliprect.min_x; x <= cliprect.max_x; x++)
+ for (int x = cliprect.left(); x <= cliprect.right(); x++)
{
uint32_t srcpix = src[x];
diff --git a/src/mame/video/decocass.cpp b/src/mame/video/decocass.cpp
index a93edf2fbfc..bf06d8cd5a9 100644
--- a/src/mame/video/decocass.cpp
+++ b/src/mame/video/decocass.cpp
@@ -252,10 +252,10 @@ void decocass_state::draw_special_priority(bitmap_ind16 &bitmap, bitmap_ind8 &pr
const uint8_t *objdata1 = m_gfxdecode->gfx(3)->get_data(1);
assert(m_gfxdecode->gfx(3)->rowbytes() == 64);
- for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
+ for (int y = cliprect.top(); y <= cliprect.bottom(); y++)
{
const int dy = y - sy;
- for (int x = cliprect.min_x; x <= cliprect.max_x; x++)
+ for (int x = cliprect.left(); x <= cliprect.right(); x++)
{
const int dx = x - sx;
@@ -308,7 +308,7 @@ void decocass_state::draw_center(bitmap_ind16 &bitmap, const rectangle &cliprect
sx = (m_center_h_shift_space >> 2) & 0x3c;
for (y = 0; y < 4; y++)
- if ((sy + y) >= cliprect.min_y && (sy + y) <= cliprect.max_y)
+ if ((sy + y) >= cliprect.top() && (sy + y) <= cliprect.bottom())
{
if (((sy + y) & m_color_center_bot & 3) == (sy & m_color_center_bot & 3))
for (x = 0; x < 256; x++)
@@ -588,10 +588,10 @@ void decocass_state::draw_missiles(bitmap_ind16 &bitmap, bitmap_ind8 &priority,
sy = 240 - sy + missile_y_adjust_flip_screen;
}
sy -= missile_y_adjust;
- if (sy >= cliprect.min_y && sy <= cliprect.max_y)
+ if (sy >= cliprect.top() && sy <= cliprect.bottom())
for (x = 0; x < 4; x++)
{
- if (sx >= cliprect.min_x && sx <= cliprect.max_x)
+ if (sx >= cliprect.left() && sx <= cliprect.right())
{
bitmap.pix16(sy, sx) = (m_color_missiles & 7) | 8;
priority.pix8(sy, sx) |= 1 << 2;
@@ -607,10 +607,10 @@ void decocass_state::draw_missiles(bitmap_ind16 &bitmap, bitmap_ind8 &priority,
sy = 240 - sy + missile_y_adjust_flip_screen;
}
sy -= missile_y_adjust;
- if (sy >= cliprect.min_y && sy <= cliprect.max_y)
+ if (sy >= cliprect.top() && sy <= cliprect.bottom())
for (x = 0; x < 4; x++)
{
- if (sx >= cliprect.min_x && sx <= cliprect.max_x)
+ if (sx >= cliprect.left() && sx <= cliprect.right())
{
bitmap.pix16(sy, sx) = ((m_color_missiles >> 4) & 7) | 8;
priority.pix8(sy, sx) |= 1 << 3;
@@ -663,13 +663,13 @@ void decocass_state::draw_edge(bitmap_ind16 &bitmap, const rectangle &cliprect,
// technically our y drawing probably shouldn't wrap / mask, but simply draw the 128pixel high 'edge' at the requested position
// see note above this funciton
- for (y=clip.min_y; y<=clip.max_y;y++)
+ for (y=clip.top(); y<=clip.bottom(); y++)
{
int srcline = (y + scrolly) & 0x1ff;
uint16_t* src = &srcbitmap->pix16(srcline);
uint16_t* dst = &bitmap.pix16(y);
- for (x=clip.min_x; x<=clip.max_x;x++)
+ for (x=clip.left(); x<=clip.right(); x++)
{
int srccol = 0;
diff --git a/src/mame/video/decospr.cpp b/src/mame/video/decospr.cpp
index ba893bf3726..bdd2d1a02f9 100644
--- a/src/mame/video/decospr.cpp
+++ b/src/mame/video/decospr.cpp
@@ -183,7 +183,7 @@ void decospr_device::alloc_sprite_bitmap()
template<class _BitmapClass>
void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle &cliprect, uint16_t* spriteram, int sizewords)
{
- //printf("cliprect %04x, %04x\n", cliprect.min_y, cliprect.max_y);
+ //printf("cliprect %04x, %04x\n", cliprect.top(), cliprect.bottom());
if (m_sprite_bitmap.valid() && !m_pri_cb.isnull())
fatalerror("m_sprite_bitmap && m_pri_cb is invalid\n");
@@ -274,7 +274,7 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle &
y = ((y&0x1ff) + m_y_offset)&0x1ff;
- if (cliprect.max_x>256)
+ if (cliprect.right()>256)
{
x = x & 0x01ff;
y = y & 0x01ff;
@@ -318,7 +318,7 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle &
if (flipscreen ^ m_flipallx)
{
- if (cliprect.max_x>256)
+ if (cliprect.right()>256)
x = 304 - x;
else
x = 240 - x;
@@ -334,11 +334,11 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle &
{
int ypos;
ypos = y + mult * multi;
- if ((ypos<=cliprect.max_y) && (ypos>=(cliprect.min_y)-16))
+ if ((ypos<=cliprect.bottom()) && (ypos>=(cliprect.top())-16))
{
if(!m_sprite_bitmap.valid())
{
- if ((ypos<=cliprect.max_y) && (ypos>=(cliprect.min_y)-16))
+ if ((ypos<=cliprect.bottom()) && (ypos>=(cliprect.top())-16))
{
if (!m_pri_cb.isnull())
m_gfxdecode->gfx(m_gfxregion)->prio_transpen(bitmap,cliprect,
@@ -463,7 +463,7 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle &
{
ypos = y + mult2 * (h-yy);
- if ((ypos<=cliprect.max_y) && (ypos>=(cliprect.min_y)-16))
+ if ((ypos<=cliprect.bottom()) && (ypos>=(cliprect.top())-16))
{
m_gfxdecode->gfx(m_gfxregion)->prio_transpen(bitmap,cliprect,
sprite + yy + h * xx,
@@ -475,7 +475,7 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle &
ypos -= 512; // wrap-around y
- if ((ypos<=cliprect.max_y) && (ypos>=(cliprect.min_y-16)))
+ if ((ypos<=cliprect.bottom()) && (ypos>=(cliprect.top()-16)))
{
m_gfxdecode->gfx(m_gfxregion)->prio_transpen(bitmap,cliprect,
sprite + yy + h * xx,
@@ -490,7 +490,7 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle &
{
ypos = y + mult2 * (h-yy);
- if ((ypos<=cliprect.max_y) && (ypos>=(cliprect.min_y)-16))
+ if ((ypos<=cliprect.bottom()) && (ypos>=(cliprect.top())-16))
{
m_gfxdecode->gfx(m_gfxregion)->transpen(bitmap,cliprect,
sprite + yy + h * xx,
@@ -502,7 +502,7 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle &
ypos -= 512; // wrap-around y
- if ((ypos<=cliprect.max_y) && (ypos>=(cliprect.min_y-16)))
+ if ((ypos<=cliprect.bottom()) && (ypos>=(cliprect.top()-16)))
{
m_gfxdecode->gfx(m_gfxregion)->transpen(bitmap,cliprect,
sprite + yy + h * xx,
@@ -517,7 +517,7 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle &
{
ypos = y + mult2 * (h-yy);
- if ((ypos<=cliprect.max_y) && (ypos>=(cliprect.min_y)-16))
+ if ((ypos<=cliprect.bottom()) && (ypos>=(cliprect.top())-16))
{
m_gfxdecode->gfx(m_gfxregion)->transpen_raw(m_sprite_bitmap,cliprect,
sprite + yy + h * xx,
@@ -529,7 +529,7 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle &
ypos -= 512; // wrap-around y
- if ((ypos<=cliprect.max_y) && (ypos>=(cliprect.min_y-16)))
+ if ((ypos<=cliprect.bottom()) && (ypos>=(cliprect.top()-16)))
{
m_gfxdecode->gfx(m_gfxregion)->transpen_raw(m_sprite_bitmap,cliprect,
sprite + yy + h * xx,
@@ -567,14 +567,14 @@ void decospr_device::inefficient_copy_sprite_bitmap(bitmap_rgb32 &bitmap, const
uint16_t* srcline;
uint32_t* dstline;
- for (y=cliprect.min_y;y<=cliprect.max_y;y++)
+ for (y=cliprect.top();y<=cliprect.bottom();y++)
{
srcline= &m_sprite_bitmap.pix16(y);
dstline= &bitmap.pix32(y);
if (alpha==0xff)
{
- for (x=cliprect.min_x;x<=cliprect.max_x;x++)
+ for (x=cliprect.left();x<=cliprect.right();x++)
{
uint16_t pix = srcline[x];
@@ -589,7 +589,7 @@ void decospr_device::inefficient_copy_sprite_bitmap(bitmap_rgb32 &bitmap, const
}
else
{
- for (x=cliprect.min_x;x<=cliprect.max_x;x++)
+ for (x=cliprect.left();x<=cliprect.right();x++)
{
uint16_t pix = srcline[x];
diff --git a/src/mame/video/dragrace.cpp b/src/mame/video/dragrace.cpp
index e28c710c854..d13441aed68 100644
--- a/src/mame/video/dragrace.cpp
+++ b/src/mame/video/dragrace.cpp
@@ -63,8 +63,7 @@ uint32_t dragrace_state::screen_update_dragrace(screen_device &screen, bitmap_in
m_bg_tilemap->set_scrollx(0, 16 * xh + xl - 8);
m_bg_tilemap->set_scrolly(0, 16 * yh + yl);
- if (rect.min_y < y + 0) rect.min_y = y + 0;
- if (rect.max_y > y + 3) rect.max_y = y + 3;
+ rect.sety((std::max)(rect.top(), y + 0), (std::min)(rect.bottom(), y + 3));
m_bg_tilemap->draw(screen, bitmap, rect, 0, 0);
}
diff --git a/src/mame/video/dynax.cpp b/src/mame/video/dynax.cpp
index 347a69f4150..94933026f61 100644
--- a/src/mame/video/dynax.cpp
+++ b/src/mame/video/dynax.cpp
@@ -748,7 +748,7 @@ void dynax_state::jantouki_copylayer( bitmap_ind16 &bitmap, const rectangle &cli
uint16_t *dst;
uint16_t *dstbase = &bitmap.pix16(sy);
- if ((sy < cliprect.min_y) || (sy > cliprect.max_y))
+ if ((sy < cliprect.top()) || (sy > cliprect.bottom()))
{
src1 += 256;
src2 += 256;
@@ -912,7 +912,7 @@ int dynax_state::debug_viewer(bitmap_ind16 &bitmap, const rectangle &cliprect )
if (m_layer_layout != LAYOUT_MJDIALQ2)
memset(m_pixmap[0][1].get(), 0, sizeof(uint8_t) * 0x100 * 0x100);
for (m_hanamai_layer_half = 0; m_hanamai_layer_half < 2; m_hanamai_layer_half++)
- blitter_drawgfx(0, 1, m_blitter_gfx, i, 0, cliprect.min_x, cliprect.min_y, 3, 0);
+ blitter_drawgfx(0, 1, m_blitter_gfx, i, 0, cliprect.left(), cliprect.top(), 3, 0);
if (m_layer_layout != LAYOUT_MJDIALQ2)
hanamai_copylayer(bitmap, cliprect, 0);
diff --git a/src/mame/video/electron.cpp b/src/mame/video/electron.cpp
index 64f6b1b11ec..a5050c3bcf4 100644
--- a/src/mame/video/electron.cpp
+++ b/src/mame/video/electron.cpp
@@ -85,13 +85,13 @@ inline void electron_state::electron_plot_pixel(bitmap_ind16 &bitmap, int x, int
uint32_t electron_state::screen_update_electron(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- int min_x = screen.visible_area().min_x;
- int min_y = screen.visible_area().min_y;
+ int min_x = screen.visible_area().left();
+ int min_y = screen.visible_area().top();
int x = min_x;
int pal[16];
int scanline = screen.vpos();
rectangle r = cliprect;
- r.min_y = r.max_y = scanline;
+ r.sety(scanline, scanline);
/* set up palette */
switch( m_ula.screen_mode )
diff --git a/src/mame/video/eprom.cpp b/src/mame/video/eprom.cpp
index 6fbb6e34657..93becde10bc 100644
--- a/src/mame/video/eprom.cpp
+++ b/src/mame/video/eprom.cpp
@@ -219,11 +219,11 @@ uint32_t eprom_state::screen_update_eprom(screen_device &screen, bitmap_ind16 &b
// draw and merge the MO
bitmap_ind16 &mobitmap = m_mob->bitmap();
for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next())
- for (int y = rect->min_y; y <= rect->max_y; y++)
+ for (int y = rect->top(); y <= rect->bottom(); y++)
{
uint16_t *mo = &mobitmap.pix16(y);
uint16_t *pf = &bitmap.pix16(y);
- for (int x = rect->min_x; x <= rect->max_x; x++)
+ for (int x = rect->left(); x <= rect->right(); x++)
if (mo[x] != 0xffff)
{
/* verified from the GALs on the real PCB; equations follow
@@ -325,11 +325,11 @@ uint32_t eprom_state::screen_update_eprom(screen_device &screen, bitmap_ind16 &b
/* now go back and process the upper bit of MO priority */
for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next())
- for (int y = rect->min_y; y <= rect->max_y; y++)
+ for (int y = rect->top(); y <= rect->bottom(); y++)
{
uint16_t *mo = &mobitmap.pix16(y);
uint16_t *pf = &bitmap.pix16(y);
- for (int x = rect->min_x; x <= rect->max_x; x++)
+ for (int x = rect->left(); x <= rect->right(); x++)
if (mo[x] != 0xffff)
{
int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT;
@@ -366,11 +366,11 @@ uint32_t eprom_state::screen_update_guts(screen_device &screen, bitmap_ind16 &bi
// draw and merge the MO
bitmap_ind16 &mobitmap = m_mob->bitmap();
for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next())
- for (int y = rect->min_y; y <= rect->max_y; y++)
+ for (int y = rect->top(); y <= rect->bottom(); y++)
{
uint16_t *mo = &mobitmap.pix16(y);
uint16_t *pf = &bitmap.pix16(y);
- for (int x = rect->min_x; x <= rect->max_x; x++)
+ for (int x = rect->left(); x <= rect->right(); x++)
if (mo[x] != 0xffff)
{
int mopriority = (mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT) & 7;
@@ -391,11 +391,11 @@ uint32_t eprom_state::screen_update_guts(screen_device &screen, bitmap_ind16 &bi
/* now go back and process the upper bit of MO priority */
for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next())
- for (int y = rect->min_y; y <= rect->max_y; y++)
+ for (int y = rect->top(); y <= rect->bottom(); y++)
{
uint16_t *mo = &mobitmap.pix16(y);
uint16_t *pf = &bitmap.pix16(y);
- for (int x = rect->min_x; x <= rect->max_x; x++)
+ for (int x = rect->left(); x <= rect->right(); x++)
if (mo[x] != 0xffff)
{
int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT;
diff --git a/src/mame/video/equites.cpp b/src/mame/video/equites.cpp
index 6df9a32706a..82dec063f58 100644
--- a/src/mame/video/equites.cpp
+++ b/src/mame/video/equites.cpp
@@ -338,13 +338,13 @@ void splndrbt_state::splndrbt_draw_sprites(bitmap_ind16 &bitmap, const rectangle
{
int const y = yhalf ? sy + 1 + yy : sy - yy;
- if (y >= cliprect.min_y && y <= cliprect.max_y)
+ if (y >= cliprect.top() && y <= cliprect.bottom())
{
for (x = 0; x <= (scalex << 1); ++x)
{
int bx = (sx + x) & 0xff;
- if (bx >= cliprect.min_x && bx <= cliprect.max_x)
+ if (bx >= cliprect.left() && bx <= cliprect.right())
{
int xx = scalex ? (x * 29 + scalex) / (scalex << 1) + 1 : 16; // FIXME This is wrong. Should use the PROM.
int const offset = (fx ? (31 - xx) : xx) + ((fy ^ yhalf) ? (16 + line) : (15 - line)) * gfx->rowbytes();
@@ -382,7 +382,7 @@ void splndrbt_state::splndrbt_copy_bg(bitmap_ind16 &dst_bitmap, const rectangle
for (dst_y = 32; dst_y < 256-32; ++dst_y)
{
- if (dst_y >= cliprect.min_y && dst_y <= cliprect.max_y)
+ if (dst_y >= cliprect.top() && dst_y <= cliprect.bottom())
{
const uint8_t * const romline = &xrom[(dst_y ^ dinvert) << 5];
const uint16_t * const src_line = &src_bitmap.pix16((src_y + scroll_y) & 0x1ff);
diff --git a/src/mame/video/exidy440.cpp b/src/mame/video/exidy440.cpp
index 3aba8684ea7..12de6ba3be0 100644
--- a/src/mame/video/exidy440.cpp
+++ b/src/mame/video/exidy440.cpp
@@ -307,7 +307,7 @@ void exidy440_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c
uint8_t *src;
/* skip if out of range */
- if (yoffs < cliprect.min_y || yoffs >= cliprect.max_y + 16)
+ if (yoffs < cliprect.top() || yoffs >= cliprect.bottom() + 16)
continue;
/* get a pointer to the source image */
@@ -328,11 +328,11 @@ void exidy440_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c
sy += (VBSTART - VBEND);
/* stop if we get before the current scanline */
- if (yoffs < cliprect.min_y)
+ if (yoffs < cliprect.top())
break;
/* only draw scanlines that are in this cliprect */
- if (yoffs <= cliprect.max_y)
+ if (yoffs <= cliprect.bottom())
{
uint8_t *old = &m_local_videoram[sy * 512 + xoffs];
int currx = xoffs;
@@ -389,8 +389,8 @@ void exidy440_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c
void exidy440_state::update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int scroll_offset, int check_collision)
{
/* draw any dirty scanlines from the VRAM directly */
- int sy = scroll_offset + cliprect.min_y;
- for (int y = cliprect.min_y; y <= cliprect.max_y; y++, sy++)
+ int sy = scroll_offset + cliprect.top();
+ for (int y = cliprect.top(); y <= cliprect.bottom(); y++, sy++)
{
/* wrap at the bottom of the screen */
if (sy >= VBSTART)
@@ -418,7 +418,7 @@ uint32_t exidy440_state::screen_update_exidy440(screen_device &screen, bitmap_in
update_screen(screen, bitmap, cliprect, 0, true);
/* generate an interrupt once/frame for the beam */
- if (cliprect.max_y == screen.visible_area().max_y)
+ if (cliprect.bottom() == screen.visible_area().bottom())
{
int i;
diff --git a/src/mame/video/fantland.cpp b/src/mame/video/fantland.cpp
index a1a64f97014..44a9a742e46 100644
--- a/src/mame/video/fantland.cpp
+++ b/src/mame/video/fantland.cpp
@@ -73,7 +73,7 @@ void fantland_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect
// wheelrun is the only game with a smaller visible area
const rectangle &visarea = m_screen->visible_area();
- int special = (visarea.max_y - visarea.min_y + 1) < 0x100;
+ int special = visarea.height() < 0x100;
for ( ; ram < indx_ram; ram += 8,ram2++)
{
diff --git a/src/mame/video/firetrk.cpp b/src/mame/video/firetrk.cpp
index c19477615ee..d59c205aab7 100644
--- a/src/mame/video/firetrk.cpp
+++ b/src/mame/video/firetrk.cpp
@@ -323,8 +323,8 @@ void firetrk_state::check_collision(int which)
{
int y, x;
- for (y = playfield_window.min_y; y <= playfield_window.max_y; y++)
- for (x = playfield_window.min_x; x <= playfield_window.max_x; x++)
+ for (y = playfield_window.top(); y <= playfield_window.bottom(); y++)
+ for (x = playfield_window.left(); x <= playfield_window.right(); x++)
{
pen_t a = m_helper1.pix16(y, x);
pen_t b = m_helper2.pix16(y, x);
@@ -353,7 +353,7 @@ uint32_t firetrk_state::screen_update_firetrk(screen_device &screen, bitmap_ind1
draw_text(bitmap, cliprect, m_alpha_num_ram + 0x00, 296, 0x10, 0x10);
draw_text(bitmap, cliprect, m_alpha_num_ram + 0x10, 8, 0x10, 0x10);
- if (cliprect.max_y == screen.visible_area().max_y)
+ if (cliprect.bottom() == screen.visible_area().bottom())
{
m_tilemap2->draw(screen, m_helper1, playfield_window, 0, 0);
@@ -386,7 +386,7 @@ uint32_t firetrk_state::screen_update_superbug(screen_device &screen, bitmap_ind
draw_text(bitmap, cliprect, m_alpha_num_ram + 0x00, 296, 0x10, 0x10);
draw_text(bitmap, cliprect, m_alpha_num_ram + 0x10, 8, 0x10, 0x10);
- if (cliprect.max_y == screen.visible_area().max_y)
+ if (cliprect.bottom() == screen.visible_area().bottom())
{
m_tilemap2->draw(screen, m_helper1, playfield_window, 0, 0);
@@ -416,7 +416,7 @@ uint32_t firetrk_state::screen_update_montecar(screen_device &screen, bitmap_ind
draw_text(bitmap, cliprect, m_alpha_num_ram + 0x00, 24, 0x20, 0x08);
draw_text(bitmap, cliprect, m_alpha_num_ram + 0x20, 16, 0x20, 0x08);
- if (cliprect.max_y == screen.visible_area().max_y)
+ if (cliprect.bottom() == screen.visible_area().bottom())
{
m_tilemap2->draw(screen, m_helper1, playfield_window, 0, 0);
diff --git a/src/mame/video/galaxia.cpp b/src/mame/video/galaxia.cpp
index 94b6c423c61..fa7b24c9f5d 100644
--- a/src/mame/video/galaxia.cpp
+++ b/src/mame/video/galaxia.cpp
@@ -120,9 +120,9 @@ uint32_t galaxia_state::screen_update_galaxia(screen_device &screen, bitmap_ind1
cvs_update_stars(bitmap, cliprect, STAR_PEN, 1);
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
- for (y = cliprect.min_y; y <= cliprect.max_y; y++)
+ for (y = cliprect.top(); y <= cliprect.bottom(); y++)
{
- for (x = cliprect.min_x; x <= cliprect.max_x; x++)
+ for (x = cliprect.left(); x <= cliprect.right(); x++)
{
bool bullet = m_bullet_ram[y] && x == (m_bullet_ram[y] ^ 0xff);
bool background = (bitmap.pix16(y, x) & 3) != 0;
@@ -185,7 +185,7 @@ uint32_t galaxia_state::screen_update_astrowar(screen_device &screen, bitmap_ind
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
copybitmap(m_temp_bitmap, bitmap, 0, 0, 0, 0, cliprect);
- for (y = cliprect.min_y; y <= cliprect.max_y; y++)
+ for (y = cliprect.top(); y <= cliprect.bottom(); y++)
{
// draw bullets (guesswork)
if (m_bullet_ram[y])
@@ -201,14 +201,14 @@ uint32_t galaxia_state::screen_update_astrowar(screen_device &screen, bitmap_ind
if (pos) bitmap.pix16(y, pos-1) = BULLET_PEN;
}
- for (x = cliprect.min_x; x <= cliprect.max_x; x++)
+ for (x = cliprect.left(); x <= cliprect.right(); x++)
{
// NOTE: similar to zac2650.c, the sprite chip runs at a different frequency than the background generator
// the exact timing ratio is unknown, so we'll have to do with guesswork
float s_ratio = 256.0f / 196.0f;
float sx = x * s_ratio;
- if ((int)(sx + 0.5f) > cliprect.max_x)
+ if ((int)(sx + 0.5f) > cliprect.right())
break;
// copy the S2636 bitmap into the main bitmap and check collision
diff --git a/src/mame/video/galspnbl.cpp b/src/mame/video/galspnbl.cpp
index 9b442a3b0bf..1c7308ff402 100644
--- a/src/mame/video/galspnbl.cpp
+++ b/src/mame/video/galspnbl.cpp
@@ -38,12 +38,12 @@ VIDEO_START_MEMBER(galspnbl_state,galspnbl)
void galspnbl_state::mix_sprite_layer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri)
{
- for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
+ for (int y = cliprect.top(); y <= cliprect.bottom(); y++)
{
uint16_t *dd = &bitmap.pix16(y);
uint16_t *sd2 = &m_sprite_bitmap.pix16(y);
- for (int x = cliprect.min_x; x <= cliprect.max_x; x++)
+ for (int x = cliprect.left(); x <= cliprect.right(); x++)
{
uint16_t sprpixel = (sd2[x]);
//uint16_t sprpri = (sprpixel >> 8) & 3;
diff --git a/src/mame/video/gamate.cpp b/src/mame/video/gamate.cpp
index 6d678a625e0..5bb9a1e771d 100644
--- a/src/mame/video/gamate.cpp
+++ b/src/mame/video/gamate.cpp
@@ -261,13 +261,13 @@ int gamate_video_device::get_pixel_from_vram(int x, int y)
uint32_t gamate_video_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
+ for (int y = cliprect.top(); y <= cliprect.bottom(); y++)
{
//printf("updating scanline %d\n", y);
int real_x, real_y;
get_real_x_and_y(real_x, real_y, y);
- for (int x = cliprect.min_x; x <= cliprect.max_x; x++)
+ for (int x = cliprect.left(); x <= cliprect.right(); x++)
{
int pix = get_pixel_from_vram(x + real_x, real_y);
diff --git a/src/mame/video/gauntlet.cpp b/src/mame/video/gauntlet.cpp
index b003e45522b..e43f30c4d0a 100644
--- a/src/mame/video/gauntlet.cpp
+++ b/src/mame/video/gauntlet.cpp
@@ -168,11 +168,11 @@ uint32_t gauntlet_state::screen_update_gauntlet(screen_device &screen, bitmap_in
/* draw and merge the MO */
bitmap_ind16 &mobitmap = m_mob->bitmap();
for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next())
- for (int y = rect->min_y; y <= rect->max_y; y++)
+ for (int y = rect->top(); y <= rect->bottom(); y++)
{
uint16_t *mo = &mobitmap.pix16(y);
uint16_t *pf = &bitmap.pix16(y);
- for (int x = rect->min_x; x <= rect->max_x; x++)
+ for (int x = rect->left(); x <= rect->right(); x++)
if (mo[x] != 0xffff)
{
/* verified via schematics:
diff --git a/src/mame/video/harddriv.cpp b/src/mame/video/harddriv.cpp
index 931ff46e207..e2da5ba8d83 100644
--- a/src/mame/video/harddriv.cpp
+++ b/src/mame/video/harddriv.cpp
@@ -420,7 +420,7 @@ TMS340X0_SCANLINE_IND16_CB_MEMBER(harddriv_state::scanline_driver)
for (x = params->heblnk; x < params->hsblnk; x++)
dest[x] = m_gfx_palettebank * 256 + vram_base[BYTE_XOR_LE(coladdr++ & 0xfff)];
- if (scanline == screen.visible_area().max_y)
+ if (scanline == screen.visible_area().bottom())
display_speedups();
}
@@ -438,6 +438,6 @@ TMS340X0_SCANLINE_IND16_CB_MEMBER(harddriv_state::scanline_multisync)
for (x = params->heblnk; x < params->hsblnk; x++)
dest[x] = m_gfx_palettebank * 256 + vram_base[BYTE_XOR_LE(coladdr++ & 0x7ff)];
- if (scanline == screen.visible_area().max_y)
+ if (scanline == screen.visible_area().bottom())
display_speedups();
}
diff --git a/src/mame/video/irobot.cpp b/src/mame/video/irobot.cpp
index cdeef307727..1ff2031e48e 100644
--- a/src/mame/video/irobot.cpp
+++ b/src/mame/video/irobot.cpp
@@ -352,7 +352,7 @@ uint32_t irobot_state::screen_update_irobot(screen_device &screen, bitmap_ind16
int x, y, offs;
/* copy the polygon bitmap */
- for (y = cliprect.min_y; y <= cliprect.max_y; y++)
+ for (y = cliprect.top(); y <= cliprect.bottom(); y++)
draw_scanline8(bitmap, 0, y, BITMAP_WIDTH, &bitmap_base[y * BITMAP_WIDTH], nullptr);
/* redraw the non-zero characters in the alpha layer */
diff --git a/src/mame/video/jaguar.cpp b/src/mame/video/jaguar.cpp
index 803d5e14061..fde197a7ca1 100644
--- a/src/mame/video/jaguar.cpp
+++ b/src/mame/video/jaguar.cpp
@@ -204,8 +204,8 @@ inline void jaguar_state::get_crosshair_xy(int player, int &x, int &y)
const rectangle &visarea = m_screen->visible_area();
/* only 2 lightguns are connected */
- x = visarea.min_x + (((ioport(player ? "FAKE2_X" : "FAKE1_X")->read() & 0xff) * visarea.width()) >> 8);
- y = visarea.min_y + (((ioport(player ? "FAKE2_Y" : "FAKE1_Y")->read() & 0xff) * visarea.height()) >> 8);
+ x = visarea.left() + (((ioport(player ? "FAKE2_X" : "FAKE1_X")->read() & 0xff) * visarea.width()) >> 8);
+ y = visarea.top() + (((ioport(player ? "FAKE2_Y" : "FAKE1_Y")->read() & 0xff) * visarea.height()) >> 8);
}
@@ -752,7 +752,7 @@ void jaguar_state::scanline_update(int param)
if ((m_gpu_regs[VMODE] & 1) && vc >= (m_gpu_regs[VDB] & 0x7ff))
{
uint32_t *dest = &m_screen_bitmap.pix32(vc >> 1);
- int maxx = visarea.max_x;
+ int maxx = visarea.right();
int hde = effective_hvalue(m_gpu_regs[HDE]) >> 1;
uint16_t x,scanline[760];
uint8_t y,pixel_width = ((m_gpu_regs[VMODE]>>10)&3)+1;
@@ -761,7 +761,7 @@ void jaguar_state::scanline_update(int param)
if (ENABLE_BORDERS && vc % 2 == 0)
{
rgb_t border = rgb_t(m_gpu_regs[BORD1] & 0xff, m_gpu_regs[BORD1] >> 8, m_gpu_regs[BORD2] & 0xff);
- for (x = visarea.min_x; x <= visarea.max_x; x++)
+ for (x = visarea.left(); x <= visarea.right(); x++)
dest[x] = border;
}
diff --git a/src/mame/video/jedi.cpp b/src/mame/video/jedi.cpp
index d3ce309fa28..d99be2e9568 100644
--- a/src/mame/video/jedi.cpp
+++ b/src/mame/video/jedi.cpp
@@ -108,8 +108,8 @@ void jedi_state::do_pen_lookup(bitmap_rgb32 &bitmap, const rectangle &cliprect)
get_pens(pens);
- for (y = cliprect.min_y; y <= cliprect.max_y; y++)
- for(x = cliprect.min_x; x <= cliprect.max_x; x++)
+ for (y = cliprect.top(); y <= cliprect.bottom(); y++)
+ for(x = cliprect.left(); x <= cliprect.right(); x++)
bitmap.pix32(y, x) = pens[bitmap.pix32(y, x)];
}
@@ -158,12 +158,12 @@ void jedi_state::draw_background_and_text(bitmap_rgb32 &bitmap, const rectangle
memset(background_line_buffer, 0, 0x200 * sizeof(int));
- for (y = cliprect.min_y; y <= cliprect.max_y; y++)
+ for (y = cliprect.top(); y <= cliprect.bottom(); y++)
{
int x;
int bg_last_col = 0;
- for (x = cliprect.min_x; x <= cliprect.max_x; x += 2)
+ for (x = cliprect.left(); x <= cliprect.right(); x += 2)
{
int tx_col1, tx_col2, bg_col;
int bg_tempcol;
@@ -285,7 +285,7 @@ void jedi_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect)
int i;
uint16_t x = spriteram[offs + 0x100] + ((spriteram[offs + 0x40] & 0x01) << 8) - 2;
- if ((y < cliprect.min_y) || (y > cliprect.max_y))
+ if ((y < cliprect.top()) || (y > cliprect.bottom()))
continue;
if (flip_x)
diff --git a/src/mame/video/klax.cpp b/src/mame/video/klax.cpp
index b8a3129a35c..d32022c5d2b 100644
--- a/src/mame/video/klax.cpp
+++ b/src/mame/video/klax.cpp
@@ -100,11 +100,11 @@ uint32_t klax_state::screen_update_klax(screen_device &screen, bitmap_ind16 &bit
// draw and merge the MO
bitmap_ind16 &mobitmap = m_mob->bitmap();
for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next())
- for (int y = rect->min_y; y <= rect->max_y; y++)
+ for (int y = rect->top(); y <= rect->bottom(); y++)
{
uint16_t *mo = &mobitmap.pix16(y);
uint16_t *pf = &bitmap.pix16(y);
- for (int x = rect->min_x; x <= rect->max_x; x++)
+ for (int x = rect->left(); x <= rect->right(); x++)
if (mo[x] != 0xffff)
{
/* verified from schematics:
diff --git a/src/mame/video/leland.cpp b/src/mame/video/leland.cpp
index d0dedd09e74..6408f1d1d9d 100644
--- a/src/mame/video/leland.cpp
+++ b/src/mame/video/leland.cpp
@@ -450,13 +450,13 @@ uint32_t leland_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap
m_tilemap->draw(screen, bitmap, cliprect, 0);
/* for each scanline in the visible region */
- for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
+ for (int y = cliprect.top(); y <= cliprect.bottom(); y++)
{
uint16_t *const dst = &bitmap.pix16(y);
uint8_t const *const fg_src = &m_video_ram[y << 8];
/* for each pixel on the scanline */
- for (int x = cliprect.min_x; x <= cliprect.max_x; x++)
+ for (int x = cliprect.left(); x <= cliprect.right(); x++)
{
/* build the pen, background is d0-d5 */
pen_t pen = dst[x] & 0x3f;
diff --git a/src/mame/video/lemmings.cpp b/src/mame/video/lemmings.cpp
index 70d13de215a..c7c3f80a4f4 100644
--- a/src/mame/video/lemmings.cpp
+++ b/src/mame/video/lemmings.cpp
@@ -118,11 +118,11 @@ void lemmings_state::lemmings_copy_bitmap(bitmap_rgb32& bitmap, int* xscroll, in
int y,x;
const pen_t *paldata = m_palette->pens();
- for (y=cliprect.min_y; y<cliprect.max_y;y++)
+ for (y=cliprect.top(); y<cliprect.bottom();y++)
{
uint32_t* dst = &bitmap.pix32(y,0);
- for (x=cliprect.min_x; x<cliprect.max_x;x++)
+ for (x=cliprect.left(); x<cliprect.right();x++)
{
uint16_t src = m_bitmap0.pix16((y-*yscroll)&0xff,(x-*xscroll)&0x7ff);
@@ -137,9 +137,7 @@ uint32_t lemmings_state::screen_update_lemmings(screen_device &screen, bitmap_rg
int x1 = -m_control_data[0];
int x0 = -m_control_data[2];
int y = 0;
- rectangle rect;
- rect.max_y = cliprect.max_y;
- rect.min_y = cliprect.min_y;
+ rectangle rect(0, 0, cliprect.top(), cliprect.bottom());
// sprites are flipped relative to tilemaps
m_sprgen[0]->set_flip_screen(true);
@@ -157,12 +155,10 @@ uint32_t lemmings_state::screen_update_lemmings(screen_device &screen, bitmap_rg
}
else
{
- rect.max_x = 159;
- rect.min_x = 0;
+ rect.setx(0, 159);
lemmings_copy_bitmap(bitmap, &x0, &y, rect);
- rect.max_x = 319;
- rect.min_x = 160;
+ rect.setx(160, 319);
lemmings_copy_bitmap(bitmap, &x1, &y, rect);
}
diff --git a/src/mame/video/mac.cpp b/src/mame/video/mac.cpp
index 5883d7f102d..ccf6bcfc245 100644
--- a/src/mame/video/mac.cpp
+++ b/src/mame/video/mac.cpp
@@ -226,7 +226,6 @@ VIDEO_RESET_MEMBER(mac_state,maceagle)
VIDEO_RESET_MEMBER(mac_state,macrbv)
{
- rectangle visarea;
int htotal, vtotal;
double framerate;
int view;
@@ -242,16 +241,14 @@ VIDEO_RESET_MEMBER(mac_state,macrbv)
m_rbv_type = RBV_TYPE_RBV;
- visarea.min_x = 0;
- visarea.min_y = 0;
view = 0;
m_rbv_montype = m_montype.read_safe(2);
+ rectangle visarea;
switch (m_rbv_montype)
{
case 1: // 15" portrait display
- visarea.max_x = 640-1;
- visarea.max_y = 870-1;
+ visarea.set(0, 640-1, 0, 870-1);
htotal = 832;
vtotal = 918;
framerate = 75.0;
@@ -259,8 +256,7 @@ VIDEO_RESET_MEMBER(mac_state,macrbv)
break;
case 2: // 12" RGB
- visarea.max_x = 512-1;
- visarea.max_y = 384-1;
+ visarea.set(0, 512-1, 0, 384-1);
htotal = 640;
vtotal = 407;
framerate = 60.15;
@@ -268,15 +264,14 @@ VIDEO_RESET_MEMBER(mac_state,macrbv)
case 6: // 13" RGB
default:
- visarea.max_x = 640-1;
- visarea.max_y = 480-1;
+ visarea.set(0, 640-1, 0, 480-1);
htotal = 800;
vtotal = 525;
framerate = 59.94;
break;
}
-// printf("RBV reset: monitor is %dx%d @ %f Hz\n", visarea.max_x+1, visarea.max_y+1, framerate);
+// logerror("RBV reset: monitor is %dx%d @ %f Hz\n", visarea.width(), visarea.height(), framerate);
m_screen->configure(htotal, vtotal, visarea, HZ_TO_ATTOSECONDS(framerate));
render_target *target = machine().render().first_target();
target->set_view(view);
@@ -284,7 +279,6 @@ VIDEO_RESET_MEMBER(mac_state,macrbv)
VIDEO_RESET_MEMBER(mac_state,macsonora)
{
- rectangle visarea;
int htotal, vtotal;
double framerate;
int view = 0;
@@ -300,15 +294,12 @@ VIDEO_RESET_MEMBER(mac_state,macsonora)
m_rbv_type = RBV_TYPE_SONORA;
- visarea.min_x = 0;
- visarea.min_y = 0;
-
m_rbv_montype = m_montype.read_safe(2);
+ rectangle visarea;
switch (m_rbv_montype)
{
case 1: // 15" portrait display
- visarea.max_x = 640-1;
- visarea.max_y = 870-1;
+ visarea.set(0, 640-1, 0, 870-1);
htotal = 832;
vtotal = 918;
framerate = 75.0;
@@ -316,8 +307,7 @@ VIDEO_RESET_MEMBER(mac_state,macsonora)
break;
case 2: // 12" RGB
- visarea.max_x = 512-1;
- visarea.max_y = 384-1;
+ visarea.set(0, 512-1, 0, 384-1);
htotal = 640;
vtotal = 407;
framerate = 60.15;
@@ -325,15 +315,14 @@ VIDEO_RESET_MEMBER(mac_state,macsonora)
case 6: // 13" RGB
default:
- visarea.max_x = 640-1;
- visarea.max_y = 480-1;
+ visarea.set(0, 640-1, 0, 480-1);
htotal = 800;
vtotal = 525;
framerate = 59.94;
break;
}
-// printf("Sonora reset: monitor is %dx%d @ %f Hz\n", visarea.max_x+1, visarea.max_y+1, framerate);
+// logerror("Sonora reset: monitor is %dx%d @ %f Hz\n", visarea.width(), visarea.height(), framerate);
m_screen->configure(htotal, vtotal, visarea, HZ_TO_ATTOSECONDS(framerate));
render_target *target = machine().render().first_target();
target->set_view(view);
diff --git a/src/mame/video/madalien.cpp b/src/mame/video/madalien.cpp
index f07b9badfcf..41e49f8aa1c 100644
--- a/src/mame/video/madalien.cpp
+++ b/src/mame/video/madalien.cpp
@@ -155,11 +155,8 @@ VIDEO_START_MEMBER(madalien_state,madalien)
void madalien_state::draw_edges(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int flip, int scroll_mode)
{
- rectangle clip_edge1;
- rectangle clip_edge2;
-
- clip_edge1 = cliprect;
- clip_edge2 = cliprect;
+ rectangle clip_edge1(cliprect);
+ rectangle clip_edge2(cliprect);
if (flip)
{
@@ -205,7 +202,7 @@ void madalien_state::draw_headlight(bitmap_ind16 &bitmap, const rectangle &clipr
if (flip)
hy = ~hy;
- if ((hy < cliprect.min_y) || (hy > cliprect.max_y))
+ if ((hy < cliprect.top()) || (hy > cliprect.bottom()))
continue;
for (x = 0; x < 0x80; x++)
@@ -215,7 +212,7 @@ void madalien_state::draw_headlight(bitmap_ind16 &bitmap, const rectangle &clipr
if (flip)
hx = ~hx;
- if ((hx < cliprect.min_x) || (hx > cliprect.max_x))
+ if ((hx < cliprect.left()) || (hx > cliprect.right()))
continue;
if (m_headlight_bitmap->pix16(y, x) != 0)
@@ -283,9 +280,9 @@ uint32_t madalien_state::screen_update_madalien(screen_device &screen, bitmap_in
min_x = 0xff - max_x_save;
}
- for (y = cliprect.min_y; y <= cliprect.max_y ; y++)
+ for (y = cliprect.top(); y <= cliprect.bottom(); y++)
for (x = min_x; x <= max_x; x++)
- if ((x >= cliprect.min_x) && (x <= cliprect.max_x))
+ if ((x >= cliprect.left()) && (x <= cliprect.right()))
bitmap.pix16(y, x) |= 8;
}
diff --git a/src/mame/video/mermaid.cpp b/src/mame/video/mermaid.cpp
index 035ec20ca30..00a57d3c3f0 100644
--- a/src/mame/video/mermaid.cpp
+++ b/src/mame/video/mermaid.cpp
@@ -230,8 +230,8 @@ uint8_t mermaid_state::collision_check( rectangle& rect )
int x;
int y;
- for (y = rect.min_y; y <= rect.max_y; y++)
- for (x = rect.min_x; x <= rect.max_x; x++)
+ for (y = rect.top(); y <= rect.bottom(); y++)
+ for (x = rect.left(); x <= rect.right(); x++)
{
uint16_t a = m_palette->pen_indirect(m_helper.pix16(y, x)) & 0x3f;
uint16_t b = m_palette->pen_indirect(m_helper2.pix16(y, x)) & 0x3f;
@@ -289,11 +289,9 @@ void mermaid_state::collision_update()
sy = 240 - sy;
}
- rect.min_x = sx;
- rect.min_y = sy;
- rect.max_x = sx + m_gfxdecode->gfx(1)->width() - 1;
- rect.max_y = sy + m_gfxdecode->gfx(1)->height() - 1;
-
+ rect.set(
+ sx, sx + m_gfxdecode->gfx(1)->width() - 1,
+ sy, sy + m_gfxdecode->gfx(1)->height() - 1);
rect &= visarea;
// check collision sprite - background
@@ -392,11 +390,9 @@ void mermaid_state::collision_update()
sy = 240 - sy;
}
- rect.min_x = sx;
- rect.min_y = sy;
- rect.max_x = sx + m_gfxdecode->gfx(1)->width() - 1;
- rect.max_y = sy + m_gfxdecode->gfx(1)->height() - 1;
-
+ rect.set(
+ sx, sx + m_gfxdecode->gfx(1)->width() - 1,
+ sy, sy + m_gfxdecode->gfx(1)->height() - 1);
rect &= visarea;
// check collision sprite - sprite
@@ -473,11 +469,9 @@ void mermaid_state::collision_update()
sy = 240 - sy;
}
- rect.min_x = sx;
- rect.min_y = sy;
- rect.max_x = sx + m_gfxdecode->gfx(1)->width() - 1;
- rect.max_y = sy + m_gfxdecode->gfx(1)->height() - 1;
-
+ rect.set(
+ sx, sx + m_gfxdecode->gfx(1)->width() - 1,
+ sy, sy + m_gfxdecode->gfx(1)->height() - 1);
rect &= visarea;
// check collision sprite - sprite
diff --git a/src/mame/video/namcos21.cpp b/src/mame/video/namcos21.cpp
index 5fdb1deda54..db10b9fe6ca 100644
--- a/src/mame/video/namcos21.cpp
+++ b/src/mame/video/namcos21.cpp
@@ -103,13 +103,13 @@ void namcos21_state::copy_visible_poly_framebuffer(bitmap_ind16 &bitmap, const r
{
/* blit the visible framebuffer */
int sy;
- for( sy=clip.min_y; sy<=clip.max_y; sy++ )
+ for( sy=clip.top(); sy<=clip.bottom(); sy++ )
{
uint16_t *dest = &bitmap.pix16(sy);
const uint16_t *pPen = m_mpPolyFrameBufferPens2.get()+NAMCOS21_POLY_FRAME_WIDTH*sy;
const uint16_t *pZ = m_mpPolyFrameBufferZ2.get()+NAMCOS21_POLY_FRAME_WIDTH*sy;
int sx;
- for( sx=clip.min_x; sx<=clip.max_x; sx++ )
+ for( sx=clip.left(); sx<=clip.right(); sx++ )
{
int z = pZ[sx];
//if( pZ[sx]!=0x7fff )
@@ -429,17 +429,17 @@ uint32_t namcos21_state::screen_update_driveyes(screen_device &screen, bitmap_in
void namcos21_state::winrun_bitmap_draw(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
uint8_t *videoram = m_videoram.get();
- //printf("%d %d (%d %d) - %04x %04x %04x|%04x %04x\n",cliprect.min_y,cliprect.max_y,m_screen->vpos(),m_gpu_intc->get_posirq_line(),m_winrun_gpu_register[0],m_winrun_gpu_register[2/2],m_winrun_gpu_register[4/2],m_winrun_gpu_register[0xa/2],m_winrun_gpu_register[0xc/2]);
+ //printf("%d %d (%d %d) - %04x %04x %04x|%04x %04x\n",cliprect.top(),cliprect.bottom(),m_screen->vpos(),m_gpu_intc->get_posirq_line(),m_winrun_gpu_register[0],m_winrun_gpu_register[2/2],m_winrun_gpu_register[4/2],m_winrun_gpu_register[0xa/2],m_winrun_gpu_register[0xc/2]);
- int yscroll = -cliprect.min_y+(int16_t)m_winrun_gpu_register[0x2/2];
+ int yscroll = -cliprect.top()+(int16_t)m_winrun_gpu_register[0x2/2];
int xscroll = 0;//m_winrun_gpu_register[0xc/2] >> 7;
int base = 0x1000+0x100*(m_winrun_color&0xf);
int sx,sy;
- for( sy=cliprect.min_y; sy<=cliprect.max_y; sy++ )
+ for( sy=cliprect.top(); sy<=cliprect.bottom(); sy++ )
{
const uint8_t *pSource = &videoram[((yscroll+sy)&0x3ff)*0x200];
uint16_t *pDest = &bitmap.pix16(sy);
- for( sx=cliprect.min_x; sx<=cliprect.max_x; sx++ )
+ for( sx=cliprect.left(); sx<=cliprect.right(); sx++ )
{
int pen = pSource[(sx+xscroll) & 0x1ff];
switch( pen )
diff --git a/src/mame/video/namcos22.cpp b/src/mame/video/namcos22.cpp
index 19cabcc08bd..f5765af21d6 100644
--- a/src/mame/video/namcos22.cpp
+++ b/src/mame/video/namcos22.cpp
@@ -307,11 +307,11 @@ void namcos22_renderer::poly3d_drawquad(screen_device &screen, bitmap_rgb32 &bit
int cy = 240 + node->data.quad.vy;
m_clipx = cx;
m_clipy = cy;
- m_cliprect.set(cx + node->data.quad.vw, cx - node->data.quad.vw, cy + node->data.quad.vh, cy - node->data.quad.vh);
- if (m_cliprect.min_x < 0) m_cliprect.min_x = 0;
- if (m_cliprect.max_x > 639) m_cliprect.max_x = 639;
- if (m_cliprect.min_y < 0) m_cliprect.min_y = 0;
- if (m_cliprect.max_y > 479) m_cliprect.max_y = 479;
+ m_cliprect.set(
+ std::max<s32>(cx + node->data.quad.vw, 0),
+ std::min<s32>(cx - node->data.quad.vw, 639),
+ std::max<s32>(cy + node->data.quad.vh, 0),
+ std::min<s32>(cy - node->data.quad.vh, 479));
// non-direct case: project and z-clip
if (!direct)
@@ -583,11 +583,11 @@ void namcos22_renderer::poly3d_drawsprite(
void namcos22_renderer::render_sprite(screen_device &screen, bitmap_rgb32 &bitmap, struct namcos22_scenenode *node)
{
// scene clip
- m_cliprect.set(node->data.sprite.cx_min, node->data.sprite.cx_max, node->data.sprite.cy_min, node->data.sprite.cy_max);
- if (m_cliprect.min_x < 0) m_cliprect.min_x = 0;
- if (m_cliprect.max_x > 639) m_cliprect.max_x = 639;
- if (m_cliprect.min_y < 0) m_cliprect.min_y = 0;
- if (m_cliprect.max_y > 479) m_cliprect.max_y = 479;
+ m_cliprect.set(
+ std::max<s32>(node->data.sprite.cx_min, 0),
+ std::min<s32>(node->data.sprite.cx_max, 639),
+ std::max<s32>(node->data.sprite.cy_min, 0),
+ std::min<s32>(node->data.sprite.cy_max, 479));
int offset = 0;
@@ -602,20 +602,19 @@ void namcos22_renderer::render_sprite(screen_device &screen, bitmap_rgb32 &bitma
code += nthword(&m_state.m_spriteram[0x800/4], offset + node->data.sprite.linktype*4);
poly3d_drawsprite(
- screen,
- bitmap,
- code,
- node->data.sprite.color,
- node->data.sprite.flipx,
- node->data.sprite.flipy,
- node->data.sprite.xpos + col * node->data.sprite.sizex,
- node->data.sprite.ypos + row * node->data.sprite.sizey,
- (node->data.sprite.sizex << 16) / 32,
- (node->data.sprite.sizey << 16) / 32,
- node->data.sprite.cz,
- node->data.sprite.pri,
- 0xff - node->data.sprite.translucency
- );
+ screen,
+ bitmap,
+ code,
+ node->data.sprite.color,
+ node->data.sprite.flipx,
+ node->data.sprite.flipy,
+ node->data.sprite.xpos + col * node->data.sprite.sizex,
+ node->data.sprite.ypos + row * node->data.sprite.sizey,
+ (node->data.sprite.sizex << 16) / 32,
+ (node->data.sprite.sizey << 16) / 32,
+ node->data.sprite.cz,
+ node->data.sprite.pri,
+ 0xff - node->data.sprite.translucency);
offset++;
}
}
@@ -1895,12 +1894,12 @@ void namcos22_state::namcos22s_mix_text_layer(screen_device &screen, bitmap_rgb3
rgbaint_t fade_color(0, m_screen_fade_r, m_screen_fade_g, m_screen_fade_b);
// mix textlayer with poly/sprites
- for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
+ for (int y = cliprect.top(); y <= cliprect.bottom(); y++)
{
src = &m_mix_bitmap->pix16(y);
dest = &bitmap.pix32(y);
pri = &screen.priority().pix8(y);
- for (int x = cliprect.min_x; x <= cliprect.max_x; x++)
+ for (int x = cliprect.left(); x <= cliprect.right(); x++)
{
// skip if transparent or under poly/sprite
if (pri[x] == prival)
@@ -1970,12 +1969,12 @@ void namcos22_state::namcos22_mix_text_layer(screen_device &screen, bitmap_rgb32
};
// mix textlayer with poly/sprites
- for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
+ for (int y = cliprect.top(); y <= cliprect.bottom(); y++)
{
src = &m_mix_bitmap->pix16(y);
dest = &bitmap.pix32(y);
pri = &screen.priority().pix8(y);
- for (int x = cliprect.min_x; x <= cliprect.max_x; x++)
+ for (int x = cliprect.left(); x <= cliprect.right(); x++)
{
uint32_t pixel = dest[x];
@@ -2314,10 +2313,10 @@ uint32_t namcos22_state::screen_update_namcos22s(screen_device &screen, bitmap_r
const uint8_t *rlut = (const uint8_t *)&m_mixer[0x100/4];
const uint8_t *glut = (const uint8_t *)&m_mixer[0x200/4];
const uint8_t *blut = (const uint8_t *)&m_mixer[0x300/4];
- for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
+ for (int y = cliprect.top(); y <= cliprect.bottom(); y++)
{
uint32_t *dest = &bitmap.pix32(y);
- for (int x = cliprect.min_x; x <= cliprect.max_x; x++)
+ for (int x = cliprect.left(); x <= cliprect.right(); x++)
{
int rgb = dest[x];
int r = rlut[NATIVE_ENDIAN_VALUE_LE_BE(3, 0) ^ ((rgb >> 16) & 0xff)];
diff --git a/src/mame/video/offtwall.cpp b/src/mame/video/offtwall.cpp
index 1bdd845059f..d7217b32847 100644
--- a/src/mame/video/offtwall.cpp
+++ b/src/mame/video/offtwall.cpp
@@ -87,11 +87,11 @@ uint32_t offtwall_state::screen_update_offtwall(screen_device &screen, bitmap_in
// draw and merge the MO
bitmap_ind16 &mobitmap = m_vad->mob().bitmap();
for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next())
- for (int y = rect->min_y; y <= rect->max_y; y++)
+ for (int y = rect->top(); y <= rect->bottom(); y++)
{
uint16_t *mo = &mobitmap.pix16(y);
uint16_t *pf = &bitmap.pix16(y);
- for (int x = rect->min_x; x <= rect->max_x; x++)
+ for (int x = rect->left(); x <= rect->right(); x++)
if (mo[x] != 0xffff)
{
/* not yet verified
diff --git a/src/mame/video/quasar.cpp b/src/mame/video/quasar.cpp
index 8f94b3b89e0..8450ffe354f 100644
--- a/src/mame/video/quasar.cpp
+++ b/src/mame/video/quasar.cpp
@@ -170,11 +170,11 @@ uint32_t quasar_state::screen_update_quasar(screen_device &screen, bitmap_ind16
{
int y;
- for (y = cliprect.min_y; y <= cliprect.max_y; y++)
+ for (y = cliprect.top(); y <= cliprect.bottom(); y++)
{
int x;
- for (x = cliprect.min_x; x <= cliprect.max_x; x++)
+ for (x = cliprect.left(); x <= cliprect.right(); x++)
{
int pixel0 = s2636_0_bitmap.pix16(y, x);
int pixel1 = s2636_1_bitmap.pix16(y, x);
diff --git a/src/mame/video/rampart.cpp b/src/mame/video/rampart.cpp
index d4ea5e1a2d0..4798bb4d8c8 100644
--- a/src/mame/video/rampart.cpp
+++ b/src/mame/video/rampart.cpp
@@ -76,11 +76,11 @@ uint32_t rampart_state::screen_update_rampart(screen_device &screen, bitmap_ind1
// draw and merge the MO
bitmap_ind16 &mobitmap = m_mob->bitmap();
for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next())
- for (int y = rect->min_y; y <= rect->max_y; y++)
+ for (int y = rect->top(); y <= rect->bottom(); y++)
{
uint16_t *mo = &mobitmap.pix16(y);
uint16_t *pf = &bitmap.pix16(y);
- for (int x = rect->min_x; x <= rect->max_x; x++)
+ for (int x = rect->left(); x <= rect->right(); x++)
if (mo[x] != 0xffff)
{
/* the PCB supports more complex priorities, but the PAL is not stuffed, so we get the default */
@@ -101,13 +101,13 @@ uint32_t rampart_state::screen_update_rampart(screen_device &screen, bitmap_ind1
void rampart_state::rampart_bitmap_render(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
/* update any dirty scanlines */
- for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
+ for (int y = cliprect.top(); y <= cliprect.bottom(); y++)
{
const uint16_t *src = &m_bitmap[256 * y];
uint16_t *dst = &bitmap.pix16(y);
/* regenerate the line */
- for (int x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2)
+ for (int x = cliprect.left() & ~1; x <= cliprect.right(); x += 2)
{
int bits = src[(x - 8) / 2];
dst[x + 0] = bits >> 8;
diff --git a/src/mame/video/realbrk.cpp b/src/mame/video/realbrk.cpp
index 0b419694fd6..02b1118f122 100644
--- a/src/mame/video/realbrk.cpp
+++ b/src/mame/video/realbrk.cpp
@@ -184,81 +184,74 @@ void realbrk_state::video_start()
***************************************************************************/
-void realbrk_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect, int layer)
+// DaiDaiKakumei
+// layer : 0== bghigh<spr 1== bglow<spr<bghigh 2==spr<bglow 3==boarder
+template <bool Rotatable>
+void realbrk_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int layer)
{
- int offs;
+ int const max_x(m_screen->width());
+ int const max_y(m_screen->height());
- int max_x = m_screen->width();
- int max_y = m_screen->height();
-
- rectangle spritetile_clip(0, 31, 0, 31);
-
- for ( offs = 0x3000/2; offs < 0x3600/2; offs += 2/2 )
+ for (int offs = 0x3000 / 2; offs < 0x3600 / 2; offs += 2 / 2)
{
- int sx, sy, dim, zoom, flip, color, attr, code, flipx, flipy, gfx, rot, pri;
+ if (BIT(m_spriteram[offs], 15))
+ continue;
- int x, xdim, xnum, xstart, xend, xinc;
- int y, ydim, ynum, ystart, yend, yinc;
+ uint16_t const *const s(&m_spriteram[(m_spriteram[offs] & 0x3ff) * 16 / 2]);
- if (m_spriteram[offs] & 0x8000)
- continue;
+ int sy = s[0];
- uint16_t const *const s = &m_spriteram[(m_spriteram[offs] & 0x3ff) * 16/2];
+ int sx = s[1];
- sy = s[ 0 ];
- sx = s[ 1 ];
- dim = s[ 2 ];
- zoom = s[ 3 ];
- flip = s[ 4 ];
- color = s[ 5 ];
- attr = s[ 6 ];
- code = s[ 7 ];
+ int xnum = ((s[2] >> 0) & 0x001f) + 1;
+ int ynum = ((s[2] >> 8) & 0x001f) + 1;
- pri = flip & 0x03;
+ int xdim = ((s[3] >> 0) & 0x00ff) << (16 - 6 + 4);
+ int ydim = ((s[3] >> 8) & 0x00ff) << (16 - 6 + 4);
- if(pri != layer)
- continue;
+ int flipx = BIT(s[4], 8);
+ int flipy = BIT(s[4], 9);
+ int rot = (s[4] >> 4) & 0x0003;
+ int pri = (s[4] >> 0) & 0x0003;
+
+ int color = s[5];
- xnum = ((dim >> 0) & 0x1f) + 1;
- ynum = ((dim >> 8) & 0x1f) + 1;
+ int gfx = (s[6] & 0x0001) + 2;
- flipx = flip & 0x0100;
- flipy = flip & 0x0200;
- rot = (flip & 0x0030) >> 4;
+ int code = s[7];
- gfx = (attr & 0x0001) + 2;
+ if (pri != layer)
+ continue;
sx = ((sx & 0x1ff) - (sx & 0x200)) << 16;
sy = ((sy & 0x0ff) - (sy & 0x100)) << 16;
- xdim = ((zoom & 0x00ff) >> 0) << (16-6+4);
- ydim = ((zoom & 0xff00) >> 8) << (16-6+4);
-
- if (flip_screen_x()) { flipx = !flipx; sx = (max_x << 16) - sx - xnum * xdim; }
- if (flip_screen_y()) { flipy = !flipy; sy = (max_y << 16) - sy - ynum * ydim; }
+ if (flip_screen_x()) { flipx = !flipx; sx = (max_x << 16) - sx - xnum * xdim; }
+ if (flip_screen_y()) { flipy = !flipy; sy = (max_y << 16) - sy - ynum * ydim; }
+ int xstart, xend, xinc;
if (flipx) { xstart = xnum-1; xend = -1; xinc = -1; }
else { xstart = 0; xend = xnum; xinc = +1; }
+ int ystart, yend, yinc;
if (flipy) { ystart = ynum-1; yend = -1; yinc = -1; }
else { ystart = 0; yend = ynum; yinc = +1; }
-
- // The positioning of the rotated sprites makes it look as if
- // the sprite source is scanned in a constant pattern left to right,
- // top to bottom, and the destination plotting pattern is varied.
- // copyrozbitmap works the other way.
-
- // Rotating a sprite when drawgfxzoom draws a tile at a time means
- // - rotating each sprite tile
- // - transforming each tile position
- // - compensating for the offset introduced by the difference in
- // scanning patterns between the original mechanism and copyrozbitmap
-
-
- for (y = ystart; y != yend; y += yinc)
+ /*
+ The positioning of the rotated sprites makes it look as if
+ the sprite source is scanned in a constant pattern left to right,
+ top to bottom, and the destination plotting pattern is varied.
+ copyrozbitmap works the other way.
+
+ Rotating a sprite when drawgfxzoom draws a tile at a time means
+ - rotating each sprite tile
+ - transforming each tile position
+ - compensating for the offset introduced by the difference in
+ scanning patterns between the original mechanism and copyrozbitmap
+ */
+ for (int y = ystart; y != yend; y += yinc)
{
- for (x = xstart; x != xend; x += xinc)
+ for (int x = xstart; x != xend; x += xinc)
{
int currx = (sx + x * xdim) / 0x10000;
int curry = (sy + y * ydim) / 0x10000;
@@ -266,159 +259,79 @@ void realbrk_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,
int scalex = (sx + (x + 1) * xdim) / 0x10000 - currx;
int scaley = (sy + (y + 1) * ydim) / 0x10000 - curry;
- // buffer the tile and rotate it into bitmap
- if( rot )
+ if (Rotatable && rot)
{
- m_tmpbitmap0->fill(0, spritetile_clip );
- m_tmpbitmap1->fill(0, spritetile_clip );
- m_gfxdecode->gfx(gfx)->zoom_transpen(*m_tmpbitmap0,spritetile_clip,
- code++,
- color,
- flipx, flipy,
- 0,0,
- (rot & 1 ? scaley : scalex) << 12, (rot & 1 ? scalex : scaley) << 12,0);
+ // buffer the tile and rotate it into bitmap
+ constexpr rectangle spritetile_clip(0, 31, 0, 31);
+ m_tmpbitmap0->fill(0, spritetile_clip);
+ m_tmpbitmap1->fill(0, spritetile_clip);
+ m_gfxdecode->gfx(gfx)->zoom_transpen(*m_tmpbitmap0, spritetile_clip,
+ code++,
+ color,
+ flipx, flipy,
+ 0, 0,
+ ((rot & 1) ? scaley : scalex) << 12, ((rot & 1) ? scalex : scaley) << 12,
+ 0);
// peek at the unrotated sprite
- // copybitmap_trans( bitmap,*m_tmpbitmap0, 0,0, 50+(x * xdim/0x10000),50+(y * ydim/0x10000), cliprect, 0 );
- }
-
- switch( rot )
- {
+ // copybitmap_trans(bitmap, *m_tmpbitmap0, 0,0, 50 + (x * xdim / 0x10000), 50 + (y * ydim/0x10000), cliprect, 0);
+ switch (rot)
+ {
case 0x1: // rot 90
- copyrozbitmap_trans( *m_tmpbitmap1, m_tmpbitmap1->cliprect(), *m_tmpbitmap0,
- (uint32_t)0<<16,
- (uint32_t)16<<16,
- 0 << 16,
- 0xffff << 16,
- 1 << 16,
- 0 << 16,
- 0, 0 );
-
- currx = (sx - (y+1) * ydim) / 0x10000;
- curry = (sy + x * xdim) / 0x10000;
-
- copybitmap_trans( bitmap,*m_tmpbitmap1, 0,0, currx,curry, cliprect, 0 );
+ copyrozbitmap_trans(*m_tmpbitmap1, m_tmpbitmap1->cliprect(), *m_tmpbitmap0,
+ uint32_t(0) << 16,
+ uint32_t(16) << 16,
+ 0 << 16,
+ 0xffff << 16,
+ 1 << 16,
+ 0 << 16,
+ 0, 0);
+
+ currx = (sx - (y + 1) * ydim) / 0x10000;
+ curry = (sy + x * xdim) / 0x10000;
break;
case 0x2: // rot 180
- copyrozbitmap_trans( *m_tmpbitmap1, m_tmpbitmap1->cliprect(), *m_tmpbitmap0,
- (uint32_t)16<<16,
- (uint32_t)16<<16,
- 0xffff << 16,
- 0 << 16,
- 0 << 16,
- 0xffff << 16,
- 0, 0 );
-
- currx = (sx - (x+1) * xdim) / 0x10000;
- curry = (sy - (y+1) * ydim) / 0x10000;
-
- copybitmap_trans( bitmap,*m_tmpbitmap1, 0,0, currx,curry, cliprect, 0 );
+ copyrozbitmap_trans(*m_tmpbitmap1, m_tmpbitmap1->cliprect(), *m_tmpbitmap0,
+ uint32_t(16) << 16,
+ uint32_t(16) << 16,
+ 0xffff << 16,
+ 0 << 16,
+ 0 << 16,
+ 0xffff << 16,
+ 0, 0);
+
+ currx = (sx - (x + 1) * xdim) / 0x10000;
+ curry = (sy - (y + 1) * ydim) / 0x10000;
break;
case 0x3: // rot 270
- copyrozbitmap_trans( *m_tmpbitmap1, m_tmpbitmap1->cliprect(), *m_tmpbitmap0,
- (uint32_t)16<<16,
- (uint32_t)0<<16,
- 0 << 16,
- 1 << 16,
- 0xffff << 16,
- 0 << 16,
- 0, 0 );
-
- currx = (sx + y * ydim) / 0x10000;
- curry = (sy - (x+1) * xdim) / 0x10000;
-
- copybitmap_trans( bitmap,*m_tmpbitmap1, 0,0, currx,curry, cliprect, 0 );
+ copyrozbitmap_trans(*m_tmpbitmap1, m_tmpbitmap1->cliprect(), *m_tmpbitmap0,
+ uint32_t(16) << 16,
+ uint32_t(0) << 16,
+ 0 << 16,
+ 1 << 16,
+ 0xffff << 16,
+ 0 << 16,
+ 0, 0);
+
+ currx = (sx + y * ydim) / 0x10000;
+ curry = (sy - (x + 1) * xdim) / 0x10000;
break;
+ }
- default:
- m_gfxdecode->gfx(gfx)->zoom_transpen(bitmap,cliprect,
- code++,
- color,
- flipx, flipy,
- currx, curry,
- scalex << 12, scaley << 12,0);
- break;
+ copybitmap_trans(bitmap, *m_tmpbitmap1, 0, 0, currx, curry, cliprect, 0);
+ }
+ else
+ {
+ m_gfxdecode->gfx(gfx)->zoom_transpen(bitmap, cliprect,
+ code++,
+ color,
+ flipx, flipy,
+ currx, curry,
+ scalex << 12, scaley << 12,
+ 0);
}
-
- }
- }
- }
-}
-
-/* DaiDaiKakumei */
-/* layer : 0== bghigh<spr 1== bglow<spr<bghigh 2==spr<bglow 3==boarder */
-void realbrk_state::dai2kaku_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect, int layer)
-{
- int offs;
-
- int max_x = m_screen->width();
- int max_y = m_screen->height();
-
- for ( offs = 0x3000/2; offs < 0x3600/2; offs += 2/2 )
- {
- int sx, sy, dim, zoom, flip, color, attr, code, flipx, flipy, gfx;
-
- int x, xdim, xnum, xstart, xend, xinc;
- int y, ydim, ynum, ystart, yend, yinc;
-
- uint16_t *s;
-
- if (m_spriteram[offs] & 0x8000) continue;
-
- s = &m_spriteram[(m_spriteram[offs] & 0x3ff) * 16/2];
-
- sy = s[ 0 ];
- sx = s[ 1 ];
- dim = s[ 2 ];
- zoom = s[ 3 ];
- flip = s[ 4 ];
- color = s[ 5 ];
- attr = s[ 6 ];
- code = s[ 7 ];
-
- if(( flip & 0x03 ) != layer ) continue;
-
- xnum = ((dim >> 0) & 0x1f) + 1;
- ynum = ((dim >> 8) & 0x1f) + 1;
-
- flipx = flip & 0x0100;
- flipy = flip & 0x0200;
-
- gfx = (attr & 0x0001) + 2;
-
- sx = ((sx & 0x1ff) - (sx & 0x200)) << 16;
- sy = ((sy & 0x0ff) - (sy & 0x100)) << 16;
-
- xdim = ((zoom & 0x00ff) >> 0) << (16-6+4);
- ydim = ((zoom & 0xff00) >> 8) << (16-6+4);
-
- if (flip_screen_x()) { flipx = !flipx; sx = (max_x << 16) - sx - xnum * xdim; }
- if (flip_screen_y()) { flipy = !flipy; sy = (max_y << 16) - sy - ynum * ydim; }
-
- if (flipx) { xstart = xnum-1; xend = -1; xinc = -1; }
- else { xstart = 0; xend = xnum; xinc = +1; }
-
- if (flipy) { ystart = ynum-1; yend = -1; yinc = -1; }
- else { ystart = 0; yend = ynum; yinc = +1; }
-
- for (y = ystart; y != yend; y += yinc)
- {
- for (x = xstart; x != xend; x += xinc)
- {
- int currx = (sx + x * xdim) / 0x10000;
- int curry = (sy + y * ydim) / 0x10000;
-
- int scalex = (sx + (x + 1) * xdim) / 0x10000 - currx;
- int scaley = (sy + (y + 1) * ydim) / 0x10000 - curry;
-
- m_gfxdecode->gfx(gfx)->zoom_transpen(bitmap,cliprect,
- code++,
- color,
- flipx, flipy,
- currx, curry,
- scalex << 12, scaley << 12,0);
}
}
}
@@ -465,46 +378,46 @@ WRITE16_MEMBER(realbrk_state::vregs_w)
uint32_t realbrk_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- int layers_ctrl = -1;
-
m_tilemap[0]->set_scrolly(0, m_vregs[0x0/2]);
m_tilemap[0]->set_scrollx(0, m_vregs[0x2/2]);
m_tilemap[1]->set_scrolly(0, m_vregs[0x4/2]);
m_tilemap[1]->set_scrollx(0, m_vregs[0x6/2]);
-#ifdef MAME_DEBUG
-if ( machine().input().code_pressed(KEYCODE_Z) )
-{
- int msk = 0;
- if (machine().input().code_pressed(KEYCODE_Q)) msk |= 1;
- if (machine().input().code_pressed(KEYCODE_W)) msk |= 2;
- if (machine().input().code_pressed(KEYCODE_E)) msk |= 4;
- if (machine().input().code_pressed(KEYCODE_A)) msk |= 8;
- if (msk != 0) layers_ctrl &= msk;
-}
-#endif
-
if (m_disable_video)
{
bitmap.fill(m_palette->black_pen(), cliprect);
return 0;
}
- else
- bitmap.fill(m_vregs[0xc/2] & 0x7fff, cliprect);
- if (layers_ctrl & 8) draw_sprites(bitmap,cliprect,3); // Unknown
- if (layers_ctrl & 8) draw_sprites(bitmap,cliprect,2); // Under m_tilemap[1], Under m_tilemap[0]
+ bitmap.fill(m_vregs[0xc / 2] & 0x7fff, cliprect);
+ screen.priority().fill(0, cliprect);
+
+ int layers_ctrl(-1);
+#ifdef MAME_DEBUG
+ if (machine().input().code_pressed(KEYCODE_Z))
+ {
+ int msk(0);
+ if (machine().input().code_pressed(KEYCODE_Q)) msk |= 1;
+ if (machine().input().code_pressed(KEYCODE_W)) msk |= 2;
+ if (machine().input().code_pressed(KEYCODE_E)) msk |= 4;
+ if (machine().input().code_pressed(KEYCODE_A)) msk |= 8;
+ if (msk) layers_ctrl &= msk;
+ }
+#endif
+
+ if (layers_ctrl & 8) draw_sprites<true>(bitmap, cliprect, 3); // Unknown
+ if (layers_ctrl & 8) draw_sprites<true>(bitmap, cliprect, 2); // Under m_tilemap[1], Under m_tilemap[0]
- if (layers_ctrl & 2) m_tilemap[1]->draw(screen, bitmap, cliprect, 0,0);
+ if (layers_ctrl & 2) m_tilemap[1]->draw(screen, bitmap, cliprect, 0, 1);
- if (layers_ctrl & 8) draw_sprites(bitmap,cliprect,1); // Over m_tilemap[1], Under m_tilemap[0]
+ if (layers_ctrl & 8) draw_sprites<true>(bitmap,cliprect, 1); // Over m_tilemap[1], Under m_tilemap[0]
- if (layers_ctrl & 1) m_tilemap[0]->draw(screen, bitmap, cliprect, 0,0);
+ if (layers_ctrl & 1) m_tilemap[0]->draw(screen, bitmap, cliprect, 0, 2);
- if (layers_ctrl & 8) draw_sprites(bitmap,cliprect,0); // Over m_tilemap[1], Over m_tilemap[0]
+ if (layers_ctrl & 8) draw_sprites<true>(bitmap,cliprect, 0); // Over m_tilemap[1], Over m_tilemap[0]
- if (layers_ctrl & 4) m_tilemap[2]->draw(screen, bitmap, cliprect, 0,0);
+ if (layers_ctrl & 4) m_tilemap[2]->draw(screen, bitmap, cliprect, 0, 4);
// popmessage("%04x",m_vregs[0x8/2]);
return 0;
@@ -513,85 +426,79 @@ if ( machine().input().code_pressed(KEYCODE_Z) )
/* DaiDaiKakumei */
uint32_t realbrk_state::screen_update_dai2kaku(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- int layers_ctrl = -1;
- int offs;
-
- int const bgy0 = m_vregs[0x0/2];
- int const bgx0 = m_vregs[0x2/2];
- int const bgy1 = m_vregs[0x4/2];
- int const bgx1 = m_vregs[0x6/2];
-
// bg0
- if( m_vregs[8/2] & (0x0100)){
+ int const bgy0(m_vregs[0x0 / 2]);
+ int const bgx0(m_vregs[0x2 / 2]);
+ if (BIT(m_vregs[8 / 2], 8))
+ {
m_tilemap[0]->set_scroll_rows(512);
- for(offs=0; offs<(512); offs++) {
- m_tilemap[0]->set_scrollx(offs, bgx0 - (m_vram_ras[1][offs]&0x3ff) );
- }
- } else {
+ for (int offs = 0; offs < 512; offs++)
+ m_tilemap[0]->set_scrollx(offs, bgx0 - (m_vram_ras[1][offs] & 0x3ff));
+ }
+ else
+ {
m_tilemap[0]->set_scroll_rows(1);
- m_tilemap[0]->set_scrollx(0, bgx0 );
+ m_tilemap[0]->set_scrollx(0, bgx0);
}
- m_tilemap[0]->set_scrolly(0, bgy0 );
+ m_tilemap[0]->set_scrolly(0, bgy0);
// bg1
- if( m_vregs[8/2] & (0x0001)){
+ int const bgy1(m_vregs[0x4 / 2]);
+ int const bgx1(m_vregs[0x6 / 2]);
+ if (BIT(m_vregs[8 / 2], 0))
+ {
m_tilemap[1]->set_scroll_rows(512);
- for(offs=0; offs<(512); offs++) {
- m_tilemap[1]->set_scrollx(offs, bgx1 - (m_vram_ras[1][offs]&0x3ff) );
- }
- } else {
+ for (int offs = 0; offs < 512; offs++)
+ m_tilemap[1]->set_scrollx(offs, bgx1 - (m_vram_ras[1][offs] & 0x3ff));
+ }
+ else
+ {
m_tilemap[1]->set_scroll_rows(1);
- m_tilemap[1]->set_scrollx(0, bgx1 );
+ m_tilemap[1]->set_scrollx(0, bgx1);
}
- m_tilemap[1]->set_scrolly(0, bgy1 );
-
-#ifdef MAME_DEBUG
-if ( machine().input().code_pressed(KEYCODE_Z) )
-{
- int msk = 0;
- if (machine().input().code_pressed(KEYCODE_Q)) msk |= 1;
- if (machine().input().code_pressed(KEYCODE_W)) msk |= 2;
- if (machine().input().code_pressed(KEYCODE_E)) msk |= 4;
- if (machine().input().code_pressed(KEYCODE_A)) msk |= 8;
- if (msk != 0) layers_ctrl &= msk;
-}
-#endif
+ m_tilemap[1]->set_scrolly(0, bgy1);
if (m_disable_video)
{
bitmap.fill(m_palette->black_pen(), cliprect);
return 0;
}
- else
- bitmap.fill(m_vregs[0xc/2] & 0x7fff, cliprect);
+ bitmap.fill(m_vregs[0xc/2] & 0x7fff, cliprect);
+ screen.priority().fill(0, cliprect);
+
+ int layers_ctrl(-1);
+#ifdef MAME_DEBUG
+ if (machine().input().code_pressed(KEYCODE_Z))
+ {
+ int msk(0);
+ if (machine().input().code_pressed(KEYCODE_Q)) msk |= 1;
+ if (machine().input().code_pressed(KEYCODE_W)) msk |= 2;
+ if (machine().input().code_pressed(KEYCODE_E)) msk |= 4;
+ if (machine().input().code_pressed(KEYCODE_A)) msk |= 8;
+ if (msk) layers_ctrl &= msk;
+ }
+#endif
+ bool const bgpri(BIT(m_vregs[8 / 2], 15));
// spr 0
- if (layers_ctrl & 8) dai2kaku_draw_sprites(bitmap,cliprect,2);
+ if (layers_ctrl & 8) draw_sprites<false>(bitmap, cliprect, 2);
// bglow
- if( m_vregs[8/2] & (0x8000)){
- if (layers_ctrl & 1) m_tilemap[0]->draw(screen, bitmap, cliprect, 0,0);
- } else {
- if (layers_ctrl & 2) m_tilemap[1]->draw(screen, bitmap, cliprect, 0,0);
- }
+ if (layers_ctrl & (bgpri ? 1 : 2)) m_tilemap[bgpri ? 0 : 1]->draw(screen, bitmap, cliprect, 0, 1);
// spr 1
- if (layers_ctrl & 8) dai2kaku_draw_sprites(bitmap,cliprect,1);
+ if (layers_ctrl & 8) draw_sprites<false>(bitmap, cliprect, 1);
// bghigh
- if( m_vregs[8/2] & (0x8000)){
- if (layers_ctrl & 2) m_tilemap[1]->draw(screen, bitmap, cliprect, 0,0);
- } else {
- if (layers_ctrl & 1) m_tilemap[0]->draw(screen, bitmap, cliprect, 0,0);
- }
+ if (layers_ctrl & (bgpri ? 2 : 1)) m_tilemap[bgpri ? 1 : 0]->draw(screen, bitmap, cliprect, 0, 2);
// spr 2
- if (layers_ctrl & 8) dai2kaku_draw_sprites(bitmap,cliprect,0);
+ if (layers_ctrl & 8) draw_sprites<false>(bitmap, cliprect, 0);
// fix
- if (layers_ctrl & 4) m_tilemap[2]->draw(screen, bitmap, cliprect, 0,0);
+ if (layers_ctrl & 4) m_tilemap[2]->draw(screen, bitmap, cliprect, 0, 4);
// usrintf_showmessage("%04x",m_vregs[0x8/2]);
return 0;
diff --git a/src/mame/video/relief.cpp b/src/mame/video/relief.cpp
index e5d64c94d22..26b344682ef 100644
--- a/src/mame/video/relief.cpp
+++ b/src/mame/video/relief.cpp
@@ -107,12 +107,12 @@ uint32_t relief_state::screen_update_relief(screen_device &screen, bitmap_ind16
// draw and merge the MO
bitmap_ind16 &mobitmap = m_vad->mob().bitmap();
for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next())
- for (int y = rect->min_y; y <= rect->max_y; y++)
+ for (int y = rect->top(); y <= rect->bottom(); y++)
{
uint16_t *mo = &mobitmap.pix16(y);
uint16_t *pf = &bitmap.pix16(y);
uint8_t *pri = &priority_bitmap.pix8(y);
- for (int x = rect->min_x; x <= rect->max_x; x++)
+ for (int x = rect->left(); x <= rect->right(); x++)
if (mo[x] != 0xffff)
{
/* verified from the GALs on the real PCB; equations follow
diff --git a/src/mame/video/rohga.cpp b/src/mame/video/rohga.cpp
index e1e6da0e055..73833d5dc9a 100644
--- a/src/mame/video/rohga.cpp
+++ b/src/mame/video/rohga.cpp
@@ -95,12 +95,12 @@ void rohga_state::mixwizdfirelayer(bitmap_rgb32 &bitmap, const rectangle &clipre
uint32_t* dstline;
- for (y=cliprect.min_y;y<=cliprect.max_y;y++)
+ for (y=cliprect.top();y<=cliprect.bottom();y++)
{
srcline=&sprite_bitmap->pix16(y,0);
dstline=&bitmap.pix32(y,0);
- for (x=cliprect.min_x;x<=cliprect.max_x;x++)
+ for (x=cliprect.left();x<=cliprect.right();x++)
{
uint16_t pix = srcline[x];
@@ -183,7 +183,7 @@ void rohga_state::mixnitroballlayer(screen_device &screen, bitmap_rgb32 &bitmap,
uint16_t *srcline1, *srcline2;
uint8_t *srcpriline;
- for (y=cliprect.min_y;y<=cliprect.max_y;y++)
+ for (y=cliprect.top();y<=cliprect.bottom();y++)
{
srcline1=&sprite_bitmap1->pix16(y,0);
srcline2=&sprite_bitmap2->pix16(y,0);
@@ -191,7 +191,7 @@ void rohga_state::mixnitroballlayer(screen_device &screen, bitmap_rgb32 &bitmap,
dstline=&bitmap.pix32(y,0);
- for (x=cliprect.min_x;x<=cliprect.max_x;x++)
+ for (x=cliprect.left();x<=cliprect.right();x++)
{
uint16_t pix1 = srcline1[x];
uint16_t pix2 = srcline2[x];
diff --git a/src/mame/video/shuuz.cpp b/src/mame/video/shuuz.cpp
index eb0aa7089cf..af83bede0e0 100644
--- a/src/mame/video/shuuz.cpp
+++ b/src/mame/video/shuuz.cpp
@@ -86,11 +86,11 @@ uint32_t shuuz_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap,
// draw and merge the MO
bitmap_ind16 &mobitmap = m_vad->mob().bitmap();
for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next())
- for (int y = rect->min_y; y <= rect->max_y; y++)
+ for (int y = rect->top(); y <= rect->bottom(); y++)
{
uint16_t *mo = &mobitmap.pix16(y);
uint16_t *pf = &bitmap.pix16(y);
- for (int x = rect->min_x; x <= rect->max_x; x++)
+ for (int x = rect->left(); x <= rect->right(); x++)
if (mo[x] != 0xffff)
{
/* verified from the GALs on the real PCB; equations follow
diff --git a/src/mame/video/skullxbo.cpp b/src/mame/video/skullxbo.cpp
index 8ebc443e31a..dd0507fa1a1 100644
--- a/src/mame/video/skullxbo.cpp
+++ b/src/mame/video/skullxbo.cpp
@@ -120,7 +120,7 @@ WRITE16_MEMBER( skullxbo_state::skullxbo_yscroll_w )
m_screen->update_partial(scanline);
/* adjust the effective scroll for the current scanline */
- if (scanline > m_screen->visible_area().max_y)
+ if (scanline > m_screen->visible_area().bottom())
scanline = 0;
effscroll = (newscroll >> 7) - scanline;
@@ -241,11 +241,11 @@ uint32_t skullxbo_state::screen_update_skullxbo(screen_device &screen, bitmap_in
// draw and merge the MO
bitmap_ind16 &mobitmap = m_mob->bitmap();
for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next())
- for (int y = rect->min_y; y <= rect->max_y; y++)
+ for (int y = rect->top(); y <= rect->bottom(); y++)
{
uint16_t *mo = &mobitmap.pix16(y);
uint16_t *pf = &bitmap.pix16(y);
- for (int x = rect->min_x; x <= rect->max_x; x++)
+ for (int x = rect->left(); x <= rect->right(); x++)
if (mo[x] != 0xffff)
{
/* verified from the GALs on the real PCB; equations follow
diff --git a/src/mame/video/sprint2.cpp b/src/mame/video/sprint2.cpp
index 537f8d9dea3..ac826694ae7 100644
--- a/src/mame/video/sprint2.cpp
+++ b/src/mame/video/sprint2.cpp
@@ -83,8 +83,8 @@ uint8_t sprint2_state::collision_check(rectangle& rect)
int x;
int y;
- for (y = rect.min_y; y <= rect.max_y; y++)
- for (x = rect.min_x; x <= rect.max_x; x++)
+ for (y = rect.top(); y <= rect.bottom(); y++)
+ for (x = rect.left(); x <= rect.right(); x++)
{
uint16_t a = m_palette->pen_indirect(m_helper.pix16(y, x));
@@ -155,13 +155,11 @@ WRITE_LINE_MEMBER(sprint2_state::screen_vblank_sprint2)
for (i = 0; i < 2; i++)
{
- rectangle rect;
-
- rect.min_x = get_sprite_x(video_ram, i);
- rect.min_y = get_sprite_y(video_ram, i);
- rect.max_x = get_sprite_x(video_ram, i) + m_gfxdecode->gfx(1)->width() - 1;
- rect.max_y = get_sprite_y(video_ram, i) + m_gfxdecode->gfx(1)->height() - 1;
-
+ rectangle rect(
+ get_sprite_x(video_ram, i),
+ get_sprite_x(video_ram, i) + m_gfxdecode->gfx(1)->width() - 1,
+ get_sprite_y(video_ram, i),
+ get_sprite_y(video_ram, i) + m_gfxdecode->gfx(1)->height() - 1);
rect &= visarea;
/* check for sprite-tilemap collisions */
diff --git a/src/mame/video/sprint4.cpp b/src/mame/video/sprint4.cpp
index 9df60a4710f..0c7429ef3c8 100644
--- a/src/mame/video/sprint4.cpp
+++ b/src/mame/video/sprint4.cpp
@@ -90,19 +90,17 @@ WRITE_LINE_MEMBER(sprint4_state::screen_vblank)
for (int i = 0; i < 4; i++)
{
- rectangle rect;
-
int bank = 0;
uint8_t horz = m_videoram[0x390 + 2 * i + 0];
uint8_t vert = m_videoram[0x398 + 2 * i + 0];
uint8_t code = m_videoram[0x398 + 2 * i + 1];
- rect.min_x = horz - 15;
- rect.min_y = vert - 15;
- rect.max_x = horz - 15 + m_gfxdecode->gfx(1)->width() - 1;
- rect.max_y = vert - 15 + m_gfxdecode->gfx(1)->height() - 1;
-
+ rectangle rect(
+ horz - 15,
+ horz - 15 + m_gfxdecode->gfx(1)->width() - 1,
+ vert - 15,
+ vert - 15 + m_gfxdecode->gfx(1)->height() - 1);
rect &= m_screen->visible_area();
m_playfield->draw(*m_screen, m_helper, rect, 0, 0);
@@ -117,8 +115,8 @@ WRITE_LINE_MEMBER(sprint4_state::screen_vblank)
horz - 15,
vert - 15, 1);
- for (int y = rect.min_y; y <= rect.max_y; y++)
- for (int x = rect.min_x; x <= rect.max_x; x++)
+ for (int y = rect.top(); y <= rect.bottom(); y++)
+ for (int x = rect.left(); x <= rect.right(); x++)
if (m_palette->pen_indirect(m_helper.pix16(y, x)) != 0)
m_collision[i] = 1;
}
diff --git a/src/mame/video/tank8.cpp b/src/mame/video/tank8.cpp
index d38ca8dbbf4..a1c515cfba2 100644
--- a/src/mame/video/tank8.cpp
+++ b/src/mame/video/tank8.cpp
@@ -210,7 +210,7 @@ WRITE_LINE_MEMBER(tank8_state::screen_vblank)
draw_sprites(m_helper2, visarea);
draw_bullets(m_helper3, visarea);
- for (y = visarea.min_y; y <= visarea.max_y; y++)
+ for (y = visarea.top(); y <= visarea.bottom(); y++)
{
int _state = 0;
@@ -221,7 +221,7 @@ WRITE_LINE_MEMBER(tank8_state::screen_vblank)
if ((m_screen->frame_number() ^ y) & 1)
continue; /* video display is interlaced */
- for (x = visarea.min_x; x <= visarea.max_x; x++)
+ for (x = visarea.left(); x <= visarea.right(); x++)
{
uint8_t index;
diff --git a/src/mame/video/thunderj.cpp b/src/mame/video/thunderj.cpp
index b2a5e3506fc..e51c58d899f 100644
--- a/src/mame/video/thunderj.cpp
+++ b/src/mame/video/thunderj.cpp
@@ -119,12 +119,12 @@ uint32_t thunderj_state::screen_update_thunderj(screen_device &screen, bitmap_in
// draw and merge the MO
bitmap_ind16 &mobitmap = m_vad->mob().bitmap();
for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next())
- for (int y = rect->min_y; y <= rect->max_y; y++)
+ for (int y = rect->top(); y <= rect->bottom(); y++)
{
uint16_t *mo = &mobitmap.pix16(y);
uint16_t *pf = &bitmap.pix16(y);
uint8_t *pri = &priority_bitmap.pix8(y);
- for (int x = rect->min_x; x <= rect->max_x; x++)
+ for (int x = rect->left(); x <= rect->right(); x++)
if (mo[x] != 0xffff)
{
/* verified from the GALs on the real PCB; equations follow
@@ -217,11 +217,11 @@ uint32_t thunderj_state::screen_update_thunderj(screen_device &screen, bitmap_in
/* now go back and process the upper bit of MO priority */
for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next())
- for (int y = rect->min_y; y <= rect->max_y; y++)
+ for (int y = rect->top(); y <= rect->bottom(); y++)
{
uint16_t *mo = &mobitmap.pix16(y);
uint16_t *pf = &bitmap.pix16(y);
- for (int x = rect->min_x; x <= rect->max_x; x++)
+ for (int x = rect->left(); x <= rect->right(); x++)
if (mo[x] != 0xffff)
{
int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT;