summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/emu/cpu/tms34010/tms34010.c4
-rw-r--r--src/emu/debugint/debugint.c11
-rw-r--r--src/emu/drawgfxm.h30
-rw-r--r--src/emu/info.c4
-rw-r--r--src/emu/machine/s3c24xx.c5
-rw-r--r--src/emu/render.c15
-rw-r--r--src/emu/render.h3
-rw-r--r--src/emu/rendfont.c22
-rw-r--r--src/emu/rendlay.c40
-rw-r--r--src/emu/screen.c14
-rw-r--r--src/emu/screen.h1
-rw-r--r--src/emu/sound/cdp1869.c2
-rw-r--r--src/emu/ui.c3
-rw-r--r--src/emu/uigfx.c5
-rw-r--r--src/emu/video/crt9007.c6
-rw-r--r--src/emu/video/hd44102.c2
-rw-r--r--src/emu/video/i8275.c5
-rw-r--r--src/emu/video/mc6845.c5
-rw-r--r--src/emu/video/psx.c4
-rw-r--r--src/emu/video/s2636.c11
-rw-r--r--src/emu/video/tms9927.c5
-rw-r--r--src/emu/video/upd3301.c5
-rw-r--r--src/emu/video/vector.c4
-rw-r--r--src/emu/video/voodoo.c7
-rw-r--r--src/lib/util/bitmap.c14
-rw-r--r--src/lib/util/bitmap.h27
-rw-r--r--src/mame/drivers/alg.c4
-rw-r--r--src/mame/drivers/aristmk6.c4
-rw-r--r--src/mame/drivers/atarisy4.c5
-rw-r--r--src/mame/drivers/bingor.c8
-rw-r--r--src/mame/drivers/ccastles.c5
-rw-r--r--src/mame/drivers/cloud9.c5
-rw-r--r--src/mame/drivers/cps3.c16
-rw-r--r--src/mame/drivers/cybertnk.c8
-rw-r--r--src/mame/drivers/flyball.c5
-rw-r--r--src/mame/drivers/gpworld.c9
-rw-r--r--src/mame/drivers/gunpey.c2
-rw-r--r--src/mame/drivers/highvdeo.c6
-rw-r--r--src/mame/drivers/hng64.c5
-rw-r--r--src/mame/drivers/igs009.c5
-rw-r--r--src/mame/drivers/igs011.c2
-rw-r--r--src/mame/drivers/itgambl2.c2
-rw-r--r--src/mame/drivers/itgambl3.c2
-rw-r--r--src/mame/drivers/jackie.c5
-rw-r--r--src/mame/drivers/jantotsu.c2
-rw-r--r--src/mame/drivers/kingdrby.c5
-rw-r--r--src/mame/drivers/limenko.c6
-rw-r--r--src/mame/drivers/luckgrln.c7
-rw-r--r--src/mame/drivers/magicard.c12
-rw-r--r--src/mame/drivers/majorpkr.c6
-rw-r--r--src/mame/drivers/marinedt.c2
-rw-r--r--src/mame/drivers/mediagx.c4
-rw-r--r--src/mame/drivers/midzeus.c4
-rw-r--r--src/mame/drivers/mogura.c7
-rw-r--r--src/mame/drivers/namcoic.c36
-rw-r--r--src/mame/drivers/pcxt.c2
-rw-r--r--src/mame/drivers/peplus.c4
-rw-r--r--src/mame/drivers/progolf.c2
-rw-r--r--src/mame/drivers/rabbit.c5
-rw-r--r--src/mame/drivers/sfbonus.c5
-rw-r--r--src/mame/drivers/srmp5.c3
-rw-r--r--src/mame/drivers/taitowlf.c2
-rw-r--r--src/mame/drivers/tickee.c4
-rw-r--r--src/mame/drivers/tmmjprd.c6
-rw-r--r--src/mame/machine/megadriv.c5
-rw-r--r--src/mame/machine/segamsys.c13
-rw-r--r--src/mame/video/angelkds.c10
-rw-r--r--src/mame/video/archimds.c24
-rw-r--r--src/mame/video/beathead.c2
-rw-r--r--src/mame/video/blockout.c2
-rw-r--r--src/mame/video/bosco.c2
-rw-r--r--src/mame/video/canyon.c13
-rw-r--r--src/mame/video/cchasm.c4
-rw-r--r--src/mame/video/cps1.c6
-rw-r--r--src/mame/video/dc.c7
-rw-r--r--src/mame/video/deco32.c6
-rw-r--r--src/mame/video/deniam.c12
-rw-r--r--src/mame/video/exerion.c2
-rw-r--r--src/mame/video/galaga.c2
-rw-r--r--src/mame/video/galastrm.c6
-rw-r--r--src/mame/video/galaxold.c23
-rw-r--r--src/mame/video/gp9001.c2
-rw-r--r--src/mame/video/grchamp.c3
-rw-r--r--src/mame/video/groundfx.c5
-rw-r--r--src/mame/video/hng64.c11
-rw-r--r--src/mame/video/itech32.c24
-rw-r--r--src/mame/video/jaguar.c10
-rw-r--r--src/mame/video/konamigx.c25
-rw-r--r--src/mame/video/lethalj.c4
-rw-r--r--src/mame/video/lordgun.c5
-rw-r--r--src/mame/video/m107.c5
-rw-r--r--src/mame/video/mermaid.c29
-rw-r--r--src/mame/video/midzeus.c14
-rw-r--r--src/mame/video/midzeus2.c14
-rw-r--r--src/mame/video/model2.c16
-rw-r--r--src/mame/video/model3.c5
-rw-r--r--src/mame/video/namconb1.c10
-rw-r--r--src/mame/video/namcos1.c2
-rw-r--r--src/mame/video/namcos22.c15
-rw-r--r--src/mame/video/pitnrun.c13
-rw-r--r--src/mame/video/pk8000.c5
-rw-r--r--src/mame/video/policetr.c2
-rw-r--r--src/mame/video/psikyosh.c9
-rw-r--r--src/mame/video/psychic5.c14
-rw-r--r--src/mame/video/rallyx.c3
-rw-r--r--src/mame/video/realbrk.c6
-rw-r--r--src/mame/video/redclash.c5
-rw-r--r--src/mame/video/sega16sp.c2
-rw-r--r--src/mame/video/segaybd.c3
-rw-r--r--src/mame/video/senjyo.c3
-rw-r--r--src/mame/video/shangha3.c5
-rw-r--r--src/mame/video/skyraid.c7
-rw-r--r--src/mame/video/sprint2.c9
-rw-r--r--src/mame/video/ssv.c5
-rw-r--r--src/mame/video/st0016.c4
-rw-r--r--src/mame/video/starcrus.c28
-rw-r--r--src/mame/video/stvvdp1.c18
-rw-r--r--src/mame/video/stvvdp2.c22
-rw-r--r--src/mame/video/suprloco.c9
-rw-r--r--src/mame/video/taitoic.c8
-rw-r--r--src/mame/video/tank8.c17
-rw-r--r--src/mame/video/taotaido.c5
-rw-r--r--src/mame/video/toaplan1.c6
-rw-r--r--src/mame/video/toaplan2.c5
-rw-r--r--src/mame/video/triplhnt.c19
-rw-r--r--src/mame/video/vectrex.c8
-rw-r--r--src/mame/video/videopin.c17
-rw-r--r--src/mame/video/warpwarp.c2
-rw-r--r--src/mame/video/wgp.c2
-rw-r--r--src/mame/video/xmen.c12
-rw-r--r--src/mame/video/ygv608.c4
-rw-r--r--src/mame/video/zac2650.c41
132 files changed, 335 insertions, 797 deletions
diff --git a/src/emu/cpu/tms34010/tms34010.c b/src/emu/cpu/tms34010/tms34010.c
index 117b83c8b08..36252211cb4 100644
--- a/src/emu/cpu/tms34010/tms34010.c
+++ b/src/emu/cpu/tms34010/tms34010.c
@@ -1120,7 +1120,7 @@ SCREEN_UPDATE_IND16( tms340x0_ind16 )
UINT16 *dest = &bitmap.pix16(cliprect.min_y);
for (x = cliprect.min_x; x < params.heblnk; x++)
dest[x] = blackpen;
- for (x = params.hsblnk; x <= cliprect.max_y; x++)
+ for (x = params.hsblnk; x <= cliprect.max_x; x++)
dest[x] = blackpen;
return 0;
@@ -1168,7 +1168,7 @@ SCREEN_UPDATE_RGB32( tms340x0_rgb32 )
UINT32 *dest = &bitmap.pix32(cliprect.min_y);
for (x = cliprect.min_x; x < params.heblnk; x++)
dest[x] = blackpen;
- for (x = params.hsblnk; x <= cliprect.max_y; x++)
+ for (x = params.hsblnk; x <= cliprect.max_x; x++)
dest[x] = blackpen;
return 0;
}
diff --git a/src/emu/debugint/debugint.c b/src/emu/debugint/debugint.c
index 19a66cfe708..2b079e3af73 100644
--- a/src/emu/debugint/debugint.c
+++ b/src/emu/debugint/debugint.c
@@ -166,10 +166,7 @@ public:
this->state = flags | VIEW_STATE_NEEDS_UPDATE;
// initial size
- this->bounds.min_x = 0;
- this->bounds.min_y = 0;
- this->bounds.max_x = 300;
- this->bounds.max_y = 300;
+ this->bounds.set(0, 300, 0, 300);
/* specials */
switch (type)
@@ -377,7 +374,7 @@ static int dview_xy_in_rect(DView *dv, int type, int x, int y)
rectangle r;
dview_get_rect(dv, type, r);
- if (x >= r.min_x && x <= r.max_x && y >= r.min_y && y <= r.max_y)
+ if (r.contains(x, y))
return TRUE;
return FALSE;
}
@@ -396,7 +393,7 @@ static void dview_draw_hsb(DView *dv)
dview_draw_outlined_box(dv, RECT_DVIEW_HSB, 0, 0, VSB_WIDTH,HSB_HEIGHT, MAKE_ARGB(0xff, 0xff, 0x00, 0x00));
dview_draw_outlined_box(dv, RECT_DVIEW_HSB, r.width() - VSB_WIDTH, 0, VSB_WIDTH, HSB_HEIGHT, MAKE_ARGB(0xff, 0xff, 0x00, 0x00));
- ts = (r.max_x - r.min_x + 1) - 2 * VSB_WIDTH;
+ ts = (r.width()) - 2 * VSB_WIDTH;
sz = (ts * (sb->page_size)) / (sb->upper - sb->lower);
ts = ts - sz;
@@ -420,7 +417,7 @@ static void dview_draw_vsb(DView *dv)
dview_draw_outlined_box(dv, RECT_DVIEW_VSB, 0, r.height() - HSB_HEIGHT, VSB_WIDTH, HSB_HEIGHT, MAKE_ARGB(0xff, 0xff, 0x00, 0x00));
dview_draw_outlined_box(dv, RECT_DVIEW_VSB, 0, 0, VSB_WIDTH, HSB_HEIGHT, MAKE_ARGB(0xff, 0xff, 0x00, 0x00));
- ts = (r.max_y - r.min_y + 1) - 2 * HSB_HEIGHT;
+ ts = r.height() - 2 * HSB_HEIGHT;
sz = (ts * (sb->page_size)) / (sb->upper - sb->lower);
ts = ts - sz;
diff --git a/src/emu/drawgfxm.h b/src/emu/drawgfxm.h
index 43149bbc490..74b96e7bc03 100644
--- a/src/emu/drawgfxm.h
+++ b/src/emu/drawgfxm.h
@@ -362,10 +362,7 @@ do { \
assert(dest.valid()); \
assert(gfx != NULL); \
assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \
- assert(cliprect.min_x >= 0); \
- assert(cliprect.max_x < dest.width()); \
- assert(cliprect.min_y >= 0); \
- assert(cliprect.max_y < dest.height()); \
+ assert(dest.cliprect().contains(cliprect)); \
assert(code < gfx->total_elements); \
\
/* ignore empty/invalid cliprects */ \
@@ -632,10 +629,7 @@ do { \
assert(dest.valid()); \
assert(gfx != NULL); \
assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \
- assert(cliprect.min_x >= 0); \
- assert(cliprect.max_x < dest.width()); \
- assert(cliprect.min_y >= 0); \
- assert(cliprect.max_y < dest.height()); \
+ assert(dest.cliprect().contains(cliprect)); \
\
/* ignore empty/invalid cliprects */ \
if (cliprect.empty()) \
@@ -807,10 +801,7 @@ do { \
assert(dest.valid()); \
assert(src.valid()); \
assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \
- assert(cliprect.min_x >= 0); \
- assert(cliprect.max_x < dest.width()); \
- assert(cliprect.min_y >= 0); \
- assert(cliprect.max_y < dest.height()); \
+ assert(dest.cliprect().contains(cliprect)); \
\
/* ignore empty/invalid cliprects */ \
if (cliprect.empty()) \
@@ -981,11 +972,8 @@ do { \
assert(dest.valid()); \
assert(dest.valid()); \
assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \
- assert(cliprect.min_x >= 0); \
- assert(cliprect.max_x < dest.width()); \
- assert(cliprect.min_y >= 0); \
- assert(cliprect.max_y < dest.height()); \
- assert(!wraparound || (src.width() & (src.width() - 1)) == 0); \
+ assert(dest.cliprect().contains(cliprect)); \
+ assert(!wraparound || (src.width() & (src.width() - 1)) == 0); \
assert(!wraparound || (src.height() & (src.height() - 1)) == 0); \
\
/* ignore empty/invalid cliprects */ \
@@ -997,12 +985,12 @@ 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.min_x * incxx + cliprect.min_y * incyx; \
+ starty += cliprect.min_x * incxy + cliprect.min_y * incyy; \
\
/* compute how many blocks of 4 pixels we have */ \
- numblocks = (cliprect.max_x + 1 - cliprect.min_x) / 4; \
- leftovers = (cliprect.max_x + 1 - cliprect.min_x) - 4 * numblocks; \
+ numblocks = cliprect.width() / 4; \
+ leftovers = cliprect.width() - 4 * numblocks; \
\
/* if incxy and incyx are 0, then we aren't rotating, just zooming */ \
if (incxy == 0 && incyx == 0) \
diff --git a/src/emu/info.c b/src/emu/info.c
index ccbf32947e0..e9f15949c33 100644
--- a/src/emu/info.c
+++ b/src/emu/info.c
@@ -681,8 +681,8 @@ void info_xml_creator::output_display()
if (device->screen_type() != SCREEN_TYPE_VECTOR)
{
const rectangle &visarea = device->visible_area();
- fprintf(m_output, " width=\"%d\"", visarea.max_x - visarea.min_x + 1);
- fprintf(m_output, " height=\"%d\"", visarea.max_y - visarea.min_y + 1);
+ fprintf(m_output, " width=\"%d\"", visarea.width());
+ fprintf(m_output, " height=\"%d\"", visarea.height());
}
// output refresh rate
diff --git a/src/emu/machine/s3c24xx.c b/src/emu/machine/s3c24xx.c
index 5e1911a8630..7c7e2dc7b12 100644
--- a/src/emu/machine/s3c24xx.c
+++ b/src/emu/machine/s3c24xx.c
@@ -937,10 +937,7 @@ static int s3c24xx_lcd_configure_stn( device_t *device)
}
height = lineval + 1;
s3c24xx->lcd.framerate = framerate;
- visarea.min_x = 0;
- visarea.min_y = 0;
- visarea.max_x = width - 1;
- visarea.max_y = height - 1;
+ visarea.set(0, width - 1, 0, height - 1);
verboselog( device->machine(), 3, "LCD - visarea min_x %d min_y %d max_x %d max_y %d\n", visarea.min_x, visarea.min_y, visarea.max_x, visarea.max_y);
verboselog( device->machine(), 3, "video_screen_configure %d %d %f\n", width, height, s3c24xx->lcd.framerate);
s3c24xx->lcd.hpos_min = 0;
diff --git a/src/emu/render.c b/src/emu/render.c
index ba4b78f08ac..0975c03f036 100644
--- a/src/emu/render.c
+++ b/src/emu/render.c
@@ -366,7 +366,7 @@ render_texture::render_texture()
m_param(NULL),
m_curseq(0)
{
- m_sbounds.min_x = m_sbounds.min_y = m_sbounds.max_x = m_sbounds.max_y = 0;
+ m_sbounds.set(0, -1, 0, -1);
memset(m_scaled, 0, sizeof(m_scaled));
}
@@ -416,7 +416,7 @@ void render_texture::release()
// invalidate references to the original bitmap as well
m_manager->invalidate_all(m_bitmap);
m_bitmap = NULL;
- m_sbounds.min_x = m_sbounds.min_y = m_sbounds.max_x = m_sbounds.max_y = 0;
+ m_sbounds.set(0, -1, 0, -1);
m_format = TEXFORMAT_ARGB32;
m_curseq = 0;
@@ -505,7 +505,8 @@ bool render_texture::get_scaled(UINT32 dwidth, UINT32 dheight, render_texinfo &t
}
// make sure we can recover the original argb32 bitmap
- bitmap_argb32 &srcbitmap = downcast<bitmap_argb32 &>(*m_bitmap);
+ bitmap_argb32 dummy;
+ bitmap_argb32 &srcbitmap = (m_bitmap != NULL) ? downcast<bitmap_argb32 &>(*m_bitmap) : dummy;
// is it a size we already have?
scaled_texture *scaled = NULL;
@@ -1285,13 +1286,13 @@ void render_target::compute_minimum_size(INT32 &minwidth, INT32 &minheight)
float xscale, yscale;
if (!(orientation_add(m_orientation, screen->container().orientation()) & ORIENTATION_SWAP_XY))
{
- xscale = (float)(visarea.max_x + 1 - visarea.min_x) / (bounds.x1 - bounds.x0);
- yscale = (float)(visarea.max_y + 1 - visarea.min_y) / (bounds.y1 - bounds.y0);
+ xscale = float(visarea.width()) / bounds.width();
+ yscale = float(visarea.height()) / bounds.height();
}
else
{
- xscale = (float)(visarea.max_y + 1 - visarea.min_y) / (bounds.x1 - bounds.x0);
- yscale = (float)(visarea.max_x + 1 - visarea.min_x) / (bounds.y1 - bounds.y0);
+ xscale = float(visarea.height()) / bounds.width();
+ yscale = float(visarea.width()) / bounds.height();
}
// pick the greater
diff --git a/src/emu/render.h b/src/emu/render.h
index 060c60643c7..d5444b57b2c 100644
--- a/src/emu/render.h
+++ b/src/emu/render.h
@@ -190,6 +190,9 @@ struct render_bounds
float y0; // topmost Y coordinate
float x1; // rightmost X coordinate
float y1; // bottommost Y coordinate
+
+ float width() const { return x1 - x0; }
+ float height() const { return y1 - y0; }
};
diff --git a/src/emu/rendfont.c b/src/emu/rendfont.c
index ed600823ce1..aa6c4f07937 100644
--- a/src/emu/rendfont.c
+++ b/src/emu/rendfont.c
@@ -290,11 +290,11 @@ render_texture *render_font::get_char_texture_and_bounds(float height, float asp
// on entry, assume x0,y0 are the top,left coordinate of the cell and add
// the character bounding box to that position
float scale = m_scale * height;
- bounds.x0 += (float)gl.xoffs * scale * aspect;
+ bounds.x0 += float(gl.xoffs) * scale * aspect;
// compute x1,y1 from there based on the bitmap size
- bounds.x1 = bounds.x0 + (float)gl.bmwidth * scale * aspect;
- bounds.y1 = bounds.y0 + (float)m_height * scale;
+ bounds.x1 = bounds.x0 + float(gl.bmwidth) * scale * aspect;
+ bounds.y1 = bounds.y0 + float(m_height) * scale;
// return the texture
return gl.texture;
@@ -313,15 +313,15 @@ void render_font::get_scaled_bitmap_and_bounds(bitmap_argb32 &dest, float height
// on entry, assume x0,y0 are the top,left coordinate of the cell and add
// the character bounding box to that position
float scale = m_scale * height;
- bounds.min_x = (float)gl.xoffs * scale * aspect;
+ bounds.min_x = float(gl.xoffs) * scale * aspect;
bounds.min_y = 0;
// compute x1,y1 from there based on the bitmap size
- bounds.max_x = bounds.min_x + (float)gl.bmwidth * scale * aspect;
- bounds.max_y = bounds.min_y + (float)m_height * scale;
+ bounds.set_width(float(gl.bmwidth) * scale * aspect);
+ bounds.set_height(float(m_height) * scale);
// if the bitmap isn't big enough, bail
- if (dest.width() < bounds.max_x - bounds.min_x || dest.height() < bounds.max_y - bounds.min_y)
+ if (dest.width() < bounds.width() || dest.height() < bounds.height())
return;
// if no texture, fill the target
@@ -332,7 +332,7 @@ void render_font::get_scaled_bitmap_and_bounds(bitmap_argb32 &dest, float height
}
// scale the font
- bitmap_argb32 tempbitmap(dest, bounds);
+ bitmap_argb32 tempbitmap(&dest.pix(0), bounds.width(), bounds.height(), dest.rowpixels());
render_texture::hq_scale(tempbitmap, gl.bitmap, gl.bitmap.cliprect(), NULL);
}
@@ -344,7 +344,7 @@ void render_font::get_scaled_bitmap_and_bounds(bitmap_argb32 &dest, float height
float render_font::char_width(float height, float aspect, unicode_char ch)
{
- return (float)get_char(ch).width * m_scale * height * aspect;
+ return float(get_char(ch).width) * m_scale * height * aspect;
}
@@ -361,7 +361,7 @@ float render_font::string_width(float height, float aspect, const char *string)
totwidth += get_char(*ptr).width;
// scale the final result based on height
- return (float)totwidth * m_scale * height * aspect;
+ return float(totwidth) * m_scale * height * aspect;
}
@@ -388,7 +388,7 @@ float render_font::utf8string_width(float height, float aspect, const char *utf8
}
// scale the final result based on height
- return (float)totwidth * m_scale * height * aspect;
+ return float(totwidth) * m_scale * height * aspect;
}
diff --git a/src/emu/rendlay.c b/src/emu/rendlay.c
index 41c63a33515..7cb02521cc1 100644
--- a/src/emu/rendlay.c
+++ b/src/emu/rendlay.c
@@ -211,8 +211,8 @@ static int get_variable_value(running_machine &machine, const char *string, char
sprintf(temp, "~scr%dnativexaspect~", scrnum);
if (!strncmp(string, temp, strlen(temp)))
{
- int num = device->visible_area().max_x + 1 - device->visible_area().min_x;
- int den = device->visible_area().max_y + 1 - device->visible_area().min_y;
+ int num = device->visible_area().width();
+ int den = device->visible_area().height();
reduce_fraction(num, den);
*outputptr += sprintf(*outputptr, "%d", num);
return strlen(temp);
@@ -222,8 +222,8 @@ static int get_variable_value(running_machine &machine, const char *string, char
sprintf(temp, "~scr%dnativeyaspect~", scrnum);
if (!strncmp(string, temp, strlen(temp)))
{
- int num = device->visible_area().max_x + 1 - device->visible_area().min_x;
- int den = device->visible_area().max_y + 1 - device->visible_area().min_y;
+ int num = device->visible_area().width();
+ int den = device->visible_area().height();
reduce_fraction(num, den);
*outputptr += sprintf(*outputptr, "%d", den);
return strlen(temp);
@@ -233,7 +233,7 @@ static int get_variable_value(running_machine &machine, const char *string, char
sprintf(temp, "~scr%dwidth~", scrnum);
if (!strncmp(string, temp, strlen(temp)))
{
- *outputptr += sprintf(*outputptr, "%d", device->visible_area().max_x + 1 - device->visible_area().min_x);
+ *outputptr += sprintf(*outputptr, "%d", device->visible_area().width());
return strlen(temp);
}
@@ -241,7 +241,7 @@ static int get_variable_value(running_machine &machine, const char *string, char
sprintf(temp, "~scr%dheight~", scrnum);
if (!strncmp(string, temp, strlen(temp)))
{
- *outputptr += sprintf(*outputptr, "%d", device->visible_area().max_y + 1 - device->visible_area().min_y);
+ *outputptr += sprintf(*outputptr, "%d", device->visible_area().height());
return strlen(temp);
}
}
@@ -749,8 +749,8 @@ void layout_element::component::draw_rect(bitmap_argb32 &dest, const rectangle &
UINT32 inva = (1.0f - m_color.a) * 255.0;
// iterate over X and Y
- for (UINT32 y = bounds.min_y; y < bounds.max_y; y++)
- for (UINT32 x = bounds.min_x; x < bounds.max_x; x++)
+ for (UINT32 y = bounds.min_y; y <= bounds.max_y; y++)
+ for (UINT32 x = bounds.min_x; x <= bounds.max_x; x++)
{
UINT32 finalr = r;
UINT32 finalg = g;
@@ -785,14 +785,14 @@ void layout_element::component::draw_disk(bitmap_argb32 &dest, const rectangle &
UINT32 inva = (1.0f - m_color.a) * 255.0;
// find the center
- float xcenter = (float)(bounds.min_x + bounds.max_x) * 0.5f;
- float ycenter = (float)(bounds.min_y + bounds.max_y) * 0.5f;
- float xradius = (float)(bounds.max_x - bounds.min_x) * 0.5f;
- float yradius = (float)(bounds.max_y - bounds.min_y) * 0.5f;
+ float xcenter = float(bounds.xcenter()) * 0.5f;
+ float ycenter = float(bounds.ycenter()) * 0.5f;
+ float xradius = float(bounds.width()) * 0.5f;
+ float yradius = float(bounds.height()) * 0.5f;
float ooyradius2 = 1.0f / (yradius * yradius);
// iterate over y
- for (UINT32 y = bounds.min_y; y < bounds.max_y; y++)
+ for (UINT32 y = bounds.min_y; y <= bounds.max_y; y++)
{
float ycoord = ycenter - ((float)y + 0.5f);
float xval = xradius * sqrt(1.0f - (ycoord * ycoord) * ooyradius2);
@@ -842,12 +842,12 @@ void layout_element::component::draw_text(running_machine &machine, bitmap_argb3
INT32 width;
while (1)
{
- width = font->string_width(bounds.max_y - bounds.min_y, aspect, m_string);
- if (width < bounds.max_x - bounds.min_x)
+ width = font->string_width(bounds.height(), aspect, m_string);
+ if (width < bounds.width())
break;
aspect *= 0.9f;
}
- INT32 curx = bounds.min_x + (bounds.max_x - bounds.min_x - width) / 2;
+ INT32 curx = bounds.min_x + (bounds.width() - width) / 2;
// allocate a temporary bitmap
bitmap_argb32 tempbitmap(dest.width(), dest.height());
@@ -857,17 +857,17 @@ void layout_element::component::draw_text(running_machine &machine, bitmap_argb3
{
// get the font bitmap
rectangle chbounds;
- font->get_scaled_bitmap_and_bounds(tempbitmap, bounds.max_y - bounds.min_y, aspect, *s, chbounds);
+ font->get_scaled_bitmap_and_bounds(tempbitmap, bounds.height(), aspect, *s, chbounds);
// copy the data into the target
- for (int y = 0; y < chbounds.max_y - chbounds.min_y; y++)
+ for (int y = 0; y < chbounds.height(); y++)
{
int effy = bounds.min_y + y;
if (effy >= bounds.min_y && effy <= bounds.max_y)
{
UINT32 *src = &tempbitmap.pix32(y);
UINT32 *d = &dest.pix32(effy);
- for (int x = 0; x < chbounds.max_x - chbounds.min_x; x++)
+ for (int x = 0; x < chbounds.width(); x++)
{
int effx = curx + x + chbounds.min_x;
if (effx >= bounds.min_x && effx <= bounds.max_x)
@@ -888,7 +888,7 @@ void layout_element::component::draw_text(running_machine &machine, bitmap_argb3
}
// advance in the X direction
- curx += font->char_width(bounds.max_y - bounds.min_y, aspect, *s);
+ curx += font->char_width(bounds.height(), aspect, *s);
}
// free the temporary bitmap and font
diff --git a/src/emu/screen.c b/src/emu/screen.c
index ce2e694e372..4bd2b8ebc39 100644
--- a/src/emu/screen.c
+++ b/src/emu/screen.c
@@ -139,10 +139,7 @@ void screen_device::static_set_raw(device_t &device, UINT32 pixclock, UINT16 hto
screen.m_vblank = screen.m_refresh / vtotal * (vtotal - (vbstart - vbend));
screen.m_width = htotal;
screen.m_height = vtotal;
- screen.m_visarea.min_x = hbend;
- screen.m_visarea.max_x = hbstart - 1;
- screen.m_visarea.min_y = vbend;
- screen.m_visarea.max_y = vbstart - 1;
+ screen.m_visarea.set(hbend, hbstart - 1, vbend, vbstart - 1);
}
@@ -261,10 +258,7 @@ bool screen_device::device_validity_check(emu_options &options, const game_drive
// sanity check display area
if (m_type != SCREEN_TYPE_VECTOR)
{
- if ((m_visarea.max_x < m_visarea.min_x) ||
- (m_visarea.max_y < m_visarea.min_y) ||
- (m_visarea.max_x >= m_width) ||
- (m_visarea.max_y >= m_height))
+ if (m_visarea.empty() || m_visarea.max_x >= m_width || m_visarea.max_y >= m_height)
{
mame_printf_error("%s: %s screen '%s' has an invalid display area\n", driver.source_file, driver.name, tag());
error = true;
@@ -472,7 +466,7 @@ void screen_device::configure(int width, int height, const rectangle &visarea, a
// if there has been no VBLANK time specified in the MACHINE_DRIVER, compute it now
// from the visible area, otherwise just used the supplied value
if (m_vblank == 0 && !m_oldstyle_vblank_supplied)
- m_vblank_period = m_scantime * (height - (visarea.max_y + 1 - visarea.min_y));
+ m_vblank_period = m_scantime * (height - visarea.height());
else
m_vblank_period = m_vblank;
@@ -967,7 +961,7 @@ void screen_device::finalize_burnin()
scaledvis.max_y = m_visarea.max_y * m_burnin.height() / m_height;
// wrap a bitmap around the subregion we care about
- bitmap_argb32 finalmap(scaledvis.max_x + 1 - scaledvis.min_x, scaledvis.max_y + 1 - scaledvis.min_y);
+ bitmap_argb32 finalmap(scaledvis.width(), scaledvis.height());
int srcwidth = m_burnin.width();
int srcheight = m_burnin.height();
int dstwidth = finalmap.width();
diff --git a/src/emu/screen.h b/src/emu/screen.h
index d9bcb38488e..e9f496e11ba 100644
--- a/src/emu/screen.h
+++ b/src/emu/screen.h
@@ -168,6 +168,7 @@ public:
int width() const { return m_width; }
int height() const { return m_height; }
const rectangle &visible_area() const { return m_visarea; }
+ const rectangle &cliprect() const { return m_bitmap[0].cliprect(); }
bool oldstyle_vblank_supplied() const { return m_oldstyle_vblank_supplied; }
attoseconds_t refresh_attoseconds() const { return m_refresh; }
attoseconds_t vblank_attoseconds() const { return m_vblank; }
diff --git a/src/emu/sound/cdp1869.c b/src/emu/sound/cdp1869.c
index 44db966d5ed..3036573e394 100644
--- a/src/emu/sound/cdp1869.c
+++ b/src/emu/sound/cdp1869.c
@@ -953,7 +953,7 @@ UINT32 cdp1869_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap
}
int cols = m_freshorz ? CDP1869_COLUMNS_FULL : CDP1869_COLUMNS_HALF;
- int rows = (screen_rect.max_y - screen_rect.min_y + 1) / height;
+ int rows = screen_rect.height() / height;
UINT16 pmemsize = get_pmemsize(cols, rows);
UINT16 addr = m_hma;
diff --git a/src/emu/ui.c b/src/emu/ui.c
index 59a6158ae39..bdea3a453d2 100644
--- a/src/emu/ui.c
+++ b/src/emu/ui.c
@@ -1110,8 +1110,7 @@ astring &game_info_astring(running_machine &machine, astring &string)
const rectangle &visarea = screen->visible_area();
string.catprintf("%d " UTF8_MULTIPLY " %d (%s) %f" UTF8_NBSP "Hz\n",
- visarea.max_x - visarea.min_x + 1,
- visarea.max_y - visarea.min_y + 1,
+ visarea.width(), visarea.height(),
(machine.system().flags & ORIENTATION_SWAP_XY) ? "V" : "H",
ATTOSECONDS_TO_HZ(screen->frame_period().attoseconds));
}
diff --git a/src/emu/uigfx.c b/src/emu/uigfx.c
index 1717a9d137b..e3d5abe52fb 100644
--- a/src/emu/uigfx.c
+++ b/src/emu/uigfx.c
@@ -717,10 +717,7 @@ static void gfxset_update_bitmap(running_machine &machine, ui_gfx_state *state,
rectangle cellbounds;
/* make a rect that covers this row */
- cellbounds.min_x = 0;
- cellbounds.max_x = state->bitmap->width() - 1;
- cellbounds.min_y = y * cellypix;
- cellbounds.max_y = (y + 1) * cellypix - 1;
+ cellbounds.set(0, state->bitmap->width() - 1, y * cellypix, (y + 1) * cellypix - 1);
/* only display if there is data to show */
if (state->gfxset.offset[set] + y * xcells < gfx->total_elements)
diff --git a/src/emu/video/crt9007.c b/src/emu/video/crt9007.c
index 731b2a20aaf..4ea1c5c4341 100644
--- a/src/emu/video/crt9007.c
+++ b/src/emu/video/crt9007.c
@@ -420,11 +420,7 @@ inline void crt9007_device::recompute_parameters()
// visible area
rectangle visarea;
- visarea.min_x = m_hsync_end;
- visarea.max_x = horiz_pix_total - 1;
-
- visarea.min_y = m_vsync_end;
- visarea.max_y = vert_pix_total - 1;
+ visarea.set(m_hsync_end, horiz_pix_total - 1, m_vsync_end, vert_pix_total - 1);
if (LOG)
{
diff --git a/src/emu/video/hd44102.c b/src/emu/video/hd44102.c
index b6e8fe43fdb..586641cc849 100644
--- a/src/emu/video/hd44102.c
+++ b/src/emu/video/hd44102.c
@@ -284,7 +284,7 @@ UINT32 hd44102_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap
int sy = m_sy + z;
int sx = m_sx + y;
- if ((sy >= cliprect.min_y) && (sy <= cliprect.max_y) && (sx >= cliprect.min_x) && (sx <= cliprect.max_x))
+ if (cliprect.contains(sx, sy))
{
int color = (m_status & STATUS_DISPLAY_OFF) ? 0 : BIT(data, z % 8);
diff --git a/src/emu/video/i8275.c b/src/emu/video/i8275.c
index 289957878ad..f44a3abe0bf 100644
--- a/src/emu/video/i8275.c
+++ b/src/emu/video/i8275.c
@@ -201,10 +201,7 @@ static void i8275_recompute_parameters(device_t *device)
vert_pix_total *= 2; // Use of spaced rows
}
- visarea.min_x = 0;
- visarea.min_y = 0;
- visarea.max_x = horiz_pix_total - 1;
- visarea.max_y = vert_pix_total - 1;
+ visarea.set(0, horiz_pix_total - 1, 0, vert_pix_total - 1);
i8275->screen->configure(horiz_pix_total, vert_pix_total, visarea,
i8275->screen->frame_period().attoseconds);
diff --git a/src/emu/video/mc6845.c b/src/emu/video/mc6845.c
index 621875d22b5..de2cc382ee8 100644
--- a/src/emu/video/mc6845.c
+++ b/src/emu/video/mc6845.c
@@ -324,10 +324,7 @@ void mc6845_device::recompute_parameters(bool postload)
attoseconds_t refresh = HZ_TO_ATTOSECONDS(m_clock) * (m_horiz_char_total + 1) * vert_pix_total;
- visarea.min_x = 0;
- visarea.min_y = 0;
- visarea.max_x = max_visible_x;
- visarea.max_y = max_visible_y;
+ visarea.set(0, max_visible_x, 0, max_visible_y);
if (LOG) logerror("M6845 config screen: HTOTAL: 0x%x VTOTAL: 0x%x MAX_X: 0x%x MAX_Y: 0x%x HSYNC: 0x%x-0x%x VSYNC: 0x%x-0x%x Freq: %ffps\n",
horiz_pix_total, vert_pix_total, max_visible_x, max_visible_y, hsync_on_pos, hsync_off_pos - 1, vsync_on_pos, vsync_off_pos - 1, 1 / ATTOSECONDS_TO_DOUBLE(refresh));
diff --git a/src/emu/video/psx.c b/src/emu/video/psx.c
index 256d72fdd33..705a7380655 100644
--- a/src/emu/video/psx.c
+++ b/src/emu/video/psx.c
@@ -435,9 +435,7 @@ void psxgpu_device::updatevisiblearea()
n_screenwidth = 640;
break;
}
- visarea.min_x = visarea.min_y = 0;
- visarea.max_x = n_screenwidth - 1;
- visarea.max_y = n_screenheight - 1;
+ visarea.set(0, n_screenwidth - 1, 0, n_screenheight - 1);
machine().primary_screen->configure(n_screenwidth, n_screenheight, visarea, HZ_TO_ATTOSECONDS(refresh));
}
diff --git a/src/emu/video/s2636.c b/src/emu/video/s2636.c
index de58c2c68b9..8983ee59202 100644
--- a/src/emu/video/s2636.c
+++ b/src/emu/video/s2636.c
@@ -162,10 +162,7 @@ static void draw_sprite( UINT8 *gfx, int color, int y, int x, int expand, int or
int tx = x + sx * (expand + 1) + ex;
/* get out if outside the drawing region */
- if ((tx < cliprect.min_x) ||
- (tx > cliprect.max_x) ||
- (ty < cliprect.min_y) ||
- (ty > cliprect.max_y))
+ if (!cliprect.contains(tx, ty))
continue;
/* get out if current image bit is transparent */
@@ -221,8 +218,7 @@ static int check_collision( device_t *device, int spriteno1, int spriteno2, cons
for (x = x1; x < x1 + SPRITE_WIDTH; x++)
for (y = y1; y < y1 + SPRITE_HEIGHT; y++)
{
- if ((x < cliprect.min_x) || (x > cliprect.max_x) ||
- (y < cliprect.min_y) || (y > cliprect.max_y))
+ if (!cliprect.contains(x, y))
continue;
checksum = checksum + s2636->collision_bitmap->pix16(y, x);
@@ -235,8 +231,7 @@ static int check_collision( device_t *device, int spriteno1, int spriteno2, cons
for (x = x1; x < x1 + SPRITE_WIDTH; x++)
for (y = y1; y < y1 + SPRITE_HEIGHT; y++)
{
- if ((x < cliprect.min_x) || (x > cliprect.max_x) ||
- (y < cliprect.min_y) || (y > cliprect.max_y))
+ if (!cliprect.contains(x, y))
continue;
checksum = checksum - s2636->collision_bitmap->pix16(y, x);
diff --git a/src/emu/video/tms9927.c b/src/emu/video/tms9927.c
index fc846e1ec05..a29f758b3a3 100644
--- a/src/emu/video/tms9927.c
+++ b/src/emu/video/tms9927.c
@@ -240,10 +240,7 @@ static void recompute_parameters(tms9927_state *tms, int postload)
/* create a visible area */
/* fix me: how do the offsets fit in here? */
- visarea.min_x = 0;
- visarea.max_x = tms->visible_hpix - 1;
- visarea.min_y = 0;
- visarea.max_y = tms->visible_vpix - 1;
+ visarea.set(0, tms->visible_hpix - 1, 0, tms->visible_vpix - 1);
refresh = HZ_TO_ATTOSECONDS(tms->clock) * tms->total_hpix * tms->total_vpix;
diff --git a/src/emu/video/upd3301.c b/src/emu/video/upd3301.c
index 47683b57d55..ae51f364486 100644
--- a/src/emu/video/upd3301.c
+++ b/src/emu/video/upd3301.c
@@ -169,10 +169,7 @@ inline void upd3301_device::recompute_parameters()
rectangle visarea;
- visarea.min_x = 0;
- visarea.min_y = 0;
- visarea.max_x = (m_h * m_width) - 1;
- visarea.max_y = (m_l * m_r) - 1;
+ visarea.set(0, (m_h * m_width) - 1, 0, (m_l * m_r) - 1);
if (LOG)
{
diff --git a/src/emu/video/vector.c b/src/emu/video/vector.c
index e6ff14eb463..a7d53f88534 100644
--- a/src/emu/video/vector.c
+++ b/src/emu/video/vector.c
@@ -258,8 +258,8 @@ SCREEN_UPDATE_RGB32( vector )
{
UINT32 flags = PRIMFLAG_ANTIALIAS(screen.machine().options().antialias() ? 1 : 0) | PRIMFLAG_BLENDMODE(BLENDMODE_ADD);
const rectangle &visarea = screen.visible_area();
- float xscale = 1.0f / (65536 * (visarea.max_x - visarea.min_x));
- float yscale = 1.0f / (65536 * (visarea.max_y - visarea.min_y));
+ float xscale = 1.0f / (65536 * visarea.width());
+ float yscale = 1.0f / (65536 * visarea.height());
float xoffs = (float)visarea.min_x;
float yoffs = (float)visarea.min_y;
point *curpoint;
diff --git a/src/emu/video/voodoo.c b/src/emu/video/voodoo.c
index a2fd149dcb3..4d554a68909 100644
--- a/src/emu/video/voodoo.c
+++ b/src/emu/video/voodoo.c
@@ -930,7 +930,7 @@ static void swap_buffers(voodoo_state *v)
if (v->stats.display)
{
const rectangle &visible_area = v->screen->visible_area();
- int screen_area = (visible_area.max_x - visible_area.min_x + 1) * (visible_area.max_y - visible_area.min_y + 1);
+ int screen_area = visible_area.width() * visible_area.height();
char *statsptr = v->stats.buffer;
int pixelcount;
int i;
@@ -2573,10 +2573,7 @@ static INT32 register_w(voodoo_state *v, offs_t offset, UINT32 data)
rectangle visarea;
/* create a new visarea */
- visarea.min_x = hbp;
- visarea.max_x = hbp + hvis - 1;
- visarea.min_y = vbp;
- visarea.max_y = vbp + vvis - 1;
+ visarea.set(hbp, hbp + hvis - 1, vbp, vbp + vvis - 1);
/* keep within bounds */
visarea.max_x = MIN(visarea.max_x, htotal - 1);
diff --git a/src/lib/util/bitmap.c b/src/lib/util/bitmap.c
index 279f931426b..a178e43beea 100644
--- a/src/lib/util/bitmap.c
+++ b/src/lib/util/bitmap.c
@@ -331,7 +331,7 @@ void bitmap_t::fill(UINT32 color, const rectangle &cliprect)
case 8:
// 8bpp always uses memset
for (INT32 y = fill.min_y; y <= fill.max_y; y++)
- memset(raw_pixptr(y, fill.min_x), (UINT8)color, fill.max_x + 1 - fill.min_x);
+ memset(raw_pixptr(y, fill.min_x), (UINT8)color, fill.width());
break;
case 16:
@@ -339,7 +339,7 @@ void bitmap_t::fill(UINT32 color, const rectangle &cliprect)
if ((UINT8)(color >> 8) == (UINT8)color)
{
for (INT32 y = fill.min_y; y <= fill.max_y; y++)
- memset(raw_pixptr(y, fill.min_x), (UINT8)color, (fill.max_x + 1 - fill.min_x) * 2);
+ memset(raw_pixptr(y, fill.min_x), (UINT8)color, fill.width() * 2);
}
else
{
@@ -353,7 +353,7 @@ void bitmap_t::fill(UINT32 color, const rectangle &cliprect)
for (INT32 y = fill.min_y + 1; y <= fill.max_y; y++)
{
destrow = &pixt<UINT16>(y, fill.min_x);
- memcpy(destrow, destrow0, (fill.max_x + 1 - fill.min_x) * 2);
+ memcpy(destrow, destrow0, fill.width() * 2);
}
}
break;
@@ -363,7 +363,7 @@ void bitmap_t::fill(UINT32 color, const rectangle &cliprect)
if ((UINT8)(color >> 8) == (UINT8)color && (UINT16)(color >> 16) == (UINT16)color)
{
for (INT32 y = fill.min_y; y <= fill.max_y; y++)
- memset(&pixt<UINT32>(y, fill.min_x), (UINT8)color, (fill.max_x + 1 - fill.min_x) * 4);
+ memset(&pixt<UINT32>(y, fill.min_x), (UINT8)color, fill.width() * 4);
}
else
{
@@ -377,7 +377,7 @@ void bitmap_t::fill(UINT32 color, const rectangle &cliprect)
for (INT32 y = fill.min_y + 1; y <= fill.max_y; y++)
{
destrow = &pixt<UINT32>(y, fill.min_x);
- memcpy(destrow, destrow0, (fill.max_x + 1 - fill.min_x) * 4);
+ memcpy(destrow, destrow0, fill.width() * 4);
}
}
break;
@@ -387,7 +387,7 @@ void bitmap_t::fill(UINT32 color, const rectangle &cliprect)
if ((UINT8)(color >> 8) == (UINT8)color && (UINT16)(color >> 16) == (UINT16)color)
{
for (INT32 y = fill.min_y; y <= fill.max_y; y++)
- memset(&pixt<UINT64>(y, fill.min_x), (UINT8)color, (fill.max_x + 1 - fill.min_x) * 8);
+ memset(&pixt<UINT64>(y, fill.min_x), (UINT8)color, fill.width() * 8);
}
else
{
@@ -401,7 +401,7 @@ void bitmap_t::fill(UINT32 color, const rectangle &cliprect)
for (INT32 y = fill.min_y + 1; y <= fill.max_y; y++)
{
destrow = &pixt<UINT64>(y, fill.min_x);
- memcpy(destrow, destrow0, (fill.max_x + 1 - fill.min_x) * 4);
+ memcpy(destrow, destrow0, fill.width() * 8);
}
}
break;
diff --git a/src/lib/util/bitmap.h b/src/lib/util/bitmap.h
index 546f6a73586..b6ae74b5a80 100644
--- a/src/lib/util/bitmap.h
+++ b/src/lib/util/bitmap.h
@@ -103,12 +103,17 @@ public:
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 width() const { return max_x + 1 - min_x; }
INT32 height() const { return max_y + 1 - min_y; }
+ INT32 xcenter() const { return (min_x + max_x + 1) / 2; }
+ INT32 ycenter() const { return (min_y + max_y + 1) / 2; }
// setters
void set(INT32 minx, INT32 maxx, INT32 miny, INT32 maxy) { min_x = minx; max_x = maxx; min_y = miny; max_y = maxy; }
+ void setx(INT32 minx, INT32 maxx) { min_x = minx; max_x = maxx; }
+ void sety(INT32 miny, INT32 maxy) { min_y = miny; max_y = maxy; }
void set_width(INT32 width) { max_x = min_x + width - 1; }
void set_height(INT32 height) { max_y = min_y + height - 1; }
void set_origin(INT32 x, INT32 y) { max_x += x - min_x; max_y += y - min_y; min_x = x; min_y = y; }
+ void set_size(INT32 width, INT32 height) { set_width(width); set_height(height); }
// internal state
INT32 min_x; // minimum X, or left coordinate
@@ -205,7 +210,7 @@ private:
protected:
// construction/destruction -- subclasses only
bitmap8_t(bitmap_format format, int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap_t(format, 8, width, height, xslop, yslop) { }
- bitmap8_t(bitmap_format format, void *base, int width, int height, int rowpixels) : bitmap_t(format, 8, base, width, height, rowpixels) { assert(valid_format(format)); }
+ bitmap8_t(bitmap_format format, UINT8 *base, int width, int height, int rowpixels) : bitmap_t(format, 8, base, width, height, rowpixels) { assert(valid_format(format)); }
bitmap8_t(bitmap_format format, bitmap8_t &source, const rectangle &subrect) : bitmap_t(format, 8, source, subrect) { }
public:
@@ -228,7 +233,7 @@ private:
protected:
// construction/destruction -- subclasses only
bitmap16_t(bitmap_format format, int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap_t(format, 16, width, height, xslop, yslop) { assert(valid_format(format)); }
- bitmap16_t(bitmap_format format, void *base, int width, int height, int rowpixels) : bitmap_t(format, 16, base, width, height, rowpixels) { assert(valid_format(format)); }
+ bitmap16_t(bitmap_format format, UINT16 *base, int width, int height, int rowpixels) : bitmap_t(format, 16, base, width, height, rowpixels) { assert(valid_format(format)); }
bitmap16_t(bitmap_format format, bitmap16_t &source, const rectangle &subrect) : bitmap_t(format, 16, source, subrect) { }
public:
@@ -251,7 +256,7 @@ private:
protected:
// construction/destruction -- subclasses only
bitmap32_t(bitmap_format format, int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap_t(format, 32, width, height, xslop, yslop) { assert(valid_format(format)); }
- bitmap32_t(bitmap_format format, void *base, int width, int height, int rowpixels) : bitmap_t(format, 32, base, width, height, rowpixels) { assert(valid_format(format)); }
+ bitmap32_t(bitmap_format format, UINT32 *base, int width, int height, int rowpixels) : bitmap_t(format, 32, base, width, height, rowpixels) { assert(valid_format(format)); }
bitmap32_t(bitmap_format format, bitmap32_t &source, const rectangle &subrect) : bitmap_t(format, 32, source, subrect) { }
public:
@@ -274,7 +279,7 @@ private:
protected:
// construction/destruction -- subclasses only
bitmap64_t(bitmap_format format, int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap_t(format, 64, width, height, xslop, yslop) { assert(valid_format(format)); }
- bitmap64_t(bitmap_format format, void *base, int width, int height, int rowpixels) : bitmap_t(format, 64, base, width, height, rowpixels) { assert(valid_format(format)); }
+ bitmap64_t(bitmap_format format, UINT64 *base, int width, int height, int rowpixels) : bitmap_t(format, 64, base, width, height, rowpixels) { assert(valid_format(format)); }
bitmap64_t(bitmap_format format, bitmap64_t &source, const rectangle &subrect) : bitmap_t(format, 64, source, subrect) { }
public:
@@ -298,7 +303,7 @@ class bitmap_ind8 : public bitmap8_t
public:
// construction/destruction
bitmap_ind8(int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap8_t(k_bitmap_format, width, height, xslop, yslop) { }
- bitmap_ind8(void *base, int width, int height, int rowpixels) : bitmap8_t(k_bitmap_format, base, width, height, rowpixels) { }
+ bitmap_ind8(UINT8 *base, int width, int height, int rowpixels) : bitmap8_t(k_bitmap_format, base, width, height, rowpixels) { }
bitmap_ind8(bitmap_ind8 &source, const rectangle &subrect) : bitmap8_t(k_bitmap_format, source, subrect) { }
void wrap(UINT8 *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); }
void wrap(bitmap_ind8 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<bitmap_t &>(source), subrect); }
@@ -315,7 +320,7 @@ class bitmap_ind16 : public bitmap16_t
public:
// construction/destruction
bitmap_ind16(int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap16_t(k_bitmap_format, width, height, xslop, yslop) { }
- bitmap_ind16(void *base, int width, int height, int rowpixels) : bitmap16_t(k_bitmap_format, base, width, height, rowpixels) { }
+ bitmap_ind16(UINT16 *base, int width, int height, int rowpixels) : bitmap16_t(k_bitmap_format, base, width, height, rowpixels) { }
bitmap_ind16(bitmap_ind16 &source, const rectangle &subrect) : bitmap16_t(k_bitmap_format, source, subrect) { }
void wrap(UINT16 *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); }
void wrap(bitmap_ind8 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<bitmap_t &>(source), subrect); }
@@ -332,7 +337,7 @@ class bitmap_ind32 : public bitmap32_t
public:
// construction/destruction
bitmap_ind32(int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap32_t(k_bitmap_format, width, height, xslop, yslop) { }
- bitmap_ind32(void *base, int width, int height, int rowpixels) : bitmap32_t(k_bitmap_format, base, width, height, rowpixels) { }
+ bitmap_ind32(UINT32 *base, int width, int height, int rowpixels) : bitmap32_t(k_bitmap_format, base, width, height, rowpixels) { }
bitmap_ind32(bitmap_ind32 &source, const rectangle &subrect) : bitmap32_t(k_bitmap_format, source, subrect) { }
void wrap(UINT32 *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); }
void wrap(bitmap_ind8 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<bitmap_t &>(source), subrect); }
@@ -349,7 +354,7 @@ class bitmap_ind64 : public bitmap64_t
public:
// construction/destruction
bitmap_ind64(int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap64_t(k_bitmap_format, width, height, xslop, yslop) { }
- bitmap_ind64(void *base, int width, int height, int rowpixels) : bitmap64_t(k_bitmap_format, base, width, height, rowpixels) { }
+ bitmap_ind64(UINT64 *base, int width, int height, int rowpixels) : bitmap64_t(k_bitmap_format, base, width, height, rowpixels) { }
bitmap_ind64(bitmap_ind64 &source, const rectangle &subrect) : bitmap64_t(k_bitmap_format, source, subrect) { }
void wrap(UINT64 *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); }
void wrap(bitmap_ind8 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<bitmap_t &>(source), subrect); }
@@ -369,7 +374,7 @@ class bitmap_yuy16 : public bitmap16_t
public:
// construction/destruction
bitmap_yuy16(int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap16_t(k_bitmap_format, width, height, xslop, yslop) { }
- bitmap_yuy16(void *base, int width, int height, int rowpixels) : bitmap16_t(k_bitmap_format, base, width, height, rowpixels) { }
+ bitmap_yuy16(UINT16 *base, int width, int height, int rowpixels) : bitmap16_t(k_bitmap_format, base, width, height, rowpixels) { }
bitmap_yuy16(bitmap_yuy16 &source, const rectangle &subrect) : bitmap16_t(k_bitmap_format, source, subrect) { }
void wrap(UINT16 *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); }
void wrap(bitmap_yuy16 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<bitmap_t &>(source), subrect); }
@@ -386,7 +391,7 @@ class bitmap_rgb32 : public bitmap32_t
public:
// construction/destruction
bitmap_rgb32(int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap32_t(k_bitmap_format, width, height, xslop, yslop) { }
- bitmap_rgb32(void *base, int width, int height, int rowpixels) : bitmap32_t(k_bitmap_format, base, width, height, rowpixels) { }
+ bitmap_rgb32(UINT32 *base, int width, int height, int rowpixels) : bitmap32_t(k_bitmap_format, base, width, height, rowpixels) { }
bitmap_rgb32(bitmap_rgb32 &source, const rectangle &subrect) : bitmap32_t(k_bitmap_format, source, subrect) { }
void wrap(UINT32 *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); }
void wrap(bitmap_rgb32 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<bitmap_t &>(source), subrect); }
@@ -403,7 +408,7 @@ class bitmap_argb32 : public bitmap32_t
public:
// construction/destruction
bitmap_argb32(int width = 0, int height = 0, int xslop = 0, int yslop = 0) : bitmap32_t(k_bitmap_format, width, height, xslop, yslop) { }
- bitmap_argb32(void *base, int width, int height, int rowpixels) : bitmap32_t(k_bitmap_format, base, width, height, rowpixels) { }
+ bitmap_argb32(UINT32 *base, int width, int height, int rowpixels) : bitmap32_t(k_bitmap_format, base, width, height, rowpixels) { }
bitmap_argb32(bitmap_argb32 &source, const rectangle &subrect) : bitmap32_t(k_bitmap_format, source, subrect) { }
void wrap(UINT32 *base, int width, int height, int rowpixels) { bitmap_t::wrap(base, width, height, rowpixels); }
void wrap(bitmap_argb32 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<bitmap_t &>(source), subrect); }
diff --git a/src/mame/drivers/alg.c b/src/mame/drivers/alg.c
index caabd183ad5..d54133bf06a 100644
--- a/src/mame/drivers/alg.c
+++ b/src/mame/drivers/alg.c
@@ -64,8 +64,8 @@ static int get_lightgun_pos(screen_device &screen, int player, int *x, int *y)
if (xpos == -1 || ypos == -1)
return FALSE;
- *x = visarea.min_x + xpos * (visarea.max_x - visarea.min_x + 1) / 255;
- *y = visarea.min_y + ypos * (visarea.max_y - visarea.min_y + 1) / 255;
+ *x = visarea.min_x + xpos * visarea.width() / 255;
+ *y = visarea.min_y + ypos * visarea.height() / 255;
return TRUE;
}
diff --git a/src/mame/drivers/aristmk6.c b/src/mame/drivers/aristmk6.c
index 2044bcb8533..f3b72584b74 100644
--- a/src/mame/drivers/aristmk6.c
+++ b/src/mame/drivers/aristmk6.c
@@ -86,7 +86,7 @@ SCREEN_UPDATE_RGB32(aristmk6)
g = (g << 2) | (g & 3);
b = (b << 3) | (b & 0x7);
- if((x)<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y)
+ if(cliprect.contains(x, y))
bitmap.pix32(y, x) = r | g<<8 | b<<16;
count+=2;
@@ -97,7 +97,7 @@ SCREEN_UPDATE_RGB32(aristmk6)
color = blit_ram[count];
- if((x)<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y)
+ if(cliprect.contains(x, y))
bitmap.pix32(y, x) = screen.machine().pens[color];
count++;
diff --git a/src/mame/drivers/atarisy4.c b/src/mame/drivers/atarisy4.c
index 018cba46edb..535867f3633 100644
--- a/src/mame/drivers/atarisy4.c
+++ b/src/mame/drivers/atarisy4.c
@@ -251,10 +251,7 @@ static void draw_polygon(atarisy4_state *state, UINT16 color)
poly_vertex v1, v2, v3;
poly_extra_data *extra = (poly_extra_data *)poly_get_extra_data(state->m_poly);
- clip.min_x = 0;
- clip.min_y = 0;
- clip.max_x = 511;
- clip.max_y = 511;
+ clip.set(0, 511, 0, 511);
extra->color = color;
extra->screen_ram = state->m_screen_ram;
diff --git a/src/mame/drivers/bingor.c b/src/mame/drivers/bingor.c
index 65b31428abc..d057e403fef 100644
--- a/src/mame/drivers/bingor.c
+++ b/src/mame/drivers/bingor.c
@@ -474,22 +474,22 @@ static SCREEN_UPDATE_RGB32(bingor)
color = (state->m_blit_ram[count] & 0xf000)>>12;
- if((x+3)<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y)
+ if(cliprect.contains(x+3, y))
bitmap.pix32(y, x+3) = screen.machine().pens[color];
color = (state->m_blit_ram[count] & 0x0f00)>>8;
- if((x+2)<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y)
+ if(cliprect.contains(x+2, y))
bitmap.pix32(y, x+2) = screen.machine().pens[color];
color = (state->m_blit_ram[count] & 0x00f0)>>4;
- if((x+1)<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y)
+ if(cliprect.contains(x+1, y))
bitmap.pix32(y, x+1) = screen.machine().pens[color];
color = (state->m_blit_ram[count] & 0x000f)>>0;
- if((x+0)<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y)
+ if(cliprect.contains(x+0, y))
bitmap.pix32(y, x+0) = screen.machine().pens[color];
count++;
diff --git a/src/mame/drivers/ccastles.c b/src/mame/drivers/ccastles.c
index a6c8b323a44..b021db38401 100644
--- a/src/mame/drivers/ccastles.c
+++ b/src/mame/drivers/ccastles.c
@@ -210,10 +210,7 @@ static MACHINE_START( ccastles )
assert(state->m_vblank_end < state->m_vblank_start);
/* reconfigure the visible area to match */
- visarea.min_x = 0;
- visarea.max_x = 255;
- visarea.min_y = state->m_vblank_end;
- visarea.max_y = state->m_vblank_start - 1;
+ visarea.set(0, 255, state->m_vblank_end, state->m_vblank_start - 1);
machine.primary_screen->configure(320, 256, visarea, HZ_TO_ATTOSECONDS(PIXEL_CLOCK) * VTOTAL * HTOTAL);
/* configure the ROM banking */
diff --git a/src/mame/drivers/cloud9.c b/src/mame/drivers/cloud9.c
index 09a08745806..863be86e742 100644
--- a/src/mame/drivers/cloud9.c
+++ b/src/mame/drivers/cloud9.c
@@ -179,10 +179,7 @@ static MACHINE_START( cloud9 )
assert(state->m_vblank_end < state->m_vblank_start);
/* reconfigure the visible area to match */
- visarea.min_x = 0;
- visarea.max_x = 255;
- visarea.min_y = state->m_vblank_end + 1;
- visarea.max_y = state->m_vblank_start;
+ visarea.set(0, 255, state->m_vblank_end + 1, state->m_vblank_start);
machine.primary_screen->configure(320, 256, visarea, HZ_TO_ATTOSECONDS(PIXEL_CLOCK) * VTOTAL * HTOTAL);
/* create a timer for IRQs and set up the first callback */
diff --git a/src/mame/drivers/cps3.c b/src/mame/drivers/cps3.c
index 338baa4d142..7024b3fc387 100644
--- a/src/mame/drivers/cps3.c
+++ b/src/mame/drivers/cps3.c
@@ -847,10 +847,7 @@ static VIDEO_START(cps3)
// between 0x00 and 0x80 (0x40 is normal, 0x80 would be 'view twice as much', 0x20 is 'view half as much')
state->m_renderbuffer_bitmap.allocate(512*2,224*2);
- state->m_renderbuffer_clip.min_x = 0;
- state->m_renderbuffer_clip.max_x = state->m_screenwidth-1;
- state->m_renderbuffer_clip.min_y = 0;
- state->m_renderbuffer_clip.max_y = 224-1;
+ state->m_renderbuffer_clip.set(0, state->m_screenwidth-1, 0, 224-1);
state->m_renderbuffer_bitmap.fill(0x3f, state->m_renderbuffer_clip);
@@ -912,10 +909,7 @@ static void cps3_draw_tilemapsprite_line(running_machine &machine, int tmnum, in
if (drawline>cliprect.max_y+4) return;
- clip.min_x = cliprect.min_x;
- clip.max_x = cliprect.max_x;
- clip.min_y = drawline;
- clip.max_y = drawline;
+ clip.set(cliprect.min_x, cliprect.max_x, drawline, drawline);
for (x=0;x<(cliprect.max_x/16)+2;x++)
{
@@ -964,8 +958,7 @@ static SCREEN_UPDATE_RGB32(cps3)
if (state->m_screenwidth!=496)
{
state->m_screenwidth = 496;
- visarea.min_x = 0; visarea.max_x = 496-1;
- visarea.min_y = 0; visarea.max_y = 224-1;
+ visarea.set(0, 496-1, 0, 224-1);
screen.configure(496, 224, visarea, period);
}
}
@@ -974,8 +967,7 @@ static SCREEN_UPDATE_RGB32(cps3)
if (state->m_screenwidth!=384)
{
state->m_screenwidth = 384;
- visarea.min_x = 0; visarea.max_x = 384-1;
- visarea.min_y = 0; visarea.max_y = 224-1;
+ visarea.set(0, 384-1, 0, 224-1);
screen.configure(384, 224, visarea, period);
}
}
diff --git a/src/mame/drivers/cybertnk.c b/src/mame/drivers/cybertnk.c
index c0d4706bb76..f73f0afe96f 100644
--- a/src/mame/drivers/cybertnk.c
+++ b/src/mame/drivers/cybertnk.c
@@ -208,12 +208,8 @@ static VIDEO_START( cybertnk )
static void draw_pixel( bitmap_ind16 &bitmap, const rectangle &cliprect, int y, int x, int pen)
{
- if (x>cliprect.max_x) return;
- if (x<cliprect.min_x) return;
- if (y>cliprect.max_y) return;
- if (y<cliprect.min_y) return;
-
- bitmap.pix16(y, x) = pen;
+ if (cliprect.contains(x, y))
+ bitmap.pix16(y, x) = pen;
}
static UINT32 update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int screen_shift)
diff --git a/src/mame/drivers/flyball.c b/src/mame/drivers/flyball.c
index 3ba3d79ad20..79ae63b4484 100644
--- a/src/mame/drivers/flyball.c
+++ b/src/mame/drivers/flyball.c
@@ -107,10 +107,7 @@ static SCREEN_UPDATE_IND16( flyball )
for (y = bally; y < bally + 2; y++)
for (x = ballx; x < ballx + 2; x++)
- if (x >= cliprect.min_x &&
- x <= cliprect.max_x &&
- y >= cliprect.min_y &&
- y <= cliprect.max_y)
+ if (cliprect.contains(x, y))
bitmap.pix16(y, x) = 1;
return 0;
}
diff --git a/src/mame/drivers/gpworld.c b/src/mame/drivers/gpworld.c
index 88bda1e0778..f87ca864db5 100644
--- a/src/mame/drivers/gpworld.c
+++ b/src/mame/drivers/gpworld.c
@@ -97,13 +97,8 @@ INLINE void draw_pixel(bitmap_ind16 &bitmap,const rectangle &cliprect,int x,int
y = bitmap.height() - y - 1;
}
- if (x < cliprect.min_x ||
- x > cliprect.max_x ||
- y < cliprect.min_y ||
- y > cliprect.max_y)
- return;
-
- bitmap.pix16(y, x) = color;
+ if (cliprect.contains(x, y))
+ bitmap.pix16(y, x) = color;
}
static void gpworld_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
diff --git a/src/mame/drivers/gunpey.c b/src/mame/drivers/gunpey.c
index 8328f5d7e38..b948045f0e5 100644
--- a/src/mame/drivers/gunpey.c
+++ b/src/mame/drivers/gunpey.c
@@ -89,7 +89,7 @@ static SCREEN_UPDATE_RGB32( gunpey )
g = (color & 0x03e0) >> 2;
r = (color & 0x7c00) >> 7;
- if(x<screen.visible_area().max_x && y<screen.visible_area().max_y)
+ if(cliprect.contains(x, y))
bitmap.pix32(y, x) = b | (g<<8) | (r<<16);
diff --git a/src/mame/drivers/highvdeo.c b/src/mame/drivers/highvdeo.c
index 080689516c2..4e3675cf2a3 100644
--- a/src/mame/drivers/highvdeo.c
+++ b/src/mame/drivers/highvdeo.c
@@ -125,12 +125,12 @@ static SCREEN_UPDATE_RGB32(tourvisn)
color = ((state->m_blit_ram[count]) & 0x00ff)>>0;
- if((x*2)<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y)
+ if(cliprect.contains((x*2)+0, y))
bitmap.pix32(y, (x*2)+0) = screen.machine().pens[color];
color = ((state->m_blit_ram[count]) & 0xff00)>>8;
- if(((x*2)+1)<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y)
+ if(cliprect.contains((x*2)+1, y))
bitmap.pix32(y, (x*2)+1) = screen.machine().pens[color];
count++;
@@ -162,7 +162,7 @@ static SCREEN_UPDATE_RGB32(brasil)
b = (color & 0x001f) << 3;
g = (color & 0x07e0) >> 3;
r = (color & 0xf800) >> 8;
- if(x<screen.visible_area().max_x && y<screen.visible_area().max_y)
+ if(cliprect.contains(x, y))
bitmap.pix32(y, x) = b | (g<<8) | (r<<16);
count++;
diff --git a/src/mame/drivers/hng64.c b/src/mame/drivers/hng64.c
index 93d18712217..ae3915c6b46 100644
--- a/src/mame/drivers/hng64.c
+++ b/src/mame/drivers/hng64.c
@@ -935,10 +935,7 @@ static WRITE32_HANDLER( tcram_w )
state->m_screen_dis = 0;
- visarea.min_x = min_x;
- visarea.max_x = min_x + max_x - 1;
- visarea.min_y = min_y;
- visarea.max_y = min_y + max_y - 1;
+ visarea.set(min_x, min_x + max_x - 1, min_y, min_y + max_y - 1);
space->machine().primary_screen->configure(HTOTAL, VTOTAL, visarea, space->machine().primary_screen->frame_period().attoseconds );
}
}
diff --git a/src/mame/drivers/igs009.c b/src/mame/drivers/igs009.c
index c86230922f6..94bc2fd7c7e 100644
--- a/src/mame/drivers/igs009.c
+++ b/src/mame/drivers/igs009.c
@@ -298,10 +298,7 @@ static SCREEN_UPDATE_IND16(jingbell)
int rowenable = state->m_bg_scroll2[zz];
/* draw top of screen */
- clip.min_x = visarea.min_x;
- clip.max_x = visarea.max_x;
- clip.min_y = startclipmin;
- clip.max_y = startclipmin+2;
+ clip.set(visarea.min_x, visarea.max_x, startclipmin, startclipmin+2);
bitmap.fill(screen.machine().pens[rowenable], clip);
diff --git a/src/mame/drivers/igs011.c b/src/mame/drivers/igs011.c
index 380f7cb7f27..68f185f4c99 100644
--- a/src/mame/drivers/igs011.c
+++ b/src/mame/drivers/igs011.c
@@ -436,7 +436,7 @@ static WRITE16_HANDLER( igs011_blit_flags_w )
}
// plot it
- if (x >= clip.min_x && x <= clip.max_x && y >= clip.min_y && y <= clip.max_y)
+ if (clip.contains(x, y))
{
if (clear) dest[x + y * 512] = clear_pen;
else if (pen != trans_pen) dest[x + y * 512] = pen | pen_hi;
diff --git a/src/mame/drivers/itgambl2.c b/src/mame/drivers/itgambl2.c
index 6518c018c7a..cb2616b4971 100644
--- a/src/mame/drivers/itgambl2.c
+++ b/src/mame/drivers/itgambl2.c
@@ -126,7 +126,7 @@ static SCREEN_UPDATE_RGB32( itgambl2 )
color = (blit_ram[count] & 0xff)>>0;
- if((x)<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y)
+ if(cliprect.contains(x, y))
bitmap.pix32(y, x) = screen.machine().pens[color];
count++;
diff --git a/src/mame/drivers/itgambl3.c b/src/mame/drivers/itgambl3.c
index a4413230735..9446d97846c 100644
--- a/src/mame/drivers/itgambl3.c
+++ b/src/mame/drivers/itgambl3.c
@@ -114,7 +114,7 @@ static SCREEN_UPDATE_RGB32( itgambl3 )
color = (blit_ram[count] & 0xff)>>0;
- if((x)<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y)
+ if(cliprect.contains(x, y))
bitmap.pix32(y, x) = screen.machine().pens[color];
count++;
diff --git a/src/mame/drivers/jackie.c b/src/mame/drivers/jackie.c
index e4a638afb20..30478f81dfb 100644
--- a/src/mame/drivers/jackie.c
+++ b/src/mame/drivers/jackie.c
@@ -196,10 +196,7 @@ static SCREEN_UPDATE_IND16(jackie)
int rowenable = state->m_bg_scroll2[j];
/* draw top of screen */
- clip.min_x = visarea.min_x;
- clip.max_x = visarea.max_x;
- clip.min_y = startclipmin;
- clip.max_y = startclipmin+1;
+ clip.set(visarea.min_x, visarea.max_x, startclipmin, startclipmin+1);
if (rowenable==0)
{
diff --git a/src/mame/drivers/jantotsu.c b/src/mame/drivers/jantotsu.c
index 402e41eca06..55726f21311 100644
--- a/src/mame/drivers/jantotsu.c
+++ b/src/mame/drivers/jantotsu.c
@@ -158,7 +158,7 @@ static SCREEN_UPDATE_RGB32(jantotsu)
for(pen_i = 0;pen_i<4;pen_i++)
color |= (((state->m_bitmap[count + pen_i*0x2000]) >> (7 - i)) & 1) << pen_i;
- if ((x + i) <= screen.visible_area().max_x && (y + 0) < screen.visible_area().max_y)
+ if (cliprect.contains(x + i, y))
bitmap.pix32(y, x + i) = screen.machine().pens[color];
}
diff --git a/src/mame/drivers/kingdrby.c b/src/mame/drivers/kingdrby.c
index df0edf0c3a6..28d596c9e2c 100644
--- a/src/mame/drivers/kingdrby.c
+++ b/src/mame/drivers/kingdrby.c
@@ -222,10 +222,7 @@ static SCREEN_UPDATE_IND16(kingdrby)
tilemap_set_scrolly( state->m_sc0w_tilemap,0, 32);
/* maybe it needs two window tilemaps? (one at the top, the other at the bottom)*/
- clip.min_x = visarea.min_x;
- clip.max_x = 256;
- clip.min_y = 192;
- clip.max_y = visarea.max_y;
+ clip.set(visarea.min_x, 256, 192, visarea.max_y);
/*TILEMAP_DRAW_CATEGORY + TILEMAP_DRAW_OPAQUE doesn't suit well?*/
tilemap_draw(bitmap,cliprect,state->m_sc0_tilemap,0,0);
diff --git a/src/mame/drivers/limenko.c b/src/mame/drivers/limenko.c
index f257d85a78d..bbe77ba77c3 100644
--- a/src/mame/drivers/limenko.c
+++ b/src/mame/drivers/limenko.c
@@ -119,11 +119,7 @@ static CUSTOM_INPUT( spriteram_bit_r )
static WRITE32_HANDLER( spriteram_buffer_w )
{
limenko_state *state = space->machine().driver_data<limenko_state>();
- rectangle clip;
- clip.min_x = 0;
- clip.max_x = 383;
- clip.min_y = 0;
- clip.max_y = 239;
+ rectangle clip(0, 383, 0, 239);
state->m_sprites_bitmap_pri.fill(0, clip);
state->m_sprites_bitmap.fill(0, clip);
diff --git a/src/mame/drivers/luckgrln.c b/src/mame/drivers/luckgrln.c
index ddb27752d0d..001f51588e0 100644
--- a/src/mame/drivers/luckgrln.c
+++ b/src/mame/drivers/luckgrln.c
@@ -269,12 +269,7 @@ static SCREEN_UPDATE_IND16(luckgrln)
const rectangle &visarea = screen.visible_area();
int i;
- rectangle clip;
-
- clip.min_x = visarea.min_x;
- clip.max_x = visarea.max_x;
- clip.min_y = visarea.min_y;
- clip.max_y = visarea.max_y;
+ rectangle clip = visarea;
bitmap.fill(0, cliprect);
diff --git a/src/mame/drivers/magicard.c b/src/mame/drivers/magicard.c
index a5f70ac9fa3..55d78c070bf 100644
--- a/src/mame/drivers/magicard.c
+++ b/src/mame/drivers/magicard.c
@@ -402,22 +402,22 @@ static SCREEN_UPDATE_RGB32(magicard)
color = ((state->m_magicram[count]) & 0x000f)>>0;
- if(((x*4)+3)<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y)
+ if(cliprect.contains((x*4)+3, y))
bitmap.pix32(y, (x*4)+3) = screen.machine().pens[color];
color = ((state->m_magicram[count]) & 0x00f0)>>4;
- if(((x*4)+2)<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y)
+ if(cliprect.contains((x*4)+2, y))
bitmap.pix32(y, (x*4)+2) = screen.machine().pens[color];
color = ((state->m_magicram[count]) & 0x0f00)>>8;
- if(((x*4)+1)<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y)
+ if(cliprect.contains((x*4)+1, y))
bitmap.pix32(y, (x*4)+1) = screen.machine().pens[color];
color = ((state->m_magicram[count]) & 0xf000)>>12;
- if(((x*4)+0)<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y)
+ if(cliprect.contains((x*4)+0, y))
bitmap.pix32(y, (x*4)+0) = screen.machine().pens[color];
count++;
@@ -434,12 +434,12 @@ static SCREEN_UPDATE_RGB32(magicard)
color = ((state->m_magicram[count]) & 0x00ff)>>0;
- if(((x*2)+1)<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y)
+ if(cliprect.contains((x*2)+1, y))
bitmap.pix32(y, (x*2)+1) = screen.machine().pens[color];
color = ((state->m_magicram[count]) & 0xff00)>>8;
- if(((x*2)+0)<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y)
+ if(cliprect.contains((x*2)+0, y))
bitmap.pix32(y, (x*2)+0) = screen.machine().pens[color];
count++;
diff --git a/src/mame/drivers/majorpkr.c b/src/mame/drivers/majorpkr.c
index 5df9310d52c..01e96f1ed06 100644
--- a/src/mame/drivers/majorpkr.c
+++ b/src/mame/drivers/majorpkr.c
@@ -532,10 +532,8 @@ static SCREEN_UPDATE_IND16(majorpkr)
/* The following custom_clip is to exclude the last char column (unused)
form the render. We need more proof about how the video is working.
*/
- custom_clip.min_x=cliprect.min_x;
- custom_clip.max_x=cliprect.max_x-16;
- custom_clip.min_y=cliprect.min_y;
- custom_clip.max_y=cliprect.max_y;
+ custom_clip = cliprect;
+ custom_clip.max_x -= 16;
tilemap_draw(bitmap, custom_clip, state->m_bg_tilemap, 0, 0);
tilemap_draw(bitmap, custom_clip, state->m_fg_tilemap, 0, 0);
diff --git a/src/mame/drivers/marinedt.c b/src/mame/drivers/marinedt.c
index 3f7745ab127..a4612f6327e 100644
--- a/src/mame/drivers/marinedt.c
+++ b/src/mame/drivers/marinedt.c
@@ -547,7 +547,7 @@ static SCREEN_UPDATE_IND16( marinedt )
int x = OBJ_X(state->m_obj1_x) + sx;
int y = OBJ_Y(state->m_obj1_y) + sy;
- if (x < cliprect.min_x || x > cliprect.max_x || y < cliprect.min_y || y > cliprect.max_y)
+ if (!cliprect.contains(x, y))
continue;
if (state->m_obj1->pix16(sy, sx) == 0)
diff --git a/src/mame/drivers/mediagx.c b/src/mame/drivers/mediagx.c
index 6e103633998..dc2ee5500a9 100644
--- a/src/mame/drivers/mediagx.c
+++ b/src/mame/drivers/mediagx.c
@@ -251,9 +251,7 @@ static void draw_framebuffer(running_machine &machine, bitmap_rgb32 &bitmap, con
state->m_frame_width = width;
state->m_frame_height = height;
- visarea.min_x = visarea.min_y = 0;
- visarea.max_x = width - 1;
- visarea.max_y = height - 1;
+ visarea.set(0, width - 1, 0, height - 1);
machine.primary_screen->configure(width, height * 262 / 240, visarea, machine.primary_screen->frame_period().attoseconds);
}
diff --git a/src/mame/drivers/midzeus.c b/src/mame/drivers/midzeus.c
index a26142af808..c1071839e5d 100644
--- a/src/mame/drivers/midzeus.c
+++ b/src/mame/drivers/midzeus.c
@@ -531,8 +531,8 @@ static WRITE32_HANDLER( invasn_gun_w )
{ "GUNX1", "GUNY1" },
{ "GUNX2", "GUNY2" }
};
- gun_x[player] = input_port_read(space->machine(), names[player][0]) * (visarea.max_x + 1 - visarea.min_x) / 255 + visarea.min_x + BEAM_XOFFS;
- gun_y[player] = input_port_read(space->machine(), names[player][1]) * (visarea.max_y + 1 - visarea.min_y) / 255 + visarea.min_y;
+ gun_x[player] = input_port_read(space->machine(), names[player][0]) * visarea.width() / 255 + visarea.min_x + BEAM_XOFFS;
+ gun_y[player] = input_port_read(space->machine(), names[player][1]) * visarea.height() / 255 + visarea.min_y;
gun_timer[player]->adjust(space->machine().primary_screen->time_until_pos(MAX(0, gun_y[player] - BEAM_DY), MAX(0, gun_x[player] - BEAM_DX)), player);
}
}
diff --git a/src/mame/drivers/mogura.c b/src/mame/drivers/mogura.c
index 0b70415a7d0..a735263e4bf 100644
--- a/src/mame/drivers/mogura.c
+++ b/src/mame/drivers/mogura.c
@@ -84,18 +84,13 @@ static SCREEN_UPDATE_IND16( mogura )
const rectangle &visarea = screen.visible_area();
/* tilemap layout is a bit strange ... */
- rectangle clip;
- clip.min_x = visarea.min_x;
+ rectangle clip = visarea;
clip.max_x = 256 - 1;
- clip.min_y = visarea.min_y;
- clip.max_y = visarea.max_y;
tilemap_set_scrollx(state->m_tilemap, 0, 256);
tilemap_draw(bitmap, clip, state->m_tilemap, 0, 0);
clip.min_x = 256;
clip.max_x = 512 - 1;
- clip.min_y = visarea.min_y;
- clip.max_y = visarea.max_y;
tilemap_set_scrollx(state->m_tilemap, 0, -128);
tilemap_draw(bitmap, clip, state->m_tilemap, 0, 0);
diff --git a/src/mame/drivers/namcoic.c b/src/mame/drivers/namcoic.c
index 14964993423..4b964350b29 100644
--- a/src/mame/drivers/namcoic.c
+++ b/src/mame/drivers/namcoic.c
@@ -584,15 +584,8 @@ namcos2_draw_sprites_metalhawk(running_machine &machine, bitmap_ind16 &bitmap, c
}
/* Set the clipping rect to mask off the other portion of the sprite */
- rect.min_x=sx;
- rect.max_x=sx+(sizex-1);
- rect.min_y=sy;
- rect.max_y=sy+(sizey-1);
-
- if (cliprect.min_x > rect.min_x) rect.min_x = cliprect.min_x;
- if (cliprect.max_x < rect.max_x) rect.max_x = cliprect.max_x;
- if (cliprect.min_y > rect.min_y) rect.min_y = cliprect.min_y;
- if (cliprect.max_y < rect.max_y) rect.max_y = cliprect.max_y;
+ rect.set(sx, sx+(sizex-1), sy, sy+(sizey-1));
+ rect &= cliprect;
if( !bBigSprite )
{
@@ -604,10 +597,7 @@ namcos2_draw_sprites_metalhawk(running_machine &machine, bitmap_ind16 &bitmap, c
sx -= (tile&1)?16:0;
sy -= (tile&2)?16:0;
- rect.min_x=sx;
- rect.max_x=sx+(sizex-1);
- rect.min_y=sy;
- rect.max_y=sy+(sizey-1);
+ rect.set(sx, sx+(sizex-1), sy, sy+(sizey-1));
rect.min_x += (tile&1)?16:0;
rect.max_x += (tile&1)?16:0;
rect.min_y += (tile&2)?16:0;
@@ -804,14 +794,8 @@ draw_spriteC355(running_machine &machine, _BitmapClass &bitmap, const rectangle
hpos -= xscroll;
vpos -= yscroll;
pWinAttr = &spriteram16[0x2400/2+((palette>>8)&0xf)*4];
- clip.min_x = pWinAttr[0] - xscroll;
- clip.max_x = pWinAttr[1] - xscroll;
- clip.min_y = pWinAttr[2] - yscroll;
- clip.max_y = pWinAttr[3] - yscroll;
- if( clip.min_x < cliprect.min_x ){ clip.min_x = cliprect.min_x; }
- if( clip.min_y < cliprect.min_y ){ clip.min_y = cliprect.min_y; }
- if( clip.max_x > cliprect.max_x ){ clip.max_x = cliprect.max_x; }
- if( clip.max_y > cliprect.max_y ){ clip.max_y = cliprect.max_y; }
+ clip.set(pWinAttr[0] - xscroll, pWinAttr[1] - xscroll, pWinAttr[2] - yscroll, pWinAttr[3] - yscroll);
+ clip &= cliprect;
hpos&=0x7ff; if( hpos&0x400 ) hpos |= ~0x7ff; /* sign extend */
vpos&=0x7ff; if( vpos&0x400 ) vpos |= ~0x7ff; /* sign extend */
@@ -1310,14 +1294,8 @@ DrawRozScanline( bitmap_ind16 &bitmap, int line, int which, int pri, const recta
UnpackRozParam( pSource, &rozInfo );
if( pri == rozInfo.priority )
{
- clip.min_x = 0;
- clip.max_x = bitmap.width()-1;
- clip.min_y = clip.max_y = line;
-
- if( clip.min_x < cliprect.min_x ){ clip.min_x = cliprect.min_x; }
- if( clip.min_y < cliprect.min_y ){ clip.min_y = cliprect.min_y; }
- if( clip.max_x > cliprect.max_x ){ clip.max_x = cliprect.max_x; }
- if( clip.max_y > cliprect.max_y ){ clip.max_y = cliprect.max_y; }
+ clip.set(0, bitmap.width()-1, line, line);
+ clip &= cliprect;
DrawRozHelper( bitmap, mRozTilemap[which], clip, &rozInfo );
} /* priority */
diff --git a/src/mame/drivers/pcxt.c b/src/mame/drivers/pcxt.c
index d78bfb82b82..62fda31692f 100644
--- a/src/mame/drivers/pcxt.c
+++ b/src/mame/drivers/pcxt.c
@@ -120,7 +120,7 @@ static SCREEN_UPDATE_RGB32( tetriskr )
for(pen_i = 0;pen_i<4;pen_i++)
color |= ((bg_rom[y*320/8+x+(pen_i*0x20000)+yi*0x400+state->m_bg_bank*0x2000+1] >> (7-xi)) & 1) << pen_i;
- if((x+xi)<screen.visible_area().max_x && ((y)+yi)<screen.visible_area().max_y)
+ if(cliprect.contains(x*8+xi, y*8+yi))
bitmap.pix32(y*8+yi, x*8+xi) = screen.machine().pens[color];
}
}
diff --git a/src/mame/drivers/peplus.c b/src/mame/drivers/peplus.c
index 035728fad8f..e6b9837334a 100644
--- a/src/mame/drivers/peplus.c
+++ b/src/mame/drivers/peplus.c
@@ -321,8 +321,8 @@ static void handle_lightpen( device_t *device )
const rectangle &vis_area = device->machine().primary_screen->visible_area();
int xt, yt;
- xt = x_val * (vis_area.max_x - vis_area.min_x) / 1024 + vis_area.min_x;
- yt = y_val * (vis_area.max_y - vis_area.min_y) / 1024 + vis_area.min_y;
+ xt = x_val * vis_area.width() / 1024 + vis_area.min_x;
+ yt = y_val * vis_area.height() / 1024 + vis_area.min_y;
device->machine().scheduler().timer_set(device->machine().primary_screen->time_until_pos(yt, xt), FUNC(assert_lp_cb), 0, device);
}
diff --git a/src/mame/drivers/progolf.c b/src/mame/drivers/progolf.c
index 79275c7dc01..0d200c586d7 100644
--- a/src/mame/drivers/progolf.c
+++ b/src/mame/drivers/progolf.c
@@ -127,7 +127,7 @@ static SCREEN_UPDATE_IND16( progolf )
{
color = state->m_fg_fb[(xi+yi*8)+count*0x40];
- if((x+yi) <= cliprect.max_x && (256-y+xi) <= cliprect.max_y && color != 0)
+ if(cliprect.contains(x+yi, 256-y+xi))
bitmap.pix16(x+yi, 256-y+xi) = screen.machine().pens[(color & 0x7)];
}
}
diff --git a/src/mame/drivers/rabbit.c b/src/mame/drivers/rabbit.c
index 7640e8ea5e6..9c1fb2079e9 100644
--- a/src/mame/drivers/rabbit.c
+++ b/src/mame/drivers/rabbit.c
@@ -377,10 +377,7 @@ static VIDEO_START(rabbit)
tilemap_map_pen_to_layer(state->m_tilemap[3], 1, 255, TILEMAP_PIXEL_TRANSPARENT);
state->m_sprite_bitmap = auto_bitmap_ind16_alloc(machine,0x1000,0x1000);
- state->m_sprite_clip.min_x = 0;
- state->m_sprite_clip.max_x = 0x1000-1;
- state->m_sprite_clip.min_y = 0;
- state->m_sprite_clip.max_y = 0x1000-1;
+ state->m_sprite_clip.set(0, 0x1000-1, 0, 0x1000-1);
}
/*
diff --git a/src/mame/drivers/sfbonus.c b/src/mame/drivers/sfbonus.c
index 7fe98e6465a..c574fd265fb 100644
--- a/src/mame/drivers/sfbonus.c
+++ b/src/mame/drivers/sfbonus.c
@@ -830,10 +830,7 @@ static void sfbonus_draw_reel_layer(screen_device &screen, bitmap_ind16 &bitmap,
//printf("%04x %04x %d\n",zz, xxxscroll, line/8);
/* draw top of screen */
- clip.min_x = visarea.min_x;
- clip.max_x = 511;
- clip.min_y = startclipmin;
- clip.max_y = startclipmin;
+ clip.set(visarea.min_x, 511, startclipmin, startclipmin);
diff --git a/src/mame/drivers/srmp5.c b/src/mame/drivers/srmp5.c
index 23edbb54596..90cea6a8c16 100644
--- a/src/mame/drivers/srmp5.c
+++ b/src/mame/drivers/srmp5.c
@@ -92,7 +92,6 @@ static SCREEN_UPDATE_RGB32( srmp5 )
UINT16 *sprite_list=state->m_sprram;
UINT16 *sprite_list_end=&state->m_sprram[0x4000]; //guess
UINT8 *pixels=(UINT8 *)state->m_tileram;
- const rectangle &visarea = screen.visible_area();
//Table surface seems to be tiles, but display corrupts when switching the scene if always ON.
//Currently the tiles are OFF.
@@ -168,7 +167,7 @@ static SCREEN_UPDATE_RGB32( srmp5 )
xs2 = (sprite_sublist[SPRITE_PALETTE] & 0x8000) ? (sizex - xs) : xs;
if(pen)
{
- if(xb+xs2<=visarea.max_x && xb+xs2>=visarea.min_x && yb+ys2<=visarea.max_y && yb+ys2>=visarea.min_y )
+ if(cliprect.contains(xb+xs2, yb+ys2))
{
UINT16 pixdata=state->m_palram[pen+((sprite_sublist[SPRITE_PALETTE]&0xff)<<8)];
bitmap.pix32(yb+ys2, xb+xs2) = ((pixdata&0x7c00)>>7) | ((pixdata&0x3e0)<<6) | ((pixdata&0x1f)<<19);
diff --git a/src/mame/drivers/taitowlf.c b/src/mame/drivers/taitowlf.c
index 838fd420010..b287b405ae2 100644
--- a/src/mame/drivers/taitowlf.c
+++ b/src/mame/drivers/taitowlf.c
@@ -80,7 +80,7 @@ static SCREEN_UPDATE_RGB32( taitowlf )
color = (blit_ram[count] & 0xff);
- if((x)+0<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y)
+ if(cliprect.contains(x+0, y))
bitmap.pix32(y, x+0) = screen.machine().pens[color];
count++;
diff --git a/src/mame/drivers/tickee.c b/src/mame/drivers/tickee.c
index 1c90be35307..4b8dc70000a 100644
--- a/src/mame/drivers/tickee.c
+++ b/src/mame/drivers/tickee.c
@@ -60,8 +60,8 @@ INLINE void get_crosshair_xy(running_machine &machine, int player, int *x, int *
{
const rectangle &visarea = machine.primary_screen->visible_area();
- *x = (((input_port_read(machine, player ? "GUNX2" : "GUNX1") & 0xff) * (visarea.max_x - visarea.min_x)) >> 8) + visarea.min_x;
- *y = (((input_port_read(machine, player ? "GUNY2" : "GUNY1") & 0xff) * (visarea.max_y - visarea.min_y)) >> 8) + visarea.min_y;
+ *x = (((input_port_read(machine, player ? "GUNX2" : "GUNX1") & 0xff) * visarea.width()) >> 8) + visarea.min_x;
+ *y = (((input_port_read(machine, player ? "GUNY2" : "GUNY1") & 0xff) * visarea.height()) >> 8) + visarea.min_y;
}
diff --git a/src/mame/drivers/tmmjprd.c b/src/mame/drivers/tmmjprd.c
index cc7cb0f291a..40be0f3dc0e 100644
--- a/src/mame/drivers/tmmjprd.c
+++ b/src/mame/drivers/tmmjprd.c
@@ -192,7 +192,7 @@ static void ttmjprd_draw_tile(running_machine &machine, bitmap_ind16 &bitmap, co
if (!depth)
{
- if ((drawx < cliprect.max_x) && (drawx > cliprect.min_x) && (drawy < cliprect.max_y) && (drawy > cliprect.min_y))
+ if (cliprect.contains(drawx, drawy))
{
dat = (rom[(tileaddr*32)+count] & 0xf0)>>4;
if (dat!=15)
@@ -203,7 +203,7 @@ static void ttmjprd_draw_tile(running_machine &machine, bitmap_ind16 &bitmap, co
}
}
drawx++;
- if ((drawx < cliprect.max_x) && (drawx > cliprect.min_x) && (drawy < cliprect.max_y) && (drawy > cliprect.min_y))
+ if (cliprect.contains(drawx, drawy))
{
dat = (rom[(tileaddr*32)+count] & 0x0f);
if (dat!=15)
@@ -218,7 +218,7 @@ static void ttmjprd_draw_tile(running_machine &machine, bitmap_ind16 &bitmap, co
}
else
{
- if ((drawx < cliprect.max_x) && (drawx > cliprect.min_x) && (drawy < cliprect.max_y) && (drawy > cliprect.min_y))
+ if (cliprect.contains(drawx, drawy))
{
dat = (rom[(tileaddr*32)+count] & 0xff);
if (dat!=255)
diff --git a/src/mame/machine/megadriv.c b/src/mame/machine/megadriv.c
index e6eaa5aacd4..c1ab95fa3fa 100644
--- a/src/mame/machine/megadriv.c
+++ b/src/mame/machine/megadriv.c
@@ -9483,10 +9483,7 @@ int megadrive_z80irq_hpos = 320;
}
// mame_printf_debug("my mode %02x", megadrive_vdp_register[0x0c]);
- visarea.min_x = 0;
- visarea.max_x = scr_width-1;
- visarea.min_y = 0;
- visarea.max_y = megadrive_visible_scanlines-1;
+ visarea.set(0, scr_width-1, 0, megadrive_visible_scanlines-1);
screen.machine().primary_screen->configure(scr_width, megadrive_visible_scanlines, visarea, HZ_TO_ATTOSECONDS(megadriv_framerate));
diff --git a/src/mame/machine/segamsys.c b/src/mame/machine/segamsys.c
index fbcbe640462..3f2163a76ad 100644
--- a/src/mame/machine/segamsys.c
+++ b/src/mame/machine/segamsys.c
@@ -1150,23 +1150,14 @@ static void end_of_frame(running_machine &machine, struct sms_vdp *chip)
if (chip->vdp_type!=GG_VDP) /* In GG mode the Game Gear resolution is fixed */
{
- rectangle visarea;
-
- visarea.min_x = 0;
- visarea.max_x = 256-1;
- visarea.min_y = 0;
- visarea.max_y = sms_mode_table[chip->screen_mode].sms2_height-1;
+ rectangle visarea(0, 256-1, 0, sms_mode_table[chip->screen_mode].sms2_height-1);
if (chip->chip_id==3) machine.primary_screen->configure(256, 256, visarea, HZ_TO_ATTOSECONDS(chip->sms_framerate));
}
else /* 160x144 */
{
- rectangle visarea;
- visarea.min_x = (256-160)/2;
- visarea.max_x = (256-160)/2+160-1;
- visarea.min_y = (192-144)/2;
- visarea.max_y = (192-144)/2+144-1;
+ rectangle visarea((256-160)/2, (256-160)/2+160-1, (192-144)/2, (192-144)/2+144-1);
machine.primary_screen->configure(256, 256, visarea, HZ_TO_ATTOSECONDS(chip->sms_framerate));
}
diff --git a/src/mame/video/angelkds.c b/src/mame/video/angelkds.c
index 9656436f639..222aae91228 100644
--- a/src/mame/video/angelkds.c
+++ b/src/mame/video/angelkds.c
@@ -281,10 +281,7 @@ SCREEN_UPDATE_IND16( angelkds )
bitmap.fill(0x3f, cliprect); /* is there a register controling the colour?, we currently use the last colour of the tx palette */
/* draw top of screen */
- clip.min_x = 8*0;
- clip.max_x = 8*16-1;
- clip.min_y = visarea.min_y;
- clip.max_y = visarea.max_y;
+ clip.set(8*0, 8*16-1, visarea.min_y, visarea.max_y);
if ((state->m_layer_ctrl & 0x80) == 0x00)
tilemap_draw(bitmap, clip, state->m_bgtop_tilemap, 0, 0);
@@ -295,10 +292,7 @@ SCREEN_UPDATE_IND16( angelkds )
tilemap_draw(bitmap, clip, state->m_tx_tilemap, 0, 0);
/* draw bottom of screen */
- clip.min_x = 8*16;
- clip.max_x = 8*32-1;
- clip.min_y = visarea.min_y;
- clip.max_y = visarea.max_y;
+ clip.set(8*16, 8*32-1, visarea.min_y, visarea.max_y);
if ((state->m_layer_ctrl & 0x40) == 0x00)
tilemap_draw(bitmap, clip, state->m_bgbot_tilemap, 0, 0);
diff --git a/src/mame/video/archimds.c b/src/mame/video/archimds.c
index 1a5a4f976cd..8b436ce1e83 100644
--- a/src/mame/video/archimds.c
+++ b/src/mame/video/archimds.c
@@ -64,20 +64,14 @@ SCREEN_UPDATE_RGB32( archimds_vidc )
if(vidc_interlace)
{
- if ((res_x) >= 0 &&
- (res_y) >= 0 &&
- (res_x) <= screen.visible_area().max_x && (res_y) <= screen.visible_area().max_y && (res_x) <= xend && (res_y) <= yend)
+ if (cliprect.contains(res_x, res_y) && (res_x) <= xend && (res_y) <= yend)
bitmap.pix32(res_y, res_x) = screen.machine().pens[(pen>>(xi))&0x1];
- if ((res_x) >= 0 &&
- (res_y) >= 0 &&
- (res_x) <= screen.visible_area().max_x && (res_y+1) <= screen.visible_area().max_y && (res_x) <= xend && (res_y+1) <= yend)
+ if (cliprect.contains(res_x, res_y+1) && (res_x) <= xend && (res_y+1) <= yend)
bitmap.pix32(res_y+1, res_x) = screen.machine().pens[(pen>>(xi))&0x1];
}
else
{
- if ((res_x) >= 0 &&
- (res_y) >= 0 &&
- (res_x) <= screen.visible_area().max_x && (res_y) <= screen.visible_area().max_y && (res_x) <= xend && (res_y) <= yend)
+ if (cliprect.contains(res_x, res_y) && (res_x) <= xend && (res_y) <= yend)
bitmap.pix32(res_y, res_x) = screen.machine().pens[(pen>>(xi))&0x1];
}
}
@@ -100,20 +94,14 @@ SCREEN_UPDATE_RGB32( archimds_vidc )
if(vidc_interlace)
{
- if ((res_x) >= 0 &&
- (res_y) >= 0 &&
- (res_x) <= screen.visible_area().max_x && (res_y) <= screen.visible_area().max_y && (res_x) <= xend && (res_y) <= yend)
+ if (cliprect.contains(res_x, res_y) && (res_x) <= xend && (res_y) <= yend)
bitmap.pix32(res_y, res_x) = screen.machine().pens[(pen&0xff)+0x100];
- if ((res_x) >= 0 &&
- (res_y) >= 0 &&
- (res_x) <= screen.visible_area().max_x && (res_y+1) <= screen.visible_area().max_y && (res_x) <= xend && (res_y+1) <= yend)
+ if (cliprect.contains(res_x, res_y) && (res_x) <= xend && (res_y+1) <= yend)
bitmap.pix32(res_y+1, res_x) = screen.machine().pens[(pen&0xff)+0x100];
}
else
{
- if ((res_x) >= 0 &&
- (res_y) >= 0 &&
- (res_x) <= screen.visible_area().max_x && (res_y) <= screen.visible_area().max_y && (res_x) <= xend && (res_y) <= yend)
+ if (cliprect.contains(res_x, res_y) && (res_x) <= xend && (res_y) <= yend)
bitmap.pix32(res_y, res_x) = screen.machine().pens[(pen&0xff)+0x100];
}
diff --git a/src/mame/video/beathead.c b/src/mame/video/beathead.c
index 35b4b3e389b..c961bc90d50 100644
--- a/src/mame/video/beathead.c
+++ b/src/mame/video/beathead.c
@@ -182,7 +182,7 @@ UINT32 beathead_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap
}
/* then draw it */
- draw_scanline16(bitmap, cliprect.min_x, y, cliprect.max_x - cliprect.min_x + 1, &scanline[cliprect.min_x], NULL);
+ draw_scanline16(bitmap, cliprect.min_x, y, cliprect.width(), &scanline[cliprect.min_x], NULL);
}
return 0;
}
diff --git a/src/mame/video/blockout.c b/src/mame/video/blockout.c
index 89e85487bdd..1420c62663a 100644
--- a/src/mame/video/blockout.c
+++ b/src/mame/video/blockout.c
@@ -77,7 +77,7 @@ static void update_pixels( running_machine &machine, int x, int y )
int color;
const rectangle &visarea = machine.primary_screen->visible_area();
- if (x < visarea.min_x || x > visarea.max_x || y < visarea.min_y || y > visarea.max_y)
+ if (!visarea.contains(x, y))
return;
front = state->m_videoram[y * 256 + x / 2];
diff --git a/src/mame/video/bosco.c b/src/mame/video/bosco.c
index 35cbed8c32b..b61eb2b0ba3 100644
--- a/src/mame/video/bosco.c
+++ b/src/mame/video/bosco.c
@@ -271,7 +271,7 @@ static void draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rec
{
if (flip) x += 20*8;
- if (x >= cliprect.min_x && x <= cliprect.max_x && y >= cliprect.min_y && y <= cliprect.max_y)
+ if (cliprect.contains(x, y))
bitmap.pix16(y, x) = STARS_COLOR_BASE + star_seed_tab[star_cntr].col;
}
}
diff --git a/src/mame/video/canyon.c b/src/mame/video/canyon.c
index e9eb21d14e1..a6974224c0a 100644
--- a/src/mame/video/canyon.c
+++ b/src/mame/video/canyon.c
@@ -65,17 +65,8 @@ static void draw_bombs( running_machine &machine, bitmap_ind16 &bitmap, const re
int sx = 254 - state->m_videoram[0x3d0 + 2 * i + 0x5];
int sy = 246 - state->m_videoram[0x3d0 + 2 * i + 0xc];
- rectangle rect;
-
- rect.min_x = sx;
- rect.min_y = sy;
- rect.max_x = sx + 1;
- rect.max_y = sy + 1;
-
- if (rect.min_x < cliprect.min_x) rect.min_x = cliprect.min_x;
- if (rect.min_y < cliprect.min_y) rect.min_y = cliprect.min_y;
- if (rect.max_x > cliprect.max_x) rect.max_x = cliprect.max_x;
- if (rect.max_y > cliprect.max_y) rect.max_y = cliprect.max_y;
+ rectangle rect(sx, sx + 1, sy, sy + 1);
+ rect &= cliprect;
bitmap.fill(1 + 2 * i, rect);
}
diff --git a/src/mame/video/cchasm.c b/src/mame/video/cchasm.c
index 88f341e5c21..2fd656f48b0 100644
--- a/src/mame/video/cchasm.c
+++ b/src/mame/video/cchasm.c
@@ -124,8 +124,8 @@ VIDEO_START( cchasm )
cchasm_state *state = machine.driver_data<cchasm_state>();
const rectangle &visarea = machine.primary_screen->visible_area();
- state->m_xcenter=((visarea.max_x + visarea.min_x)/2) << 16;
- state->m_ycenter=((visarea.max_y + visarea.min_y)/2) << 16;
+ state->m_xcenter=visarea.xcenter() << 16;
+ state->m_ycenter=visarea.ycenter() << 16;
VIDEO_START_CALL(vector);
}
diff --git a/src/mame/video/cps1.c b/src/mame/video/cps1.c
index a46aa08d433..116dbe4d163 100644
--- a/src/mame/video/cps1.c
+++ b/src/mame/video/cps1.c
@@ -2723,8 +2723,7 @@ static void cps1_render_stars( screen_device &screen, bitmap_ind16 &bitmap, cons
col = ((col & 0xe0) >> 1) + (screen.frame_number() / 16 & 0x0f);
- if (sx >= cliprect.min_x && sx <= cliprect.max_x &&
- sy >= cliprect.min_y && sy <= cliprect.max_y)
+ if (cliprect.contains(sx, sy))
bitmap.pix16(sy, sx) = 0xa00 + col;
}
}
@@ -2749,8 +2748,7 @@ static void cps1_render_stars( screen_device &screen, bitmap_ind16 &bitmap, cons
col = ((col & 0xe0) >> 1) + (screen.frame_number() / 16 & 0x0f);
- if (sx >= cliprect.min_x && sx <= cliprect.max_x &&
- sy >= cliprect.min_y && sy <= cliprect.max_y)
+ if (cliprect.contains(sx, sy))
bitmap.pix16(sy, sx) = 0x800 + col;
}
}
diff --git a/src/mame/video/dc.c b/src/mame/video/dc.c
index 577453a4b7c..31ed87ee107 100644
--- a/src/mame/video/dc.c
+++ b/src/mame/video/dc.c
@@ -1085,8 +1085,6 @@ WRITE64_HANDLER( pvr_ta_w )
{
if ((state_ta.grab[a].ispbase == state->pvrta_regs[PARAM_BASE]) && (state_ta.grab[a].valid == 1) && (state_ta.grab[a].busy == 0))
{
- rectangle clip;
-
state_ta.grab[a].busy = 1;
state_ta.renderselect = a;
state_ta.start_render_received=1;
@@ -1095,10 +1093,7 @@ WRITE64_HANDLER( pvr_ta_w )
state_ta.grab[a].fbwsof1=state->pvrta_regs[FB_W_SOF1];
state_ta.grab[a].fbwsof2=state->pvrta_regs[FB_W_SOF2];
- clip.min_x = 0;
- clip.max_x = 1023;
- clip.min_y = 0;
- clip.max_y = 1023;
+ rectangle clip(0, 1023, 0, 1023);
// we've got a request to draw, so, draw to the accumulation buffer!
// this should really be done for each tile!
diff --git a/src/mame/video/deco32.c b/src/mame/video/deco32.c
index 4bffbc46e88..2ec15bb6766 100644
--- a/src/mame/video/deco32.c
+++ b/src/mame/video/deco32.c
@@ -647,11 +647,7 @@ SCREEN_UPDATE_RGB32( dragngun )
// for now we only draw these 2 layers on the last update call
if (cliprect.max_y == 247)
{
- rectangle clip;
- clip.min_x = cliprect.min_x;
- clip.max_x = cliprect.max_x;
- clip.min_y = 8;
- clip.max_y = 247;
+ rectangle clip(cliprect.min_x, cliprect.max_x, 8, 247);
dragngun_draw_sprites(screen.machine(),bitmap,clip,screen.machine().generic.buffered_spriteram.u32);
deco16ic_tilemap_1_draw(state->m_deco_tilegen1, bitmap, clip, 0, 0);
diff --git a/src/mame/video/deniam.c b/src/mame/video/deniam.c
index dc034ff2931..6ef23b89f8b 100644
--- a/src/mame/video/deniam.c
+++ b/src/mame/video/deniam.c
@@ -269,8 +269,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
{
if (rom[i] & 0x0f)
{
- if (sx + x >= cliprect.min_x && sx + x <= cliprect.max_x &&
- y >= cliprect.min_y && y <= cliprect.max_y)
+ if (cliprect.contains(sx + x, y))
{
if ((machine.priority_bitmap.pix8(y, sx + x) & primask) == 0)
bitmap.pix16(y, sx + x) = color * 16 + (rom[i] & 0x0f);
@@ -289,8 +288,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
{
if (rom[i] & 0xf0)
{
- if (sx + x >= cliprect.min_x && sx + x <= cliprect.max_x &&
- y >= cliprect.min_y && y <= cliprect.max_y)
+ if (cliprect.contains(sx + x, y))
{
if ((machine.priority_bitmap.pix8(y, sx + x) & primask) == 0)
bitmap.pix16(y, sx + x) = color * 16+(rom[i] >> 4);
@@ -313,8 +311,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
{
if (rom[i] & 0xf0)
{
- if (sx + x >= cliprect.min_x && sx + x <= cliprect.max_x &&
- y >= cliprect.min_y && y <= cliprect.max_y)
+ if (cliprect.contains(sx + x, y))
{
if ((machine.priority_bitmap.pix8(y, sx + x) & primask) == 0)
bitmap.pix16(y, sx + x) = color * 16 + (rom[i] >> 4);
@@ -333,8 +330,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
{
if (rom[i] & 0x0f)
{
- if (sx + x >= cliprect.min_x && sx + x <= cliprect.max_x &&
- y >= cliprect.min_y && y <= cliprect.max_y)
+ if (cliprect.contains(sx + x, y))
{
if ((machine.priority_bitmap.pix8(y, sx + x) & primask) == 0)
bitmap.pix16(y, sx + x) = color * 16 + (rom[i] & 0x0f);
diff --git a/src/mame/video/exerion.c b/src/mame/video/exerion.c
index b6ee2abad03..c92c19de200 100644
--- a/src/mame/video/exerion.c
+++ b/src/mame/video/exerion.c
@@ -339,7 +339,7 @@ static void draw_background( running_machine &machine, bitmap_ind16 &bitmap, con
}
/* draw the scanline */
- draw_scanline16(bitmap, cliprect.min_x, y, cliprect.max_x - cliprect.min_x + 1, &scanline[cliprect.min_x], NULL);
+ draw_scanline16(bitmap, cliprect.min_x, y, cliprect.width(), &scanline[cliprect.min_x], NULL);
}
}
diff --git a/src/mame/video/galaga.c b/src/mame/video/galaga.c
index bd5400953da..53252a28627 100644
--- a/src/mame/video/galaga.c
+++ b/src/mame/video/galaga.c
@@ -557,7 +557,7 @@ static void draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rec
x = (star_seed_tab[star_cntr].x + state->m_stars_scrollx) % 256 + x_align;
y = (y_align + star_seed_tab[star_cntr].y + state->m_stars_scrolly) % 256;
- if (x >= cliprect.min_x && x <= cliprect.max_x && y >= cliprect.min_y && y <= cliprect.max_y)
+ if (cliprect.contains(x, y))
bitmap.pix16(y, x) = STARS_COLOR_BASE + star_seed_tab[ star_cntr ].col;
}
diff --git a/src/mame/video/galastrm.c b/src/mame/video/galastrm.c
index f7db405ea3e..545d79b3c2a 100644
--- a/src/mame/video/galastrm.c
+++ b/src/mame/video/galastrm.c
@@ -444,13 +444,9 @@ SCREEN_UPDATE_IND16( galastrm )
UINT8 pivlayer[3];
UINT16 priority;
static const int primasks[4] = {0xfffc, 0xfff0, 0xff00, 0x0};
- rectangle clip;
bitmap_ind8 &priority_bitmap = screen.machine().priority_bitmap;
- clip.min_x = 0;
- clip.min_y = 0;
- clip.max_x = screen.width() -1;
- clip.max_y = screen.height() -1;
+ rectangle clip(0, screen.width() -1, 0, screen.height() -1);
tc0100scn_tilemap_update(tc0100scn);
tc0480scp_tilemap_update(tc0480scp);
diff --git a/src/mame/video/galaxold.c b/src/mame/video/galaxold.c
index 35e1f0c8f4e..acbc2b33639 100644
--- a/src/mame/video/galaxold.c
+++ b/src/mame/video/galaxold.c
@@ -623,7 +623,7 @@ static void theend_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap,
{
x--;
- if ((x >= cliprect.min_x) && (x <= cliprect.max_x) && (y >= cliprect.min_y) && (y <= cliprect.max_y))
+ if (cliprect.contains(x, y))
bitmap.pix16(y, x) = BULLETS_COLOR_BASE;
}
}
@@ -1143,7 +1143,7 @@ static void galaxold_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap
{
x--;
- if ((x >= cliprect.min_x) && (x <= cliprect.max_x) && (y >= cliprect.min_y) && (y <= cliprect.max_y))
+ if (cliprect.contains(x, y))
{
int color;
@@ -1163,7 +1163,7 @@ static void scrambold_draw_bullets(running_machine &machine, bitmap_ind16 &bitma
x = x - 6;
- if ((x >= cliprect.min_x) && (x <= cliprect.max_x) && (y >= cliprect.min_y) && (y <= cliprect.max_y))
+ if (cliprect.contains(x, y))
/* yellow bullets */
bitmap.pix16(y, x) = BULLETS_COLOR_BASE;
}
@@ -1175,7 +1175,7 @@ static void darkplnt_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap
x = x - 6;
- if ((x >= cliprect.min_x) && (x <= cliprect.max_x) && (y >= cliprect.min_y) && (y <= cliprect.max_y))
+ if (cliprect.contains(x, y))
bitmap.pix16(y, x) = 32 + state->m_darkplnt_bullet_color;
}
@@ -1200,7 +1200,7 @@ static void dambustr_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap
x--;
}
- if ((x >= cliprect.min_x) && (x <= cliprect.max_x) && (y >= cliprect.min_y) && (y <= cliprect.max_y))
+ if (cliprect.contains(x, y))
bitmap.pix16(y, x) = color;
}
}
@@ -1377,22 +1377,15 @@ static void dambustr_draw_background(running_machine &machine, bitmap_ind16 &bit
static void dambustr_draw_upper_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
galaxold_state *state = machine.driver_data<galaxold_state>();
- rectangle clip;
if (flip_screen_x_get(machine))
{
- clip.min_x = 254 - state->m_dambustr_bg_split_line;
- clip.max_x = state->m_dambustr_bg_split_line;
- clip.min_y = 0;
- clip.max_y = 255;
+ rectangle clip(254 - state->m_dambustr_bg_split_line, state->m_dambustr_bg_split_line, 0, 255);
copybitmap(bitmap, *state->m_dambustr_tmpbitmap, 0, 0, 0, 0, clip);
}
else
{
- clip.min_x = 0;
- clip.max_x = 254 - state->m_dambustr_bg_split_line;
- clip.min_y = 0;
- clip.max_y = 255;
+ rectangle clip(0, 254 - state->m_dambustr_bg_split_line, 0, 255);
copybitmap(bitmap, *state->m_dambustr_tmpbitmap, 0, 0, 0, 0, clip);
}
}
@@ -1482,7 +1475,7 @@ static void plot_star(galaxold_state *state, bitmap_ind16 &bitmap, int x, int y,
if (state->m_flipscreen_y)
y = 255 - y;
- if ((x >= cliprect.min_x) && (x <= cliprect.max_x) && (y >= cliprect.min_y) && (y <= cliprect.max_y))
+ if (cliprect.contains(x, y))
bitmap.pix16(y, x) = state->m_stars_colors_start + color;
}
diff --git a/src/mame/video/gp9001.c b/src/mame/video/gp9001.c
index 9bd4b26624e..99795765fa8 100644
--- a/src/mame/video/gp9001.c
+++ b/src/mame/video/gp9001.c
@@ -914,7 +914,7 @@ void gp9001vdp_device::draw_sprites( running_machine &machine, bitmap_ind16 &bit
{
int drawxx = xx+sx;
- if (drawxx>=cliprect.min_x && drawxx<=cliprect.max_x && drawyy>=cliprect.min_y && drawyy<=cliprect.max_y)
+ if (cliprect.contains(drawxx, drawyy))
{
UINT8 pix = srcdata[count];
UINT16* dstptr = &bitmap.pix16(drawyy, drawxx);
diff --git a/src/mame/video/grchamp.c b/src/mame/video/grchamp.c
index a6263cfc0f0..2ca4da300a7 100644
--- a/src/mame/video/grchamp.c
+++ b/src/mame/video/grchamp.c
@@ -148,8 +148,7 @@ static int collision_check(running_machine &machine, grchamp_state *state, bitma
if( pixel != sprite_transp ){
sx = x+x0;
sy = y+y0;
- if( (sx >= visarea->min_x) && (sx <= visarea->max_x) &&
- (sy >= visarea->min_y) && (sy <= visarea->max_y) )
+ if(visarea->contains(sx, sy))
{
// Collision check uses only 16 pens!
pixel = bitmap.pix16(sy, sx) % 16;
diff --git a/src/mame/video/groundfx.c b/src/mame/video/groundfx.c
index 16a78166cf3..5cb9873c415 100644
--- a/src/mame/video/groundfx.c
+++ b/src/mame/video/groundfx.c
@@ -10,10 +10,7 @@ VIDEO_START( groundfx )
state->m_spritelist = auto_alloc_array(machine, struct tempsprite, 0x4000);
/* Hack */
- state->m_hack_cliprect.min_x = 69;
- state->m_hack_cliprect.max_x = 250;
- state->m_hack_cliprect.min_y = 24 + 5;
- state->m_hack_cliprect.max_y = 24 + 44;
+ state->m_hack_cliprect.set(69, 250, 24 + 5, 24 + 44);
}
/***************************************************************
diff --git a/src/mame/video/hng64.c b/src/mame/video/hng64.c
index 5658187414f..46e3e329d2b 100644
--- a/src/mame/video/hng64.c
+++ b/src/mame/video/hng64.c
@@ -1110,10 +1110,7 @@ static void hng64_drawtilemap(running_machine& machine, bitmap_rgb32 &bitmap, co
int xinc,yinc;
const rectangle &visarea = machine.primary_screen->visible_area();
- clip.min_x = visarea.min_x;
- clip.max_x = visarea.max_x;
- clip.min_y = visarea.min_y;
- clip.max_y = visarea.max_y;
+ clip = visarea;
if (global_tileregs&0x04000000) // globally selects alt scroll register layout???
{
@@ -1541,7 +1538,7 @@ SCREEN_UPDATE_RGB32( hng64 )
// Blit the color buffer into the primary bitmap
for (y = cliprect.min_y; y <= cliprect.max_y; y++)
{
- UINT32 *src = &state->m_colorBuffer3d[y * (cliprect.max_x-cliprect.min_x)];
+ UINT32 *src = &state->m_colorBuffer3d[y * cliprect.width()];
UINT32 *dst = &bitmap.pix32(y, cliprect.min_x);
for (x = cliprect.min_x; x <= cliprect.max_x; x++)
@@ -1698,8 +1695,8 @@ VIDEO_START( hng64 )
state->m_additive_tilemap_debug = 0;
// 3d Buffer Allocation
- state->m_depthBuffer3d = auto_alloc_array(machine, float, (visarea.max_x)*(visarea.max_y));
- state->m_colorBuffer3d = auto_alloc_array(machine, UINT32, (visarea.max_x)*(visarea.max_y));
+ state->m_depthBuffer3d = auto_alloc_array(machine, float, (visarea.max_x + 1)*(visarea.max_y + 1));
+ state->m_colorBuffer3d = auto_alloc_array(machine, UINT32, (visarea.max_x + 1)*(visarea.max_y + 1));
}
diff --git a/src/mame/video/itech32.c b/src/mame/video/itech32.c
index 230d39e3c30..94bb2905f82 100644
--- a/src/mame/video/itech32.c
+++ b/src/mame/video/itech32.c
@@ -140,12 +140,8 @@ INLINE offs_t compute_safe_address(itech32_state *state, int x, int y)
INLINE void disable_clipping(itech32_state *state)
{
state->m_clip_save = state->m_clip_rect;
-
- state->m_clip_rect.min_x = state->m_clip_rect.min_y = 0;
- state->m_clip_rect.max_x = state->m_clip_rect.max_y = 0xfff;
-
- state->m_scaled_clip_rect.min_x = state->m_scaled_clip_rect.min_y = 0;
- state->m_scaled_clip_rect.max_x = state->m_scaled_clip_rect.max_y = 0xfff << 8;
+ state->m_clip_rect.set(0, 0xfff, 0, 0xfff);
+ state->m_scaled_clip_rect.set(0, 0xfff << 8, 0, 0xfff << 8);
}
INLINE void enable_clipping(itech32_state *state)
@@ -561,8 +557,7 @@ static void draw_raw(itech32_state *state, UINT16 *base, UINT16 color)
/* render all pixels */
sx = startx;
for (x = 0; x < width && sx < state->m_scaled_clip_rect.max_x; x += xsrcstep, sx += xdststep, ty += ystep)
- if (ty >= state->m_scaled_clip_rect.min_y && ty < state->m_scaled_clip_rect.max_y &&
- sx >= state->m_scaled_clip_rect.min_x && sx < state->m_scaled_clip_rect.max_x)
+ if (state->m_scaled_clip_rect.contains(sx, ty))
{
int pixel = rowsrc[x >> 8];
if (pixel != transparent_pen)
@@ -747,8 +742,7 @@ static void draw_raw_drivedge(itech32_state *state, UINT16 *base, UINT16 *zbase,
if (state->m_drivedge_zbuf_control[3] & 0x8000)
{
for (x = 0; x < width && sx < state->m_scaled_clip_rect.max_x; x += xsrcstep, sx += xdststep, ty += ystep)
- if (ty >= state->m_scaled_clip_rect.min_y && ty < state->m_scaled_clip_rect.max_y &&
- sx >= state->m_scaled_clip_rect.min_x && sx < state->m_scaled_clip_rect.max_x)
+ if (state->m_scaled_clip_rect.contains(sx, ty))
{
int pixel = rowsrc[x >> 8];
if (pixel != transparent_pen)
@@ -762,8 +756,7 @@ static void draw_raw_drivedge(itech32_state *state, UINT16 *base, UINT16 *zbase,
else if (state->m_drivedge_zbuf_control[3] & 0x4000)
{
for (x = 0; x < width && sx < state->m_scaled_clip_rect.max_x; x += xsrcstep, sx += xdststep, ty += ystep)
- if (ty >= state->m_scaled_clip_rect.min_y && ty < state->m_scaled_clip_rect.max_y &&
- sx >= state->m_scaled_clip_rect.min_x && sx < state->m_scaled_clip_rect.max_x)
+ if (state->m_scaled_clip_rect.contains(sx, ty))
{
int pixel = rowsrc[x >> 8];
UINT16 *zbuf = &zbase[compute_safe_address(state, sx >> 8, ty >> 8)];
@@ -778,8 +771,7 @@ static void draw_raw_drivedge(itech32_state *state, UINT16 *base, UINT16 *zbase,
else
{
for (x = 0; x < width && sx < state->m_scaled_clip_rect.max_x; x += xsrcstep, sx += xdststep, ty += ystep)
- if (ty >= state->m_scaled_clip_rect.min_y && ty < state->m_scaled_clip_rect.max_y &&
- sx >= state->m_scaled_clip_rect.min_x && sx < state->m_scaled_clip_rect.max_x)
+ if (state->m_scaled_clip_rect.contains(sx, ty))
{
int pixel = rowsrc[x >> 8];
UINT16 *zbuf = &zbase[compute_safe_address(state, sx >> 8, ty >> 8)];
@@ -1457,12 +1449,12 @@ SCREEN_UPDATE_IND16( itech32 )
}
/* draw from the buffer */
- draw_scanline16(bitmap, cliprect.min_x, y, cliprect.max_x - cliprect.min_x + 1, &scanline[cliprect.min_x], NULL);
+ draw_scanline16(bitmap, cliprect.min_x, y, cliprect.width(), &scanline[cliprect.min_x], NULL);
}
/* otherwise, draw directly from VRAM */
else
- draw_scanline16(bitmap, cliprect.min_x, y, cliprect.max_x - cliprect.min_x + 1, &src1[cliprect.min_x], NULL);
+ draw_scanline16(bitmap, cliprect.min_x, y, cliprect.width(), &src1[cliprect.min_x], NULL);
}
return 0;
}
diff --git a/src/mame/video/jaguar.c b/src/mame/video/jaguar.c
index baeeb5d2854..ab9c04fcd49 100644
--- a/src/mame/video/jaguar.c
+++ b/src/mame/video/jaguar.c
@@ -237,8 +237,8 @@ INLINE void get_crosshair_xy(running_machine &machine, int player, int *x, int *
{
const rectangle &visarea = machine.primary_screen->visible_area();
- int width = visarea.max_x + 1 - visarea.min_x;
- int height = visarea.max_y + 1 - visarea.min_y;
+ int width = visarea.width();
+ int height = visarea.height();
/* only 2 lightguns are connected */
*x = visarea.min_x + (((input_port_read(machine, player ? "FAKE2_X" : "FAKE1_X") & 0xff) * width) >> 8);
*y = visarea.min_y + (((input_port_read(machine, player ? "FAKE2_Y" : "FAKE1_Y") & 0xff) * height) >> 8);
@@ -751,11 +751,7 @@ WRITE16_HANDLER( jaguar_tom_regs_w )
/* adjust for the half-lines */
if (hperiod != 0 && vperiod != 0 && hbend < hbstart && vbend < vbstart && hbstart < hperiod)
{
- rectangle visarea;
- visarea.min_x = hbend / 2;
- visarea.max_x = hbstart / 2 - 1;
- visarea.min_y = vbend / 2;
- visarea.max_y = vbstart / 2 - 1;
+ rectangle visarea(hbend / 2, hbstart / 2 - 1, vbend / 2, vbstart / 2 - 1);
space->machine().primary_screen->configure(hperiod / 2, vperiod / 2, visarea, HZ_TO_ATTOSECONDS((double)pixel_clock * 2 / hperiod / vperiod));
}
}
diff --git a/src/mame/video/konamigx.c b/src/mame/video/konamigx.c
index 2bb0ec26aa7..905baeea345 100644
--- a/src/mame/video/konamigx.c
+++ b/src/mame/video/konamigx.c
@@ -90,10 +90,7 @@ void K053936GP_clip_enable(int chip, int status) { K053936_clip_enabled[chip] =
void K053936GP_set_cliprect(int chip, int minx, int maxx, int miny, int maxy)
{
rectangle &cliprect = K053936_cliprect[chip];
- cliprect.min_x = minx;
- cliprect.max_x = maxx;
- cliprect.min_y = miny;
- cliprect.max_y = maxy;
+ cliprect.set(minx, maxx, miny, maxy);
}
INLINE void K053936GP_copyroz32clip( running_machine &machine,
@@ -1056,8 +1053,8 @@ static void gx_wipezbuf(running_machine &machine, int noshadow)
{
const rectangle &visarea = machine.primary_screen->visible_area();
- int w = visarea.max_x - visarea.min_x + 1;
- int h = visarea.max_y - visarea.min_y + 1;
+ int w = visarea.width();
+ int h = visarea.height();
UINT8 *zptr = gx_objzbuf;
int ecx = h;
@@ -1575,7 +1572,7 @@ void konamigx_mixer(running_machine &machine, bitmap_rgb32 &bitmap, const rectan
{
int pixeldouble_output = 0;
const rectangle &visarea = machine.primary_screen->visible_area();
- int width = visarea.max_x - visarea.min_x + 1;
+ int width = visarea.width();
if (width>512) // vsnetscr case
pixeldouble_output = 1;
@@ -2319,10 +2316,7 @@ VIDEO_START(opengolf)
gxtype1_roz_dstbitmap2 = auto_bitmap_ind16_alloc(machine,512,512); // BITMAP_FORMAT_IND16 because we NEED the raw pen data for post-processing
- gxtype1_roz_dstbitmapclip.min_x = 0;
- gxtype1_roz_dstbitmapclip.max_x = 512-1;
- gxtype1_roz_dstbitmapclip.min_y = 0;
- gxtype1_roz_dstbitmapclip.max_y = 512-1;
+ gxtype1_roz_dstbitmapclip.set(0, 512-1, 0, 512-1);
K053936_wraparound_enable(0, 1);
@@ -2360,10 +2354,7 @@ VIDEO_START(racinfrc)
gxtype1_roz_dstbitmap2 = auto_bitmap_ind16_alloc(machine,512,512); // BITMAP_FORMAT_IND16 because we NEED the raw pen data for post-processing
- gxtype1_roz_dstbitmapclip.min_x = 0;
- gxtype1_roz_dstbitmapclip.max_x = 512-1;
- gxtype1_roz_dstbitmapclip.min_y = 0;
- gxtype1_roz_dstbitmapclip.max_y = 512-1;
+ gxtype1_roz_dstbitmapclip.set(0, 512-1, 0, 512-1);
K053936_wraparound_enable(0, 1);
@@ -2447,10 +2438,8 @@ SCREEN_UPDATE_RGB32(konamigx)
{
// we're going to throw half of this away anyway in post-process, so only render what's needed
rectangle temprect;
- temprect.min_x = cliprect.min_x;
+ temprect = cliprect;
temprect.max_x = cliprect.min_x+320;
- temprect.min_y = cliprect.min_y;
- temprect.max_y = cliprect.max_y;
if (konamigx_type3_psac2_actual_bank == 1) K053936_0_zoom_draw(*type3_roz_temp_bitmap, temprect,gx_psac_tilemap_alt, 0,0,0); // soccerss playfield
else K053936_0_zoom_draw(*type3_roz_temp_bitmap, temprect,gx_psac_tilemap, 0,0,0); // soccerss playfield
diff --git a/src/mame/video/lethalj.c b/src/mame/video/lethalj.c
index 1f20f4d06f9..f7f22481246 100644
--- a/src/mame/video/lethalj.c
+++ b/src/mame/video/lethalj.c
@@ -24,8 +24,8 @@ INLINE void get_crosshair_xy(running_machine &machine, int player, int *x, int *
{
static const char *const gunnames[] = { "LIGHT0_X", "LIGHT0_Y", "LIGHT1_X", "LIGHT1_Y" };
const rectangle &visarea = machine.primary_screen->visible_area();
- int width = visarea.max_x + 1 - visarea.min_x;
- int height = visarea.max_y + 1 - visarea.min_y;
+ int width = visarea.width();
+ int height = visarea.height();
*x = ((input_port_read_safe(machine, gunnames[player * 2], 0x00) & 0xff) * width) / 255;
*y = ((input_port_read_safe(machine, gunnames[1 + player * 2], 0x00) & 0xff) * height) / 255;
diff --git a/src/mame/video/lordgun.c b/src/mame/video/lordgun.c
index 12e2e88bb22..1bf2e4a4572 100644
--- a/src/mame/video/lordgun.c
+++ b/src/mame/video/lordgun.c
@@ -211,10 +211,7 @@ void lordgun_update_gun(running_machine &machine, int i)
lorddgun_calc_gun_scr(machine, i);
- if ( (state->m_gun[i].scr_x < visarea.min_x) ||
- (state->m_gun[i].scr_x > visarea.max_x) ||
- (state->m_gun[i].scr_y < visarea.min_y) ||
- (state->m_gun[i].scr_y > visarea.max_y) )
+ if (!visarea.contains(state->m_gun[i].scr_x, state->m_gun[i].scr_y))
state->m_gun[i].hw_x = state->m_gun[i].hw_y = 0;
}
diff --git a/src/mame/video/m107.c b/src/mame/video/m107.c
index f36bbab12c3..117f7be9f48 100644
--- a/src/mame/video/m107.c
+++ b/src/mame/video/m107.c
@@ -319,10 +319,7 @@ static void m107_tilemap_draw(running_machine &machine, bitmap_ind16 &bitmap, co
int line;
rectangle clip;
const rectangle &visarea = machine.primary_screen->visible_area();
- clip.min_x = visarea.min_x;
- clip.max_x = visarea.max_x;
- clip.min_y = visarea.min_y;
- clip.max_y = visarea.max_y;
+ clip = visarea;
if (state->m_control[0x08 + laynum] & 0x02)
{
diff --git a/src/mame/video/mermaid.c b/src/mame/video/mermaid.c
index 6f780de92de..2dca683673e 100644
--- a/src/mame/video/mermaid.c
+++ b/src/mame/video/mermaid.c
@@ -316,14 +316,7 @@ SCREEN_VBLANK( mermaid )
rect.max_x = sx + screen.machine().gfx[1]->width - 1;
rect.max_y = sy + screen.machine().gfx[1]->height - 1;
- if (rect.min_x < visarea.min_x)
- rect.min_x = visarea.min_x;
- if (rect.min_y < visarea.min_y)
- rect.min_y = visarea.min_y;
- if (rect.max_x > visarea.max_x)
- rect.max_x = visarea.max_x;
- if (rect.max_y > visarea.max_y)
- rect.max_y = visarea.max_y;
+ rect &= visarea;
// check collision sprite - background
@@ -426,14 +419,7 @@ SCREEN_VBLANK( mermaid )
rect.max_x = sx + screen.machine().gfx[1]->width - 1;
rect.max_y = sy + screen.machine().gfx[1]->height - 1;
- if (rect.min_x < visarea.min_x)
- rect.min_x = visarea.min_x;
- if (rect.min_y < visarea.min_y)
- rect.min_y = visarea.min_y;
- if (rect.max_x > visarea.max_x)
- rect.max_x = visarea.max_x;
- if (rect.max_y > visarea.max_y)
- rect.max_y = visarea.max_y;
+ rect &= visarea;
// check collision sprite - sprite
@@ -514,15 +500,8 @@ SCREEN_VBLANK( mermaid )
rect.max_x = sx + screen.machine().gfx[1]->width - 1;
rect.max_y = sy + screen.machine().gfx[1]->height - 1;
- if (rect.min_x < visarea.min_x)
- rect.min_x = visarea.min_x;
- if (rect.min_y < visarea.min_y)
- rect.min_y = visarea.min_y;
- if (rect.max_x > visarea.max_x)
- rect.max_x = visarea.max_x;
- if (rect.max_y > visarea.max_y)
- rect.max_y = visarea.max_y;
-
+ rect &= visarea;
+
// check collision sprite - sprite
state->m_helper.fill(0, rect);
diff --git a/src/mame/video/midzeus.c b/src/mame/video/midzeus.c
index beda196b90e..4bad958750f 100644
--- a/src/mame/video/midzeus.c
+++ b/src/mame/video/midzeus.c
@@ -184,13 +184,13 @@ INLINE void *waveram0_ptr_from_texture_addr(UINT32 addr, int width)
INLINE void waveram_plot(int y, int x, UINT16 color)
{
- if (x >= 0 && x <= zeus_cliprect.max_x && y >= 0 && y < zeus_cliprect.max_y)
+ if (zeus_cliprect.contains(x, y))
WAVERAM_WRITEPIX(zeus_renderbase, y, x, color);
}
INLINE void waveram_plot_depth(int y, int x, UINT16 color, UINT16 depth)
{
- if (x >= 0 && x <= zeus_cliprect.max_x && y >= 0 && y < zeus_cliprect.max_y)
+ if (zeus_cliprect.contains(x, y))
{
WAVERAM_WRITEPIX(zeus_renderbase, y, x, color);
WAVERAM_WRITEDEPTH(zeus_renderbase, y, x, depth);
@@ -199,7 +199,7 @@ INLINE void waveram_plot_depth(int y, int x, UINT16 color, UINT16 depth)
INLINE void waveram_plot_check_depth(int y, int x, UINT16 color, UINT16 depth)
{
- if (x >= 0 && x <= zeus_cliprect.max_x && y >= 0 && y < zeus_cliprect.max_y)
+ if (zeus_cliprect.contains(x, y))
{
UINT16 *depthptr = WAVERAM_PTRDEPTH(zeus_renderbase, y, x);
if (depth <= *depthptr)
@@ -213,7 +213,7 @@ INLINE void waveram_plot_check_depth(int y, int x, UINT16 color, UINT16 depth)
#ifdef UNUSED_FUNCTION
INLINE void waveram_plot_check_depth_nowrite(int y, int x, UINT16 color, UINT16 depth)
{
- if (x >= 0 && x <= zeus_cliprect.max_x && y >= 0 && y < zeus_cliprect.max_y)
+ if (zeus_cliprect.contains(x, y))
{
UINT16 *depthptr = WAVERAM_PTRDEPTH(zeus_renderbase, y, x);
if (depth <= *depthptr)
@@ -743,12 +743,8 @@ static void zeus_register_update(running_machine &machine, offs_t offset)
{
int vtotal = zeusbase[0xca] >> 16;
int htotal = zeusbase[0xc6] >> 16;
- rectangle visarea;
- visarea.min_x = zeusbase[0xc6] & 0xffff;
- visarea.max_x = htotal - 3;
- visarea.min_y = 0;
- visarea.max_y = zeusbase[0xc8] & 0xffff;
+ rectangle visarea(zeusbase[0xc6] & 0xffff, htotal - 3, 0, zeusbase[0xc8] & 0xffff);
if (htotal > 0 && vtotal > 0 && visarea.min_x < visarea.max_x && visarea.max_y < vtotal)
{
machine.primary_screen->configure(htotal, vtotal, visarea, HZ_TO_ATTOSECONDS((double)MIDZEUS_VIDEO_CLOCK / 8.0 / (htotal * vtotal)));
diff --git a/src/mame/video/midzeus2.c b/src/mame/video/midzeus2.c
index 06f7f813739..42a87e3bb63 100644
--- a/src/mame/video/midzeus2.c
+++ b/src/mame/video/midzeus2.c
@@ -187,14 +187,14 @@ INLINE void *waveram0_ptr_from_texture_addr(UINT32 addr, int width)
#ifdef UNUSED_FUNCTION
INLINE void waveram_plot(int y, int x, UINT32 color)
{
- if (x >= 0 && x <= zeus_cliprect.max_x && y >= 0 && y < zeus_cliprect.max_y)
+ if (zeus_cliprect.contains(x, y))
WAVERAM_WRITEPIX(zeus_renderbase, y, x, color);
}
#endif
INLINE void waveram_plot_depth(int y, int x, UINT32 color, UINT16 depth)
{
- if (x >= 0 && x <= zeus_cliprect.max_x && y >= 0 && y < zeus_cliprect.max_y)
+ if (zeus_cliprect.contains(x, y))
{
WAVERAM_WRITEPIX(zeus_renderbase, y, x, color);
WAVERAM_WRITEDEPTH(zeus_renderbase, y, x, depth);
@@ -204,7 +204,7 @@ INLINE void waveram_plot_depth(int y, int x, UINT32 color, UINT16 depth)
#ifdef UNUSED_FUNCTION
INLINE void waveram_plot_check_depth(int y, int x, UINT32 color, UINT16 depth)
{
- if (x >= 0 && x <= zeus_cliprect.max_x && y >= 0 && y < zeus_cliprect.max_y)
+ if (zeus_cliprect.contains(x, y))
{
UINT16 *depthptr = WAVERAM_PTRDEPTH(zeus_renderbase, y, x);
if (depth <= *depthptr)
@@ -219,7 +219,7 @@ INLINE void waveram_plot_check_depth(int y, int x, UINT32 color, UINT16 depth)
#ifdef UNUSED_FUNCTION
INLINE void waveram_plot_check_depth_nowrite(int y, int x, UINT32 color, UINT16 depth)
{
- if (x >= 0 && x <= zeus_cliprect.max_x && y >= 0 && y < zeus_cliprect.max_y)
+ if (zeus_cliprect.contains(x, y))
{
UINT16 *depthptr = WAVERAM_PTRDEPTH(zeus_renderbase, y, x);
if (depth <= *depthptr)
@@ -564,12 +564,8 @@ static void zeus_register_update(running_machine &machine, offs_t offset, UINT32
{
int vtotal = zeusbase[0x37] & 0xffff;
int htotal = zeusbase[0x34] >> 16;
- rectangle visarea;
- visarea.min_x = zeusbase[0x33] >> 16;
- visarea.max_x = (zeusbase[0x34] & 0xffff) - 1;
- visarea.min_y = 0;
- visarea.max_y = zeusbase[0x35] & 0xffff;
+ rectangle visarea(zeusbase[0x33] >> 16, (zeusbase[0x34] & 0xffff) - 1, 0, zeusbase[0x35] & 0xffff);
if (htotal > 0 && vtotal > 0 && visarea.min_x < visarea.max_x && visarea.max_y < vtotal)
{
machine.primary_screen->configure(htotal, vtotal, visarea, HZ_TO_ATTOSECONDS((double)MIDZEUS_VIDEO_CLOCK / 4.0 / (htotal * vtotal)));
diff --git a/src/mame/video/model2.c b/src/mame/video/model2.c
index dbc3ba414db..d06ad831646 100644
--- a/src/mame/video/model2.c
+++ b/src/mame/video/model2.c
@@ -928,21 +928,13 @@ static void model2_3d_render( model2_state *state, bitmap_rgb32 &bitmap, triangl
poly_manager *poly = state->m_poly;
poly_extra_data *extra = (poly_extra_data *)poly_get_extra_data(poly);
UINT8 renderer;
- rectangle vp;
/* select renderer based on attributes (bit15 = checker, bit14 = textured, bit13 = transparent */
renderer = (tri->texheader[0] >> 13) & 7;
/* calculate and clip to viewport */
- vp.min_x = tri->viewport[0] - 8;
- vp.max_x = tri->viewport[2] - 8;
- vp.min_y = (384-tri->viewport[3])+90;
- vp.max_y = (384-tri->viewport[1])+90;
-
- if ( vp.min_x < cliprect.min_x ) vp.min_x = cliprect.min_x;
- if ( vp.max_x > cliprect.max_x ) vp.max_x = cliprect.max_x;
- if ( vp.min_y < cliprect.min_y ) vp.min_y = cliprect.min_y;
- if ( vp.max_y > cliprect.max_y ) vp.max_y = cliprect.max_y;
+ rectangle vp(tri->viewport[0] - 8, tri->viewport[2] - 8, (384-tri->viewport[3])+90, (384-tri->viewport[1])+90);
+ vp &= cliprect;
extra->state = state;
extra->lumabase = ((tri->texheader[1] & 0xFF) << 7) + ((tri->luma >> 5) ^ 0x7);
@@ -2712,8 +2704,8 @@ VIDEO_START(model2)
{
model2_state *state = machine.driver_data<model2_state>();
const rectangle &visarea = machine.primary_screen->visible_area();
- int width = visarea.max_x - visarea.min_x;
- int height = visarea.max_y - visarea.min_y;
+ int width = visarea.width();
+ int height = visarea.height();
state->m_sys24_bitmap.allocate(width, height+4);
diff --git a/src/mame/video/model3.c b/src/mame/video/model3.c
index 60b429d0c16..0b19f5de9ee 100644
--- a/src/mame/video/model3.c
+++ b/src/mame/video/model3.c
@@ -357,10 +357,7 @@ SCREEN_UPDATE_IND16( model3 )
#endif
state->m_screen_clip = (rectangle*)&cliprect;
- state->m_clip3d.min_x = cliprect.min_x;
- state->m_clip3d.max_x = cliprect.max_x;
- state->m_clip3d.min_y = cliprect.min_y;
- state->m_clip3d.max_y = cliprect.max_y;
+ state->m_clip3d = cliprect;
/* layer disable debug keys */
state->m_tick++;
diff --git a/src/mame/video/namconb1.c b/src/mame/video/namconb1.c
index 5a604e4230f..c348d55a5c5 100644
--- a/src/mame/video/namconb1.c
+++ b/src/mame/video/namconb1.c
@@ -143,10 +143,7 @@ SCREEN_UPDATE_IND16( namconb1 )
clip.min_y = (yclip>>16) - 0x21;
clip.max_y = (yclip&0xffff) - 0x21 - 1;
/* intersect with master clip rectangle */
- if( clip.min_x < cliprect.min_x ){ clip.min_x = cliprect.min_x; }
- if( clip.min_y < cliprect.min_y ){ clip.min_y = cliprect.min_y; }
- if( clip.max_x > cliprect.max_x ){ clip.max_x = cliprect.max_x; }
- if( clip.max_y > cliprect.max_y ){ clip.max_y = cliprect.max_y; }
+ clip &= cliprect;
bitmap.fill(get_black_pen(screen.machine()), cliprect );
@@ -184,10 +181,7 @@ SCREEN_UPDATE_IND16( namconb2 )
clip.min_y = (yclip>>16) - 0x21;
clip.max_y = (yclip&0xffff) - 0x21 - 1;
/* intersect with master clip rectangle */
- if( clip.min_x < cliprect.min_x ){ clip.min_x = cliprect.min_x; }
- if( clip.min_y < cliprect.min_y ){ clip.min_y = cliprect.min_y; }
- if( clip.max_x > cliprect.max_x ){ clip.max_x = cliprect.max_x; }
- if( clip.max_y > cliprect.max_y ){ clip.max_y = cliprect.max_y; }
+ clip &= cliprect;
bitmap.fill(get_black_pen(screen.machine()), cliprect );
diff --git a/src/mame/video/namcos1.c b/src/mame/video/namcos1.c
index 46918510115..900c5183073 100644
--- a/src/mame/video/namcos1.c
+++ b/src/mame/video/namcos1.c
@@ -395,7 +395,7 @@ SCREEN_UPDATE_IND16( namcos1 )
i = ((state->m_cus116[6] << 8) | state->m_cus116[7]) - 0x11 - 1; // max y
if (new_clip.max_y > i) new_clip.max_y = i;
- if (new_clip.max_x < new_clip.min_x || new_clip.max_y < new_clip.min_y)
+ if (new_clip.empty())
return 0;
diff --git a/src/mame/video/namcos22.c b/src/mame/video/namcos22.c
index c9eaadf05e2..bdf3f97758d 100644
--- a/src/mame/video/namcos22.c
+++ b/src/mame/video/namcos22.c
@@ -293,10 +293,7 @@ poly3d_Clip( float vx, float vy, float vw, float vh )
int cy = 240+vy;
mClip.cx = cx;
mClip.cy = cy;
- mClip.scissor.min_x = cx + vw;
- mClip.scissor.max_x = cx - vw;
- mClip.scissor.min_y = cy + vh;
- mClip.scissor.max_y = cy - vh;
+ mClip.scissor.set(cx + vw, cx - vw, cy + vh, cy - vh);
if( mClip.scissor.min_x<0 ) mClip.scissor.min_x = 0;
if( mClip.scissor.max_x>639 ) mClip.scissor.max_x = 639;
if( mClip.scissor.min_y<0 ) mClip.scissor.min_y = 0;
@@ -307,10 +304,7 @@ static void
sprite_Clip( int min_x, int max_x, int min_y, int max_y )
{
// cx/cy not used
- mClip.scissor.min_x = min_x;
- mClip.scissor.max_x = max_x;
- mClip.scissor.min_y = min_y;
- mClip.scissor.max_y = max_y;
+ mClip.scissor.set(min_x, max_x, min_y, max_y);
if( mClip.scissor.min_x<0 ) mClip.scissor.min_x = 0;
if( mClip.scissor.max_x>639 ) mClip.scissor.max_x = 639;
if( mClip.scissor.min_y<0 ) mClip.scissor.min_y = 0;
@@ -322,10 +316,7 @@ poly3d_NoClip( void )
{
mClip.cx = 320;
mClip.cy = 240;
- mClip.scissor.min_x = 0;
- mClip.scissor.max_x = 639;
- mClip.scissor.min_y = 0;
- mClip.scissor.max_y = 479;
+ mClip.scissor.set(0, 639, 0, 479);
}
typedef struct
diff --git a/src/mame/video/pitnrun.c b/src/mame/video/pitnrun.c
index 70eff3b904d..793828cc2eb 100644
--- a/src/mame/video/pitnrun.c
+++ b/src/mame/video/pitnrun.c
@@ -259,17 +259,8 @@ SCREEN_UPDATE_IND16( pitnrun )
if (flip_screen_y_get(screen.machine()))
dy=128-dy;
- myclip.min_x=dx;
- myclip.min_y=dy;
- myclip.max_x=dx+127;
- myclip.max_y=dy+127;
-
-
- if(myclip.min_y<cliprect.min_y)myclip.min_y=cliprect.min_y;
- if(myclip.min_x<cliprect.min_x)myclip.min_x=cliprect.min_x;
-
- if(myclip.max_y>cliprect.max_y)myclip.max_y=cliprect.max_y;
- if(myclip.max_x>cliprect.max_x)myclip.max_x=cliprect.max_x;
+ myclip.set(dx, dx+127, dy, dy+127);
+ myclip &= cliprect;
tilemap_draw(bitmap,myclip,state->m_bg, 0,0);
}
diff --git a/src/mame/video/pk8000.c b/src/mame/video/pk8000.c
index 3685082f511..460f9e41408 100644
--- a/src/mame/video/pk8000.c
+++ b/src/mame/video/pk8000.c
@@ -100,10 +100,7 @@ UINT32 pk8000_video_update(screen_device &screen, bitmap_ind16 &bitmap, const re
int x,y,j,b;
UINT16 offset = (pk8000_video_mode & 0xc0) << 8;
rectangle my_rect;
- my_rect.min_x = 0;
- my_rect.max_x = 256+32-1;
- my_rect.min_y = 0;
- my_rect.max_y = 192+32-1;
+ my_rect.set(0, 256+32-1, 0, 192+32-1);
if (pk8000_video_enable) {
bitmap.fill((pk8000_video_color >> 4) & 0x0f, my_rect);
diff --git a/src/mame/video/policetr.c b/src/mame/video/policetr.c
index aedd6210bd0..7a99df30feb 100644
--- a/src/mame/video/policetr.c
+++ b/src/mame/video/policetr.c
@@ -351,7 +351,7 @@ WRITE32_HANDLER( policetr_palette_data_w )
SCREEN_UPDATE_IND16( policetr )
{
policetr_state *state = screen.machine().driver_data<policetr_state>();
- int width = cliprect.max_x - cliprect.min_x + 1;
+ int width = cliprect.width();
int y;
/* render all the scanlines from the dstbitmap to MAME's bitmap */
diff --git a/src/mame/video/psikyosh.c b/src/mame/video/psikyosh.c
index bd4a9c1b23b..d697e40018c 100644
--- a/src/mame/video/psikyosh.c
+++ b/src/mame/video/psikyosh.c
@@ -342,10 +342,7 @@ static void cache_bitmap(int scanline, psikyosh_state *state, gfx_element *gfx,
{
rectangle cliprect;
- cliprect.min_x = 0;
- cliprect.max_x = state->m_bg_bitmap.width() - 1;
- cliprect.min_y = sy * 16;
- cliprect.max_y = cliprect.min_y + 16 - 1;
+ cliprect.set(0, state->m_bg_bitmap.width() - 1, sy * 16, cliprect.min_y + 16 - 1);
state->m_bg_bitmap.fill(BG_TRANSPEN, cliprect);
int width = size * 16;
@@ -391,8 +388,8 @@ static void draw_bglayerscroll( running_machine &machine, int layer, bitmap_rgb3
int last_bank[32]; // corresponds to bank of bitmap in state->m_bg_bitmap. bg_bitmap is split into 16/32-rows of one-tile high each
for(int ii = 0; ii < 32; ii++) last_bank[ii] = -1;
- int scr_width = (cliprect.max_x-cliprect.min_x + 1);
- int scr_height = (cliprect.max_y-cliprect.min_y + 1);
+ int scr_width = cliprect.width();
+ int scr_height = cliprect.height();
UINT32 *scroll_reg = &state->m_bgram[(linebank * 0x800) / 4 - 0x4000 / 4];
UINT32 *pzab_reg = &state->m_bgram[(linebank * 0x800) / 4 - 0x4000 / 4 + 0x400 / 4]; // pri, zoom, alpha, bank
diff --git a/src/mame/video/psychic5.c b/src/mame/video/psychic5.c
index 41c361ce498..c4d8999a0b9 100644
--- a/src/mame/video/psychic5.c
+++ b/src/mame/video/psychic5.c
@@ -405,7 +405,7 @@ static void draw_background(running_machine &machine, bitmap_rgb32 &bitmap, cons
switch (state->m_bg_clip_mode)
{
case 0: case 4: case 8: case 12: case 16:
- clip.min_x = clip.max_x = clip.min_y = clip.max_y = 0;
+ clip.set(0, 0, 0, 0);
break;
case 1: clip.min_y = state->m_sy1; break;
case 3: clip.max_y = state->m_sy2; break;
@@ -416,17 +416,7 @@ static void draw_background(running_machine &machine, bitmap_rgb32 &bitmap, cons
}
if (flip_screen_get(machine))
- {
- int min_x,max_x,min_y,max_y;
- min_x = 255 - clip.max_x;
- max_x = 255 - clip.min_x;
- min_y = 255 - clip.max_y;
- max_y = 255 - clip.min_y;
- clip.min_x = min_x;
- clip.max_x = max_x;
- clip.min_y = min_y;
- clip.max_y = max_y;
- }
+ clip.set(255 - clip.max_x, 255 - clip.min_x, 255 - clip.max_y, 255 - clip.min_y);
}
tilemap_draw(bitmap, clip, state->m_bg_tilemap, 0, 0);
diff --git a/src/mame/video/rallyx.c b/src/mame/video/rallyx.c
index 0f7bf67b5c9..267d0326246 100644
--- a/src/mame/video/rallyx.c
+++ b/src/mame/video/rallyx.c
@@ -448,8 +448,7 @@ WRITE8_HANDLER( tactcian_starson_w )
static void plot_star( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, int color )
{
- if (y < cliprect.min_y || y > cliprect.max_y ||
- x < cliprect.min_x || x > cliprect.max_x)
+ if (!cliprect.contains(x, y))
return;
if (flip_screen_x_get(machine))
diff --git a/src/mame/video/realbrk.c b/src/mame/video/realbrk.c
index b9b6e9d5047..72d8ea00d7d 100644
--- a/src/mame/video/realbrk.c
+++ b/src/mame/video/realbrk.c
@@ -222,11 +222,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re
int max_x = machine.primary_screen->width();
int max_y = machine.primary_screen->height();
- rectangle spritetile_clip;
- spritetile_clip.min_x = 0;
- spritetile_clip.min_y = 0;
- spritetile_clip.max_x = 31;
- spritetile_clip.max_y = 31;
+ rectangle spritetile_clip(0, 31, 0, 31);
for ( offs = 0x3000/2; offs < 0x3600/2; offs += 2/2 )
{
diff --git a/src/mame/video/redclash.c b/src/mame/video/redclash.c
index 0fcff897ce8..3a1e38141a4 100644
--- a/src/mame/video/redclash.c
+++ b/src/mame/video/redclash.c
@@ -283,8 +283,7 @@ static void draw_bullets( running_machine &machine, bitmap_ind16 &bitmap, const
sx = 240 - sx;
}
- if (sx >= cliprect.min_x && sx <= cliprect.max_x &&
- sy >= cliprect.min_y && sy <= cliprect.max_y)
+ if (cliprect.contains(sx, sy))
bitmap.pix16(sy, sx) = 0x19;
}
}
@@ -396,7 +395,7 @@ void redclash_draw_stars( running_machine &machine, bitmap_ind16 &bitmap, const
else
vcond = yloc & 0x01;
- if (xloc >= cliprect.min_x && xloc <= cliprect.max_x && yloc >= cliprect.min_y && yloc <= cliprect.max_y)
+ if (cliprect.contains(xloc, yloc))
{
if ((hcond ^ vcond) == 0)
{
diff --git a/src/mame/video/sega16sp.c b/src/mame/video/sega16sp.c
index 359f619985e..428b3dc09ca 100644
--- a/src/mame/video/sega16sp.c
+++ b/src/mame/video/sega16sp.c
@@ -1105,7 +1105,7 @@ void segaic16_sprites_yboard_draw(running_machine &machine, device_t *device, bi
/* clear out any scanlines we might be using */
for (y = cliprect.min_y; y <= cliprect.max_y; y++)
if (!(rotatebase[y & ~1] & 0xc000))
- memset(&bitmap.pix16(y, cliprect.min_x), 0xff, (cliprect.max_x - cliprect.min_x + 1) * sizeof(UINT16));
+ memset(&bitmap.pix16(y, cliprect.min_x), 0xff, cliprect.width() * sizeof(UINT16));
/* now scan backwards and render the sprites in order */
for (data = sega16sp->spriteram; !(data[0] & 0x8000) && !visited[next]; data = sega16sp->spriteram + next * 8)
diff --git a/src/mame/video/segaybd.c b/src/mame/video/segaybd.c
index 0030d457db5..8e080be252e 100644
--- a/src/mame/video/segaybd.c
+++ b/src/mame/video/segaybd.c
@@ -52,8 +52,7 @@ SCREEN_UPDATE_IND16( yboard )
}
/* draw the yboard sprites */
- yboard_clip.min_x = yboard_clip.min_y = 0;
- yboard_clip.max_x = yboard_clip.max_y = 511;
+ yboard_clip.set(0, 511, 0, 511);
segaic16_sprites_draw(screen, *state->m_tmp_bitmap, yboard_clip, 1);
/* apply rotation */
diff --git a/src/mame/video/senjyo.c b/src/mame/video/senjyo.c
index 1a4ccf0d0d9..93d2bc619de 100644
--- a/src/mame/video/senjyo.c
+++ b/src/mame/video/senjyo.c
@@ -232,8 +232,7 @@ static void draw_radar(running_machine &machine,bitmap_ind16 &bitmap,const recta
sy = 255 - sy;
}
- if (sy >= cliprect.min_y && sy <= cliprect.max_y &&
- sx >= cliprect.min_x && sx <= cliprect.max_x)
+ if (cliprect.contains(sx, sy))
bitmap.pix16(sy, sx) = offs < 0x200 ? 512 : 513;
}
}
diff --git a/src/mame/video/shangha3.c b/src/mame/video/shangha3.c
index 120410d63f8..cc9288a2d67 100644
--- a/src/mame/video/shangha3.c
+++ b/src/mame/video/shangha3.c
@@ -151,10 +151,7 @@ WRITE16_HANDLER( shangha3_blitter_go_w )
//if (shangha3_ram[offs+11] || shangha3_ram[offs+12])
//logerror("offs %04x: sx %04x sy %04x zoom %04x %04x %04x %04x fx %d fy %d\n",offs,sx,sy,zoomx,shangha3_ram[offs+11]),shangha3_ram[offs+12],zoomy,flipx,flipy);
- myclip.min_x = sx;
- myclip.max_x = sx + sizex;
- myclip.min_y = sy;
- myclip.max_y = sy + sizey;
+ myclip.set(sx, sx + sizex, sy, sy + sizey);
myclip &= rawbitmap.cliprect();
if (shangha3_ram[offs+4] & 0x08) /* tilemap */
diff --git a/src/mame/video/skyraid.c b/src/mame/video/skyraid.c
index 51e91f7ff8a..ac0a32adf48 100644
--- a/src/mame/video/skyraid.c
+++ b/src/mame/video/skyraid.c
@@ -57,12 +57,7 @@ static void draw_terrain(running_machine &machine, bitmap_ind16 &bitmap, const r
int color = val / 32;
int count = val % 32;
- rectangle r;
-
- r.min_y = y;
- r.min_x = x;
- r.max_y = y + 1;
- r.max_x = x + 31 - count;
+ rectangle r(x, x + 31 - count, y, y+ 1);
bitmap.fill(color, r);
diff --git a/src/mame/video/sprint2.c b/src/mame/video/sprint2.c
index 58df3d4707b..0be93d81701 100644
--- a/src/mame/video/sprint2.c
+++ b/src/mame/video/sprint2.c
@@ -172,14 +172,7 @@ SCREEN_VBLANK( sprint2 )
rect.max_x = get_sprite_x(video_ram, i) + screen.machine().gfx[1]->width - 1;
rect.max_y = get_sprite_y(video_ram, i) + screen.machine().gfx[1]->height - 1;
- if (rect.min_x < visarea.min_x)
- rect.min_x = visarea.min_x;
- if (rect.min_y < visarea.min_y)
- rect.min_y = visarea.min_y;
- if (rect.max_x > visarea.max_x)
- rect.max_x = visarea.max_x;
- if (rect.max_y > visarea.max_y)
- rect.max_y = visarea.max_y;
+ rect &= visarea;
/* check for sprite-tilemap collisions */
diff --git a/src/mame/video/ssv.c b/src/mame/video/ssv.c
index 925ae3ed3d5..70ade6f4649 100644
--- a/src/mame/video/ssv.c
+++ b/src/mame/video/ssv.c
@@ -628,10 +628,7 @@ static void draw_row(running_machine &machine, bitmap_ind16 &bitmap, const recta
/* Set up a clipping region for the tilemap slice .. */
- clip.min_x = sx;
- clip.max_x = sx + xnum * 0x10 - 1;
- clip.min_y = sy;
- clip.max_y = sy + ynum * 0x8 - 1;
+ clip.set(sx, sx + xnum * 0x10 - 1, sy, sy + ynum * 0x8 - 1);
/* .. and clip it against the visible screen */
diff --git a/src/mame/video/st0016.c b/src/mame/video/st0016.c
index 4d9650c247e..9460c891751 100644
--- a/src/mame/video/st0016.c
+++ b/src/mame/video/st0016.c
@@ -380,7 +380,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
if (drawxpos > cliprect.max_x)
drawxpos -= 512; // wrap around
- if ((drawxpos >= cliprect.min_x) && (drawxpos <= cliprect.max_x) && (drawypos >= cliprect.min_y) && (drawypos <= cliprect.max_y) )
+ if (cliprect.contains(drawxpos, drawypos))
{
if(st0016_spriteram[offset+5]&0x40)
{
@@ -546,7 +546,7 @@ static void draw_bgmap(running_machine &machine, bitmap_ind16 &bitmap,const rect
if (drawxpos > cliprect.max_x)
drawxpos -= 512; // wrap around
- if ((drawxpos >= cliprect.min_x) && (drawxpos <= cliprect.max_x) && (drawypos >= cliprect.min_y) && (drawypos <= cliprect.max_y) )
+ if (cliprect.contains(drawxpos, drawypos))
{
if(st0016_vregs[j+7]==0x12)
diff --git a/src/mame/video/starcrus.c b/src/mame/video/starcrus.c
index 7bb0d9eb8f7..57e71cd27a6 100644
--- a/src/mame/video/starcrus.c
+++ b/src/mame/video/starcrus.c
@@ -167,12 +167,7 @@ static int collision_check_s1s2(running_machine &machine)
starcrus_state *state = machine.driver_data<starcrus_state>();
int org_x, org_y;
int sx, sy;
- rectangle clip;
-
- clip.min_x=0;
- clip.max_x=15;
- clip.min_y=0;
- clip.max_y=15;
+ rectangle clip(0, 15, 0, 15);
state->m_ship1_vid->fill(0, clip);
state->m_ship2_vid->fill(0, clip);
@@ -215,7 +210,7 @@ static int collision_check_p1p2(running_machine &machine)
starcrus_state *state = machine.driver_data<starcrus_state>();
int org_x, org_y;
int sx, sy;
- rectangle clip;
+ rectangle clip(0, 15, 0, 15);
/* if both are scores, return */
if ( ((state->m_p1_sprite & 0x08) == 0) &&
@@ -224,11 +219,6 @@ static int collision_check_p1p2(running_machine &machine)
return 0;
}
- clip.min_x=0;
- clip.max_x=15;
- clip.min_y=0;
- clip.max_y=15;
-
state->m_proj1_vid->fill(0, clip);
state->m_proj2_vid->fill(0, clip);
@@ -276,7 +266,7 @@ static int collision_check_s1p1p2(running_machine &machine)
starcrus_state *state = machine.driver_data<starcrus_state>();
int org_x, org_y;
int sx, sy;
- rectangle clip;
+ rectangle clip(0, 15, 0, 15);
/* if both are scores, return */
if ( ((state->m_p1_sprite & 0x08) == 0) &&
@@ -285,11 +275,6 @@ static int collision_check_s1p1p2(running_machine &machine)
return 0;
}
- clip.min_x=0;
- clip.max_x=15;
- clip.min_y=0;
- clip.max_y=15;
-
state->m_ship1_vid->fill(0, clip);
state->m_proj1_vid->fill(0, clip);
state->m_proj2_vid->fill(0, clip);
@@ -353,7 +338,7 @@ static int collision_check_s2p1p2(running_machine &machine)
starcrus_state *state = machine.driver_data<starcrus_state>();
int org_x, org_y;
int sx, sy;
- rectangle clip;
+ rectangle clip(0, 15, 0, 15);
/* if both are scores, return */
if ( ((state->m_p1_sprite & 0x08) == 0) &&
@@ -362,11 +347,6 @@ static int collision_check_s2p1p2(running_machine &machine)
return 0;
}
- clip.min_x=0;
- clip.max_x=15;
- clip.min_y=0;
- clip.max_y=15;
-
state->m_ship2_vid->fill(0, clip);
state->m_proj1_vid->fill(0, clip);
state->m_proj2_vid->fill(0, clip);
diff --git a/src/mame/video/stvvdp1.c b/src/mame/video/stvvdp1.c
index 3172727795b..9e6e672e771 100644
--- a/src/mame/video/stvvdp1.c
+++ b/src/mame/video/stvvdp1.c
@@ -2002,18 +2002,12 @@ static void stv_vdp1_process_list(running_machine &machine)
case 0x0008:
if (VDP1_LOG) logerror ("Sprite List Set Command for User Clipping (%d,%d),(%d,%d)\n", stv2_current_sprite.CMDXA, stv2_current_sprite.CMDYA, stv2_current_sprite.CMDXC, stv2_current_sprite.CMDYC);
- state->m_vdp1.user_cliprect.min_x = stv2_current_sprite.CMDXA;
- state->m_vdp1.user_cliprect.min_y = stv2_current_sprite.CMDYA;
- state->m_vdp1.user_cliprect.max_x = stv2_current_sprite.CMDXC;
- state->m_vdp1.user_cliprect.max_y = stv2_current_sprite.CMDYC;
+ state->m_vdp1.user_cliprect.set(stv2_current_sprite.CMDXA, stv2_current_sprite.CMDXC, stv2_current_sprite.CMDYA, stv2_current_sprite.CMDYC);
break;
case 0x0009:
if (VDP1_LOG) logerror ("Sprite List Set Command for System Clipping (0,0),(%d,%d)\n", stv2_current_sprite.CMDXC, stv2_current_sprite.CMDYC);
- state->m_vdp1.system_cliprect.min_x = 0;
- state->m_vdp1.system_cliprect.min_y = 0;
- state->m_vdp1.system_cliprect.max_x = stv2_current_sprite.CMDXC;
- state->m_vdp1.system_cliprect.max_y = stv2_current_sprite.CMDYC;
+ state->m_vdp1.system_cliprect.set(0, stv2_current_sprite.CMDXC, 0, stv2_current_sprite.CMDYC);
break;
case 0x000a:
@@ -2178,13 +2172,9 @@ int stv_vdp1_start ( running_machine &machine )
stv_clear_framebuffer(machine, state->m_vdp1.framebuffer_current_draw);
state->m_vdp1.framebuffer_clear_on_next_frame = 0;
- state->m_vdp1.system_cliprect.min_x = state->m_vdp1.system_cliprect.max_x = 0;
- state->m_vdp1.system_cliprect.min_y = state->m_vdp1.system_cliprect.max_y = 0;
+ state->m_vdp1.system_cliprect.set(0, 0, 0, 0);
/* Kidou Senshi Z Gundam - Zenpen Zeta no Kodou loves to use the user cliprect vars in an undefined state ... */
- state->m_vdp1.user_cliprect.min_x = 0;
- state->m_vdp1.user_cliprect.min_y = 0;
- state->m_vdp1.user_cliprect.max_x = 512;
- state->m_vdp1.user_cliprect.max_y = 256;
+ state->m_vdp1.user_cliprect.set(0, 512, 0, 256);
// save state
state_save_register_global_pointer(machine, state->m_vdp1_regs, 0x020/2);
diff --git a/src/mame/video/stvvdp2.c b/src/mame/video/stvvdp2.c
index 61106fcc318..4a98328b459 100644
--- a/src/mame/video/stvvdp2.c
+++ b/src/mame/video/stvvdp2.c
@@ -4223,11 +4223,7 @@ static void stv_vdp2_check_tilemap(running_machine &machine, bitmap_rgb32 &bitma
saturn_state *state = machine.driver_data<saturn_state>();
// int window_applied = 0;
- rectangle mycliprect;
- mycliprect.min_x = cliprect.min_x;
- mycliprect.max_x = cliprect.max_x;
- mycliprect.min_y = cliprect.min_y;
- mycliprect.max_y = cliprect.max_y;
+ rectangle mycliprect = cliprect;
if ( stv2_current_tilemap.linescroll_enable ||
stv2_current_tilemap.vertical_linescroll_enable ||
@@ -5295,10 +5291,7 @@ static void stv_vdp2_draw_rotation_screen(running_machine &machine, bitmap_rgb32
stv2_current_tilemap.transparency = STV_TRANSPARENCY_ALPHA;
}
- mycliprect.min_x = cliprect.min_x;
- mycliprect.max_x = cliprect.max_x;
- mycliprect.min_y = cliprect.min_y;
- mycliprect.max_y = cliprect.max_y;
+ mycliprect = cliprect;
if ( window_control )
{
@@ -5962,12 +5955,8 @@ void stv_vdp2_dynamic_res_change(running_machine &machine)
{
int vblank_period,hblank_period;
- rectangle visarea = machine.primary_screen->visible_area();
attoseconds_t refresh;;
- visarea.min_x = 0;
- visarea.max_x = horz_res-1;
- visarea.min_y = 0;
- visarea.max_y = vert_res-1;
+ rectangle visarea(0, horz_res-1, 0, vert_res-1);
vblank_period = get_vblank_duration(machine);
hblank_period = get_hblank_duration(machine);
@@ -6362,10 +6351,7 @@ static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const r
(STV_VDP2_SPW0A * 0x10) |
(STV_VDP2_SPW1A * 0x20) |
(STV_VDP2_SPSWA * 0x40);
- mycliprect.min_x = cliprect.min_x;
- mycliprect.max_x = cliprect.max_x;
- mycliprect.min_y = cliprect.min_y;
- mycliprect.max_y = cliprect.max_y;
+ mycliprect = cliprect;
stv_vdp2_apply_window_on_layer(machine,mycliprect);
diff --git a/src/mame/video/suprloco.c b/src/mame/video/suprloco.c
index c5423e6631c..e7ca4a34b09 100644
--- a/src/mame/video/suprloco.c
+++ b/src/mame/video/suprloco.c
@@ -169,13 +169,8 @@ INLINE void draw_pixel(bitmap_ind16 &bitmap,const rectangle &cliprect,int x,int
y = bitmap.height() - y - 1;
}
- if (x < cliprect.min_x ||
- x > cliprect.max_x ||
- y < cliprect.min_y ||
- y > cliprect.max_y)
- return;
-
- bitmap.pix16(y, x) = color;
+ if (cliprect.contains(x, y))
+ bitmap.pix16(y, x) = color;
}
diff --git a/src/mame/video/taitoic.c b/src/mame/video/taitoic.c
index edf56f226e1..2e93491158f 100644
--- a/src/mame/video/taitoic.c
+++ b/src/mame/video/taitoic.c
@@ -506,7 +506,7 @@ INLINE void taitoic_drawscanline( bitmap_ind16 &bitmap, const rectangle &cliprec
{
UINT16 *dsti = &bitmap.pix16(y, x);
UINT8 *dstp = &priority.pix8(y, x);
- int length = cliprect.max_x - cliprect.min_x + 1;
+ int length = cliprect.width();
src += cliprect.min_x;
dsti += cliprect.min_x;
@@ -2352,7 +2352,7 @@ static void tc0100scn_tilemap_draw_fg( device_t *device, bitmap_ind16 &bitmap, c
src_x = (256 - 64 - src_x) & width_mask;
// Col offsets are 'tilemap' space 0-511, and apply to blocks of 8 pixels at once
- for (x = 0; x <= (cliprect.max_x - cliprect.min_x); x++)
+ for (x = 0; x < cliprect.width(); x++)
{
column_offset = tc0100scn->colscroll_ram[(src_x & 0x3ff) / 8];
p = src_bitmap.pix16((src_y - column_offset) & height_mask, src_x);
@@ -3264,7 +3264,7 @@ static void tc0480scp_bg01_draw( device_t *device, bitmap_ind16 &bitmap, const r
int x_index, x_step;
int machine_flip = 0; /* for ROT 180 ? */
- UINT16 screen_width = 512; //cliprect.max_x - cliprect.min_x + 1;
+ UINT16 screen_width = 512; //cliprect.width();
UINT16 min_y = cliprect.min_y;
UINT16 max_y = cliprect.max_y;
@@ -3400,7 +3400,7 @@ static void tc0480scp_bg23_draw( device_t *device, bitmap_ind16 &bitmap, const r
int flipscreen = tc0480scp->pri_reg & 0x40;
int machine_flip = 0; /* for ROT 180 ? */
- UINT16 screen_width = 512; //cliprect.max_x - cliprect.min_x + 1;
+ UINT16 screen_width = 512; //cliprect.width();
UINT16 min_y = cliprect.min_y;
UINT16 max_y = cliprect.max_y;
diff --git a/src/mame/video/tank8.c b/src/mame/video/tank8.c
index a6b7d9c1eb3..b3b1c6cba36 100644
--- a/src/mame/video/tank8.c
+++ b/src/mame/video/tank8.c
@@ -158,26 +158,13 @@ static void draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const r
for (i = 0; i < 8; i++)
{
- rectangle rect;
-
int x = get_x_pos(state, 8 + i);
int y = get_y_pos(state, 8 + i);
x -= 4; /* ? */
- rect.min_x = x;
- rect.min_y = y;
- rect.max_x = rect.min_x + 3;
- rect.max_y = rect.min_y + 4;
-
- if (rect.min_x < cliprect.min_x)
- rect.min_x = cliprect.min_x;
- if (rect.min_y < cliprect.min_y)
- rect.min_y = cliprect.min_y;
- if (rect.max_x > cliprect.max_x)
- rect.max_x = cliprect.max_x;
- if (rect.max_y > cliprect.max_y)
- rect.max_y = cliprect.max_y;
+ rectangle rect(x, x + 3, y, y + 4);
+ rect &= cliprect;
bitmap.fill((i << 1) | 0x01, rect);
}
diff --git a/src/mame/video/taotaido.c b/src/mame/video/taotaido.c
index f12ccc9561c..f92a47bc956 100644
--- a/src/mame/video/taotaido.c
+++ b/src/mame/video/taotaido.c
@@ -208,10 +208,7 @@ SCREEN_UPDATE_IND16(taotaido)
rectangle clip;
const rectangle &visarea = screen.visible_area();
- clip.min_x = visarea.min_x;
- clip.max_x = visarea.max_x;
- clip.min_y = visarea.min_y;
- clip.max_y = visarea.max_y;
+ clip = visarea;
for (line = 0; line < 224;line++)
{
diff --git a/src/mame/video/toaplan1.c b/src/mame/video/toaplan1.c
index 12f00a438fa..79078fa00b8 100644
--- a/src/mame/video/toaplan1.c
+++ b/src/mame/video/toaplan1.c
@@ -1094,9 +1094,9 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
{
const rectangle &visarea = machine.primary_screen->visible_area();
- sx_base = ((visarea.max_x + 1) - visarea.min_x) - (sx_base + 8); /* visarea.x = 320 */
- sy_base = ((visarea.max_y + 1) - visarea.min_y) - (sy_base + 8); /* visarea.y = 240 */
- sy_base += ((visarea.max_y + 1) - ((visarea.max_y + 1) - visarea.min_y)) * 2; /* Horizontal games are offset so adjust by +0x20 */
+ sx_base = visarea.width() - (sx_base + 8); /* visarea.x = 320 */
+ sy_base = visarea.height() - (sy_base + 8); /* visarea.y = 240 */
+ sy_base += ((visarea.max_y + 1) - visarea.height()) * 2; /* Horizontal games are offset so adjust by +0x20 */
}
for (dim_y = 0; dim_y < sprite_sizey; dim_y += 8)
diff --git a/src/mame/video/toaplan2.c b/src/mame/video/toaplan2.c
index ebea3ab08d8..6cce3a9be37 100644
--- a/src/mame/video/toaplan2.c
+++ b/src/mame/video/toaplan2.c
@@ -446,10 +446,7 @@ SCREEN_UPDATE_IND16( batrider )
rectangle clip;
const rectangle &visarea = screen.visible_area();
- clip.min_x = visarea.min_x;
- clip.max_x = visarea.max_x;
- clip.min_y = visarea.min_y;
- clip.max_y = visarea.max_y;
+ clip = visarea;
/* used for 'for use in' and '8ing' screen on bbakraid, raizing on batrider */
for (line = 0; line < 256;line++)
diff --git a/src/mame/video/triplhnt.c b/src/mame/video/triplhnt.c
index 18d5837c6eb..3a319bcf5b8 100644
--- a/src/mame/video/triplhnt.c
+++ b/src/mame/video/triplhnt.c
@@ -59,17 +59,11 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
if (state->m_sprite_zoom)
{
- rect.min_x = hpos - 16;
- rect.min_y = 196 - vpos;
- rect.max_x = rect.min_x + 63;
- rect.max_y = rect.min_y + 63;
+ rect.set(hpos - 16, hpos - 16 + 63, 196 - vpos, 196 - vpos + 63);
}
else
{
- rect.min_x = hpos - 16;
- rect.min_y = 224 - vpos;
- rect.max_x = rect.min_x + 31;
- rect.max_y = rect.min_y + 31;
+ rect.set(hpos - 16, hpos - 16 + 31, 224 - vpos, 224 - vpos + 31);
}
/* render sprite to auxiliary bitmap */
@@ -78,14 +72,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
2 * code + state->m_sprite_bank, 0, code & 8, 0,
rect.min_x, rect.min_y);
- if (rect.min_x < cliprect.min_x)
- rect.min_x = cliprect.min_x;
- if (rect.min_y < cliprect.min_y)
- rect.min_y = cliprect.min_y;
- if (rect.max_x > cliprect.max_x)
- rect.max_x = cliprect.max_x;
- if (rect.max_y > cliprect.max_y)
- rect.max_y = cliprect.max_y;
+ rect &= cliprect;
/* check for collisions and copy sprite */
diff --git a/src/mame/video/vectrex.c b/src/mame/video/vectrex.c
index b6de9b37fe7..56361166f47 100644
--- a/src/mame/video/vectrex.c
+++ b/src/mame/video/vectrex.c
@@ -284,8 +284,8 @@ VIDEO_START(vectrex)
screen_device *screen = machine.first_screen();
const rectangle &visarea = screen->visible_area();
- state->m_x_center=((visarea.max_x - visarea.min_x) / 2) << 16;
- state->m_y_center=((visarea.max_y - visarea.min_y) / 2) << 16;
+ state->m_x_center=(visarea.width() / 2) << 16;
+ state->m_y_center=(visarea.height() / 2) << 16;
state->m_x_max = visarea.max_x << 16;
state->m_y_max = visarea.max_y << 16;
@@ -484,8 +484,8 @@ VIDEO_START(raaspec)
screen_device *screen = machine.first_screen();
const rectangle &visarea = screen->visible_area();
- state->m_x_center=((visarea.max_x - visarea.min_x) / 2) << 16;
- state->m_y_center=((visarea.max_y - visarea.min_y) / 2) << 16;
+ state->m_x_center=(visarea.width() / 2) << 16;
+ state->m_y_center=(visarea.height() / 2) << 16;
state->m_x_max = visarea.max_x << 16;
state->m_y_max = visarea.max_y << 16;
diff --git a/src/mame/video/videopin.c b/src/mame/video/videopin.c
index 6591478fcc5..c2d51a7655b 100644
--- a/src/mame/video/videopin.c
+++ b/src/mame/video/videopin.c
@@ -51,8 +51,6 @@ SCREEN_UPDATE_IND16( videopin )
if (state->m_video_ram[offset] & 0x80) /* ball bit found */
{
- rectangle rect;
-
int x = 8 * col;
int y = 8 * row;
@@ -61,19 +59,8 @@ SCREEN_UPDATE_IND16( videopin )
x += 4; /* account for delayed loading of flip-flop C4 */
- rect.min_x = x;
- rect.min_y = y;
- rect.max_x = x + 15;
- rect.max_y = y + 15;
-
- if (rect.min_x < cliprect.min_x)
- rect.min_x = cliprect.min_x;
- if (rect.min_y < cliprect.min_y)
- rect.min_y = cliprect.min_y;
- if (rect.max_x > cliprect.max_x)
- rect.max_x = cliprect.max_x;
- if (rect.max_y > cliprect.max_y)
- rect.max_y = cliprect.max_y;
+ rectangle rect(x, x + 15, y, y + 15);
+ rect &= cliprect;
x -= state->m_ball_x;
y -= state->m_ball_y;
diff --git a/src/mame/video/warpwarp.c b/src/mame/video/warpwarp.c
index 11d6b277b48..4f10cbd3239 100644
--- a/src/mame/video/warpwarp.c
+++ b/src/mame/video/warpwarp.c
@@ -217,7 +217,7 @@ WRITE8_HANDLER( warpwarp_videoram_w )
INLINE void geebee_plot(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, pen_t pen)
{
- if (x >= cliprect.min_x && x <= cliprect.max_x && y >= cliprect.min_y && y <= cliprect.max_y)
+ if (cliprect.contains(x, y))
bitmap.pix16(y, x) = pen;
}
diff --git a/src/mame/video/wgp.c b/src/mame/video/wgp.c
index 901cb23f892..602233a5aec 100644
--- a/src/mame/video/wgp.c
+++ b/src/mame/video/wgp.c
@@ -538,7 +538,7 @@ static void wgp_piv_layer_draw( running_machine &machine, bitmap_ind16 &bitmap,
int flipscreen = 0; /* n/a */
int machine_flip = 0; /* for ROT 180 ? */
- UINT16 screen_width = cliprect.max_x - cliprect.min_x + 1;
+ UINT16 screen_width = cliprect.width();
UINT16 min_y = cliprect.min_y;
UINT16 max_y = cliprect.max_y;
diff --git a/src/mame/video/xmen.c b/src/mame/video/xmen.c
index 67aa598a0ef..b0decf56b85 100644
--- a/src/mame/video/xmen.c
+++ b/src/mame/video/xmen.c
@@ -154,15 +154,9 @@ SCREEN_VBLANK( xmen6p )
int offset;
// const rectangle *visarea = screen.machine().primary_screen->visible_area();
- // cliprect.min_x = visarea->min_x;
- // cliprect.max_x = visarea->max_x;
- // cliprect.min_y = visarea->min_y;
- // cliprect.max_y = visarea->max_y;
-
- cliprect.min_x = 0;
- cliprect.max_x = 64 * 8 - 1;
- cliprect.min_y = 2 * 8;
- cliprect.max_y = 30 * 8 - 1;
+ // cliprect = *visarea;
+
+ cliprect.set(0, 64 * 8 - 1, 2 * 8, 30 * 8 - 1);
if (screen.machine().primary_screen->frame_number() & 0x01)
diff --git a/src/mame/video/ygv608.c b/src/mame/video/ygv608.c
index 83f8d0227c4..e2ffc8a6d31 100644
--- a/src/mame/video/ygv608.c
+++ b/src/mame/video/ygv608.c
@@ -747,9 +747,7 @@ SCREEN_UPDATE_IND16( ygv608 )
const rectangle &visarea = screen.visible_area();
// clip to the current bitmap
- finalclip.min_x = finalclip.min_y = 0;
- finalclip.max_x = screen.width() - 1;
- finalclip.max_y = screen.height() - 1;
+ finalclip.set(0, screen.width() - 1, 0, screen.height() - 1);
finalclip &= cliprect;
// punt if not initialized
diff --git a/src/mame/video/zac2650.c b/src/mame/video/zac2650.c
index 255f3184a60..90872a19a0f 100644
--- a/src/mame/video/zac2650.c
+++ b/src/mame/video/zac2650.c
@@ -79,15 +79,8 @@ static int SpriteCollision(running_machine &machine, int first,int second)
{
for (y = fy; y < fy + machine.gfx[expand]->height; y++)
{
- if ((x < visarea.min_x) ||
- (x > visarea.max_x) ||
- (y < visarea.min_y) ||
- (y > visarea.max_y))
- {
- continue;
- }
-
- Checksum += state->m_spritebitmap.pix16(y, x);
+ if (visarea.contains(x, y))
+ Checksum += state->m_spritebitmap.pix16(y, x);
}
}
@@ -105,15 +98,8 @@ static int SpriteCollision(running_machine &machine, int first,int second)
{
for (y = fy; y < fy + machine.gfx[expand]->height; y++)
{
- if ((x < visarea.min_x) ||
- (x > visarea.max_x) ||
- (y < visarea.min_y) ||
- (y > visarea.max_y))
- {
- continue;
- }
-
- Checksum -= state->m_spritebitmap.pix16(y, x);
+ if (visarea.contains(x, y))
+ Checksum -= state->m_spritebitmap.pix16(y, x);
}
}
@@ -194,19 +180,12 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
{
for (y = by; y < by + machine.gfx[expand]->height; y++)
{
- if ((x < visarea.min_x) ||
- (x > visarea.max_x) ||
- (y < visarea.min_y) ||
- (y > visarea.max_y))
- {
- continue;
- }
-
- if (bitmap.pix16(y, x) != state->m_bitmap.pix16(y, x))
- {
- state->m_CollisionBackground = 0x80;
- break;
- }
+ if (visarea.contains(x, y))
+ if (bitmap.pix16(y, x) != state->m_bitmap.pix16(y, x))
+ {
+ state->m_CollisionBackground = 0x80;
+ break;
+ }
}
}