Fix several rendering issues with artwork, introduced in the

recent changes.

Also, did a pass through the code to take advantage of new 
methods available on rectangles.
This commit is contained in:
Aaron Giles 2012-01-16 11:06:28 +00:00
parent 051af55fa9
commit 59d84eb1b0
132 changed files with 334 additions and 796 deletions

View File

@ -1120,7 +1120,7 @@ SCREEN_UPDATE_IND16( tms340x0_ind16 )
UINT16 *dest = &bitmap.pix16(cliprect.min_y); UINT16 *dest = &bitmap.pix16(cliprect.min_y);
for (x = cliprect.min_x; x < params.heblnk; x++) for (x = cliprect.min_x; x < params.heblnk; x++)
dest[x] = blackpen; dest[x] = blackpen;
for (x = params.hsblnk; x <= cliprect.max_y; x++) for (x = params.hsblnk; x <= cliprect.max_x; x++)
dest[x] = blackpen; dest[x] = blackpen;
return 0; return 0;
@ -1168,7 +1168,7 @@ SCREEN_UPDATE_RGB32( tms340x0_rgb32 )
UINT32 *dest = &bitmap.pix32(cliprect.min_y); UINT32 *dest = &bitmap.pix32(cliprect.min_y);
for (x = cliprect.min_x; x < params.heblnk; x++) for (x = cliprect.min_x; x < params.heblnk; x++)
dest[x] = blackpen; dest[x] = blackpen;
for (x = params.hsblnk; x <= cliprect.max_y; x++) for (x = params.hsblnk; x <= cliprect.max_x; x++)
dest[x] = blackpen; dest[x] = blackpen;
return 0; return 0;
} }

View File

@ -166,10 +166,7 @@ public:
this->state = flags | VIEW_STATE_NEEDS_UPDATE; this->state = flags | VIEW_STATE_NEEDS_UPDATE;
// initial size // initial size
this->bounds.min_x = 0; this->bounds.set(0, 300, 0, 300);
this->bounds.min_y = 0;
this->bounds.max_x = 300;
this->bounds.max_y = 300;
/* specials */ /* specials */
switch (type) switch (type)
@ -377,7 +374,7 @@ static int dview_xy_in_rect(DView *dv, int type, int x, int y)
rectangle r; rectangle r;
dview_get_rect(dv, type, 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 TRUE;
return FALSE; 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, 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)); 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); sz = (ts * (sb->page_size)) / (sb->upper - sb->lower);
ts = ts - sz; 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, 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)); 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); sz = (ts * (sb->page_size)) / (sb->upper - sb->lower);
ts = ts - sz; ts = ts - sz;

View File

@ -362,10 +362,7 @@ do { \
assert(dest.valid()); \ assert(dest.valid()); \
assert(gfx != NULL); \ assert(gfx != NULL); \
assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \ assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \
assert(cliprect.min_x >= 0); \ assert(dest.cliprect().contains(cliprect)); \
assert(cliprect.max_x < dest.width()); \
assert(cliprect.min_y >= 0); \
assert(cliprect.max_y < dest.height()); \
assert(code < gfx->total_elements); \ assert(code < gfx->total_elements); \
\ \
/* ignore empty/invalid cliprects */ \ /* ignore empty/invalid cliprects */ \
@ -632,10 +629,7 @@ do { \
assert(dest.valid()); \ assert(dest.valid()); \
assert(gfx != NULL); \ assert(gfx != NULL); \
assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \ assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \
assert(cliprect.min_x >= 0); \ assert(dest.cliprect().contains(cliprect)); \
assert(cliprect.max_x < dest.width()); \
assert(cliprect.min_y >= 0); \
assert(cliprect.max_y < dest.height()); \
\ \
/* ignore empty/invalid cliprects */ \ /* ignore empty/invalid cliprects */ \
if (cliprect.empty()) \ if (cliprect.empty()) \
@ -807,10 +801,7 @@ do { \
assert(dest.valid()); \ assert(dest.valid()); \
assert(src.valid()); \ assert(src.valid()); \
assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \ assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \
assert(cliprect.min_x >= 0); \ assert(dest.cliprect().contains(cliprect)); \
assert(cliprect.max_x < dest.width()); \
assert(cliprect.min_y >= 0); \
assert(cliprect.max_y < dest.height()); \
\ \
/* ignore empty/invalid cliprects */ \ /* ignore empty/invalid cliprects */ \
if (cliprect.empty()) \ if (cliprect.empty()) \
@ -981,10 +972,7 @@ do { \
assert(dest.valid()); \ assert(dest.valid()); \
assert(dest.valid()); \ assert(dest.valid()); \
assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \ assert(!PRIORITY_VALID(PRIORITY_TYPE) || priority.valid()); \
assert(cliprect.min_x >= 0); \ assert(dest.cliprect().contains(cliprect)); \
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(!wraparound || (src.width() & (src.width() - 1)) == 0); \
assert(!wraparound || (src.height() & (src.height() - 1)) == 0); \ assert(!wraparound || (src.height() & (src.height() - 1)) == 0); \
\ \
@ -1001,8 +989,8 @@ do { \
starty += cliprect.min_x * incxy + cliprect.min_y * incyy; \ starty += cliprect.min_x * incxy + cliprect.min_y * incyy; \
\ \
/* compute how many blocks of 4 pixels we have */ \ /* compute how many blocks of 4 pixels we have */ \
numblocks = (cliprect.max_x + 1 - cliprect.min_x) / 4; \ numblocks = cliprect.width() / 4; \
leftovers = (cliprect.max_x + 1 - cliprect.min_x) - 4 * numblocks; \ leftovers = cliprect.width() - 4 * numblocks; \
\ \
/* if incxy and incyx are 0, then we aren't rotating, just zooming */ \ /* if incxy and incyx are 0, then we aren't rotating, just zooming */ \
if (incxy == 0 && incyx == 0) \ if (incxy == 0 && incyx == 0) \

View File

@ -681,8 +681,8 @@ void info_xml_creator::output_display()
if (device->screen_type() != SCREEN_TYPE_VECTOR) if (device->screen_type() != SCREEN_TYPE_VECTOR)
{ {
const rectangle &visarea = device->visible_area(); const rectangle &visarea = device->visible_area();
fprintf(m_output, " width=\"%d\"", visarea.max_x - visarea.min_x + 1); fprintf(m_output, " width=\"%d\"", visarea.width());
fprintf(m_output, " height=\"%d\"", visarea.max_y - visarea.min_y + 1); fprintf(m_output, " height=\"%d\"", visarea.height());
} }
// output refresh rate // output refresh rate

View File

@ -937,10 +937,7 @@ static int s3c24xx_lcd_configure_stn( device_t *device)
} }
height = lineval + 1; height = lineval + 1;
s3c24xx->lcd.framerate = framerate; s3c24xx->lcd.framerate = framerate;
visarea.min_x = 0; visarea.set(0, width - 1, 0, height - 1);
visarea.min_y = 0;
visarea.max_x = width - 1;
visarea.max_y = 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, "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); verboselog( device->machine(), 3, "video_screen_configure %d %d %f\n", width, height, s3c24xx->lcd.framerate);
s3c24xx->lcd.hpos_min = 0; s3c24xx->lcd.hpos_min = 0;

View File

@ -366,7 +366,7 @@ render_texture::render_texture()
m_param(NULL), m_param(NULL),
m_curseq(0) 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)); memset(m_scaled, 0, sizeof(m_scaled));
} }
@ -416,7 +416,7 @@ void render_texture::release()
// invalidate references to the original bitmap as well // invalidate references to the original bitmap as well
m_manager->invalidate_all(m_bitmap); m_manager->invalidate_all(m_bitmap);
m_bitmap = NULL; 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_format = TEXFORMAT_ARGB32;
m_curseq = 0; 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 // 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? // is it a size we already have?
scaled_texture *scaled = NULL; scaled_texture *scaled = NULL;
@ -1285,13 +1286,13 @@ void render_target::compute_minimum_size(INT32 &minwidth, INT32 &minheight)
float xscale, yscale; float xscale, yscale;
if (!(orientation_add(m_orientation, screen->container().orientation()) & ORIENTATION_SWAP_XY)) if (!(orientation_add(m_orientation, screen->container().orientation()) & ORIENTATION_SWAP_XY))
{ {
xscale = (float)(visarea.max_x + 1 - visarea.min_x) / (bounds.x1 - bounds.x0); xscale = float(visarea.width()) / bounds.width();
yscale = (float)(visarea.max_y + 1 - visarea.min_y) / (bounds.y1 - bounds.y0); yscale = float(visarea.height()) / bounds.height();
} }
else else
{ {
xscale = (float)(visarea.max_y + 1 - visarea.min_y) / (bounds.x1 - bounds.x0); xscale = float(visarea.height()) / bounds.width();
yscale = (float)(visarea.max_x + 1 - visarea.min_x) / (bounds.y1 - bounds.y0); yscale = float(visarea.width()) / bounds.height();
} }
// pick the greater // pick the greater

View File

@ -190,6 +190,9 @@ struct render_bounds
float y0; // topmost Y coordinate float y0; // topmost Y coordinate
float x1; // rightmost X coordinate float x1; // rightmost X coordinate
float y1; // bottommost Y coordinate float y1; // bottommost Y coordinate
float width() const { return x1 - x0; }
float height() const { return y1 - y0; }
}; };

View File

@ -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 // on entry, assume x0,y0 are the top,left coordinate of the cell and add
// the character bounding box to that position // the character bounding box to that position
float scale = m_scale * height; 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 // compute x1,y1 from there based on the bitmap size
bounds.x1 = bounds.x0 + (float)gl.bmwidth * scale * aspect; bounds.x1 = bounds.x0 + float(gl.bmwidth) * scale * aspect;
bounds.y1 = bounds.y0 + (float)m_height * scale; bounds.y1 = bounds.y0 + float(m_height) * scale;
// return the texture // return the texture
return gl.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 // on entry, assume x0,y0 are the top,left coordinate of the cell and add
// the character bounding box to that position // the character bounding box to that position
float scale = m_scale * height; 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; bounds.min_y = 0;
// compute x1,y1 from there based on the bitmap size // compute x1,y1 from there based on the bitmap size
bounds.max_x = bounds.min_x + (float)gl.bmwidth * scale * aspect; bounds.set_width(float(gl.bmwidth) * scale * aspect);
bounds.max_y = bounds.min_y + (float)m_height * scale; bounds.set_height(float(m_height) * scale);
// if the bitmap isn't big enough, bail // 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; return;
// if no texture, fill the target // 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 // 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); 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) 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; totwidth += get_char(*ptr).width;
// scale the final result based on height // 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 // scale the final result based on height
return (float)totwidth * m_scale * height * aspect; return float(totwidth) * m_scale * height * aspect;
} }

View File

@ -211,8 +211,8 @@ static int get_variable_value(running_machine &machine, const char *string, char
sprintf(temp, "~scr%dnativexaspect~", scrnum); sprintf(temp, "~scr%dnativexaspect~", scrnum);
if (!strncmp(string, temp, strlen(temp))) if (!strncmp(string, temp, strlen(temp)))
{ {
int num = device->visible_area().max_x + 1 - device->visible_area().min_x; int num = device->visible_area().width();
int den = device->visible_area().max_y + 1 - device->visible_area().min_y; int den = device->visible_area().height();
reduce_fraction(num, den); reduce_fraction(num, den);
*outputptr += sprintf(*outputptr, "%d", num); *outputptr += sprintf(*outputptr, "%d", num);
return strlen(temp); return strlen(temp);
@ -222,8 +222,8 @@ static int get_variable_value(running_machine &machine, const char *string, char
sprintf(temp, "~scr%dnativeyaspect~", scrnum); sprintf(temp, "~scr%dnativeyaspect~", scrnum);
if (!strncmp(string, temp, strlen(temp))) if (!strncmp(string, temp, strlen(temp)))
{ {
int num = device->visible_area().max_x + 1 - device->visible_area().min_x; int num = device->visible_area().width();
int den = device->visible_area().max_y + 1 - device->visible_area().min_y; int den = device->visible_area().height();
reduce_fraction(num, den); reduce_fraction(num, den);
*outputptr += sprintf(*outputptr, "%d", den); *outputptr += sprintf(*outputptr, "%d", den);
return strlen(temp); return strlen(temp);
@ -233,7 +233,7 @@ static int get_variable_value(running_machine &machine, const char *string, char
sprintf(temp, "~scr%dwidth~", scrnum); sprintf(temp, "~scr%dwidth~", scrnum);
if (!strncmp(string, temp, strlen(temp))) 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); return strlen(temp);
} }
@ -241,7 +241,7 @@ static int get_variable_value(running_machine &machine, const char *string, char
sprintf(temp, "~scr%dheight~", scrnum); sprintf(temp, "~scr%dheight~", scrnum);
if (!strncmp(string, temp, strlen(temp))) 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); 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; UINT32 inva = (1.0f - m_color.a) * 255.0;
// iterate over X and Y // iterate over X and Y
for (UINT32 y = bounds.min_y; y < bounds.max_y; 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 x = bounds.min_x; x <= bounds.max_x; x++)
{ {
UINT32 finalr = r; UINT32 finalr = r;
UINT32 finalg = g; 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; UINT32 inva = (1.0f - m_color.a) * 255.0;
// find the center // find the center
float xcenter = (float)(bounds.min_x + bounds.max_x) * 0.5f; float xcenter = float(bounds.xcenter()) * 0.5f;
float ycenter = (float)(bounds.min_y + bounds.max_y) * 0.5f; float ycenter = float(bounds.ycenter()) * 0.5f;
float xradius = (float)(bounds.max_x - bounds.min_x) * 0.5f; float xradius = float(bounds.width()) * 0.5f;
float yradius = (float)(bounds.max_y - bounds.min_y) * 0.5f; float yradius = float(bounds.height()) * 0.5f;
float ooyradius2 = 1.0f / (yradius * yradius); float ooyradius2 = 1.0f / (yradius * yradius);
// iterate over y // 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 ycoord = ycenter - ((float)y + 0.5f);
float xval = xradius * sqrt(1.0f - (ycoord * ycoord) * ooyradius2); 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; INT32 width;
while (1) while (1)
{ {
width = font->string_width(bounds.max_y - bounds.min_y, aspect, m_string); width = font->string_width(bounds.height(), aspect, m_string);
if (width < bounds.max_x - bounds.min_x) if (width < bounds.width())
break; break;
aspect *= 0.9f; 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 // allocate a temporary bitmap
bitmap_argb32 tempbitmap(dest.width(), dest.height()); 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 // get the font bitmap
rectangle chbounds; 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 // 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; int effy = bounds.min_y + y;
if (effy >= bounds.min_y && effy <= bounds.max_y) if (effy >= bounds.min_y && effy <= bounds.max_y)
{ {
UINT32 *src = &tempbitmap.pix32(y); UINT32 *src = &tempbitmap.pix32(y);
UINT32 *d = &dest.pix32(effy); 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; int effx = curx + x + chbounds.min_x;
if (effx >= bounds.min_x && effx <= bounds.max_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 // 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 // free the temporary bitmap and font

View File

@ -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_vblank = screen.m_refresh / vtotal * (vtotal - (vbstart - vbend));
screen.m_width = htotal; screen.m_width = htotal;
screen.m_height = vtotal; screen.m_height = vtotal;
screen.m_visarea.min_x = hbend; screen.m_visarea.set(hbend, hbstart - 1, vbend, vbstart - 1);
screen.m_visarea.max_x = hbstart - 1;
screen.m_visarea.min_y = vbend;
screen.m_visarea.max_y = vbstart - 1;
} }
@ -261,10 +258,7 @@ bool screen_device::device_validity_check(emu_options &options, const game_drive
// sanity check display area // sanity check display area
if (m_type != SCREEN_TYPE_VECTOR) if (m_type != SCREEN_TYPE_VECTOR)
{ {
if ((m_visarea.max_x < m_visarea.min_x) || if (m_visarea.empty() || m_visarea.max_x >= m_width || m_visarea.max_y >= m_height)
(m_visarea.max_y < m_visarea.min_y) ||
(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()); mame_printf_error("%s: %s screen '%s' has an invalid display area\n", driver.source_file, driver.name, tag());
error = true; 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 // 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 // from the visible area, otherwise just used the supplied value
if (m_vblank == 0 && !m_oldstyle_vblank_supplied) 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 else
m_vblank_period = m_vblank; 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; scaledvis.max_y = m_visarea.max_y * m_burnin.height() / m_height;
// wrap a bitmap around the subregion we care about // 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 srcwidth = m_burnin.width();
int srcheight = m_burnin.height(); int srcheight = m_burnin.height();
int dstwidth = finalmap.width(); int dstwidth = finalmap.width();

View File

@ -168,6 +168,7 @@ public:
int width() const { return m_width; } int width() const { return m_width; }
int height() const { return m_height; } int height() const { return m_height; }
const rectangle &visible_area() const { return m_visarea; } 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; } bool oldstyle_vblank_supplied() const { return m_oldstyle_vblank_supplied; }
attoseconds_t refresh_attoseconds() const { return m_refresh; } attoseconds_t refresh_attoseconds() const { return m_refresh; }
attoseconds_t vblank_attoseconds() const { return m_vblank; } attoseconds_t vblank_attoseconds() const { return m_vblank; }

View File

@ -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 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 pmemsize = get_pmemsize(cols, rows);
UINT16 addr = m_hma; UINT16 addr = m_hma;

View File

@ -1110,8 +1110,7 @@ astring &game_info_astring(running_machine &machine, astring &string)
const rectangle &visarea = screen->visible_area(); const rectangle &visarea = screen->visible_area();
string.catprintf("%d " UTF8_MULTIPLY " %d (%s) %f" UTF8_NBSP "Hz\n", string.catprintf("%d " UTF8_MULTIPLY " %d (%s) %f" UTF8_NBSP "Hz\n",
visarea.max_x - visarea.min_x + 1, visarea.width(), visarea.height(),
visarea.max_y - visarea.min_y + 1,
(machine.system().flags & ORIENTATION_SWAP_XY) ? "V" : "H", (machine.system().flags & ORIENTATION_SWAP_XY) ? "V" : "H",
ATTOSECONDS_TO_HZ(screen->frame_period().attoseconds)); ATTOSECONDS_TO_HZ(screen->frame_period().attoseconds));
} }

View File

@ -717,10 +717,7 @@ static void gfxset_update_bitmap(running_machine &machine, ui_gfx_state *state,
rectangle cellbounds; rectangle cellbounds;
/* make a rect that covers this row */ /* make a rect that covers this row */
cellbounds.min_x = 0; cellbounds.set(0, state->bitmap->width() - 1, y * cellypix, (y + 1) * cellypix - 1);
cellbounds.max_x = state->bitmap->width() - 1;
cellbounds.min_y = y * cellypix;
cellbounds.max_y = (y + 1) * cellypix - 1;
/* only display if there is data to show */ /* only display if there is data to show */
if (state->gfxset.offset[set] + y * xcells < gfx->total_elements) if (state->gfxset.offset[set] + y * xcells < gfx->total_elements)

View File

@ -420,11 +420,7 @@ inline void crt9007_device::recompute_parameters()
// visible area // visible area
rectangle visarea; rectangle visarea;
visarea.min_x = m_hsync_end; visarea.set(m_hsync_end, horiz_pix_total - 1, m_vsync_end, vert_pix_total - 1);
visarea.max_x = horiz_pix_total - 1;
visarea.min_y = m_vsync_end;
visarea.max_y = vert_pix_total - 1;
if (LOG) if (LOG)
{ {

View File

@ -284,7 +284,7 @@ UINT32 hd44102_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap
int sy = m_sy + z; int sy = m_sy + z;
int sx = m_sx + y; 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); int color = (m_status & STATUS_DISPLAY_OFF) ? 0 : BIT(data, z % 8);

View File

@ -201,10 +201,7 @@ static void i8275_recompute_parameters(device_t *device)
vert_pix_total *= 2; // Use of spaced rows vert_pix_total *= 2; // Use of spaced rows
} }
visarea.min_x = 0; visarea.set(0, horiz_pix_total - 1, 0, vert_pix_total - 1);
visarea.min_y = 0;
visarea.max_x = horiz_pix_total - 1;
visarea.max_y = vert_pix_total - 1;
i8275->screen->configure(horiz_pix_total, vert_pix_total, visarea, i8275->screen->configure(horiz_pix_total, vert_pix_total, visarea,
i8275->screen->frame_period().attoseconds); i8275->screen->frame_period().attoseconds);

View File

@ -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; attoseconds_t refresh = HZ_TO_ATTOSECONDS(m_clock) * (m_horiz_char_total + 1) * vert_pix_total;
visarea.min_x = 0; visarea.set(0, max_visible_x, 0, max_visible_y);
visarea.min_y = 0;
visarea.max_x = max_visible_x;
visarea.max_y = 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", 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)); 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));

View File

@ -435,9 +435,7 @@ void psxgpu_device::updatevisiblearea()
n_screenwidth = 640; n_screenwidth = 640;
break; break;
} }
visarea.min_x = visarea.min_y = 0; visarea.set(0, n_screenwidth - 1, 0, n_screenheight - 1);
visarea.max_x = n_screenwidth - 1;
visarea.max_y = n_screenheight - 1;
machine().primary_screen->configure(n_screenwidth, n_screenheight, visarea, HZ_TO_ATTOSECONDS(refresh)); machine().primary_screen->configure(n_screenwidth, n_screenheight, visarea, HZ_TO_ATTOSECONDS(refresh));
} }

View File

@ -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; int tx = x + sx * (expand + 1) + ex;
/* get out if outside the drawing region */ /* get out if outside the drawing region */
if ((tx < cliprect.min_x) || if (!cliprect.contains(tx, ty))
(tx > cliprect.max_x) ||
(ty < cliprect.min_y) ||
(ty > cliprect.max_y))
continue; continue;
/* get out if current image bit is transparent */ /* 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 (x = x1; x < x1 + SPRITE_WIDTH; x++)
for (y = y1; y < y1 + SPRITE_HEIGHT; y++) for (y = y1; y < y1 + SPRITE_HEIGHT; y++)
{ {
if ((x < cliprect.min_x) || (x > cliprect.max_x) || if (!cliprect.contains(x, y))
(y < cliprect.min_y) || (y > cliprect.max_y))
continue; continue;
checksum = checksum + s2636->collision_bitmap->pix16(y, x); 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 (x = x1; x < x1 + SPRITE_WIDTH; x++)
for (y = y1; y < y1 + SPRITE_HEIGHT; y++) for (y = y1; y < y1 + SPRITE_HEIGHT; y++)
{ {
if ((x < cliprect.min_x) || (x > cliprect.max_x) || if (!cliprect.contains(x, y))
(y < cliprect.min_y) || (y > cliprect.max_y))
continue; continue;
checksum = checksum - s2636->collision_bitmap->pix16(y, x); checksum = checksum - s2636->collision_bitmap->pix16(y, x);

View File

@ -240,10 +240,7 @@ static void recompute_parameters(tms9927_state *tms, int postload)
/* create a visible area */ /* create a visible area */
/* fix me: how do the offsets fit in here? */ /* fix me: how do the offsets fit in here? */
visarea.min_x = 0; visarea.set(0, tms->visible_hpix - 1, 0, tms->visible_vpix - 1);
visarea.max_x = tms->visible_hpix - 1;
visarea.min_y = 0;
visarea.max_y = tms->visible_vpix - 1;
refresh = HZ_TO_ATTOSECONDS(tms->clock) * tms->total_hpix * tms->total_vpix; refresh = HZ_TO_ATTOSECONDS(tms->clock) * tms->total_hpix * tms->total_vpix;

View File

@ -169,10 +169,7 @@ inline void upd3301_device::recompute_parameters()
rectangle visarea; rectangle visarea;
visarea.min_x = 0; visarea.set(0, (m_h * m_width) - 1, 0, (m_l * m_r) - 1);
visarea.min_y = 0;
visarea.max_x = (m_h * m_width) - 1;
visarea.max_y = (m_l * m_r) - 1;
if (LOG) if (LOG)
{ {

View File

@ -258,8 +258,8 @@ SCREEN_UPDATE_RGB32( vector )
{ {
UINT32 flags = PRIMFLAG_ANTIALIAS(screen.machine().options().antialias() ? 1 : 0) | PRIMFLAG_BLENDMODE(BLENDMODE_ADD); UINT32 flags = PRIMFLAG_ANTIALIAS(screen.machine().options().antialias() ? 1 : 0) | PRIMFLAG_BLENDMODE(BLENDMODE_ADD);
const rectangle &visarea = screen.visible_area(); const rectangle &visarea = screen.visible_area();
float xscale = 1.0f / (65536 * (visarea.max_x - visarea.min_x)); float xscale = 1.0f / (65536 * visarea.width());
float yscale = 1.0f / (65536 * (visarea.max_y - visarea.min_y)); float yscale = 1.0f / (65536 * visarea.height());
float xoffs = (float)visarea.min_x; float xoffs = (float)visarea.min_x;
float yoffs = (float)visarea.min_y; float yoffs = (float)visarea.min_y;
point *curpoint; point *curpoint;

View File

@ -930,7 +930,7 @@ static void swap_buffers(voodoo_state *v)
if (v->stats.display) if (v->stats.display)
{ {
const rectangle &visible_area = v->screen->visible_area(); 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; char *statsptr = v->stats.buffer;
int pixelcount; int pixelcount;
int i; int i;
@ -2573,10 +2573,7 @@ static INT32 register_w(voodoo_state *v, offs_t offset, UINT32 data)
rectangle visarea; rectangle visarea;
/* create a new visarea */ /* create a new visarea */
visarea.min_x = hbp; visarea.set(hbp, hbp + hvis - 1, vbp, vbp + vvis - 1);
visarea.max_x = hbp + hvis - 1;
visarea.min_y = vbp;
visarea.max_y = vbp + vvis - 1;
/* keep within bounds */ /* keep within bounds */
visarea.max_x = MIN(visarea.max_x, htotal - 1); visarea.max_x = MIN(visarea.max_x, htotal - 1);

View File

@ -331,7 +331,7 @@ void bitmap_t::fill(UINT32 color, const rectangle &cliprect)
case 8: case 8:
// 8bpp always uses memset // 8bpp always uses memset
for (INT32 y = fill.min_y; y <= fill.max_y; y++) 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; break;
case 16: case 16:
@ -339,7 +339,7 @@ void bitmap_t::fill(UINT32 color, const rectangle &cliprect)
if ((UINT8)(color >> 8) == (UINT8)color) if ((UINT8)(color >> 8) == (UINT8)color)
{ {
for (INT32 y = fill.min_y; y <= fill.max_y; y++) 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 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++) for (INT32 y = fill.min_y + 1; y <= fill.max_y; y++)
{ {
destrow = &pixt<UINT16>(y, fill.min_x); 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; 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) if ((UINT8)(color >> 8) == (UINT8)color && (UINT16)(color >> 16) == (UINT16)color)
{ {
for (INT32 y = fill.min_y; y <= fill.max_y; y++) 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 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++) for (INT32 y = fill.min_y + 1; y <= fill.max_y; y++)
{ {
destrow = &pixt<UINT32>(y, fill.min_x); 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; 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) if ((UINT8)(color >> 8) == (UINT8)color && (UINT16)(color >> 16) == (UINT16)color)
{ {
for (INT32 y = fill.min_y; y <= fill.max_y; y++) 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 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++) for (INT32 y = fill.min_y + 1; y <= fill.max_y; y++)
{ {
destrow = &pixt<UINT64>(y, fill.min_x); 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; break;

View File

@ -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); } 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 width() const { return max_x + 1 - min_x; }
INT32 height() const { return max_y + 1 - min_y; } 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 // setters
void set(INT32 minx, INT32 maxx, INT32 miny, INT32 maxy) { min_x = minx; max_x = maxx; min_y = miny; max_y = maxy; } 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_width(INT32 width) { max_x = min_x + width - 1; }
void set_height(INT32 height) { max_y = min_y + height - 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_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 // internal state
INT32 min_x; // minimum X, or left coordinate INT32 min_x; // minimum X, or left coordinate
@ -205,7 +210,7 @@ private:
protected: protected:
// construction/destruction -- subclasses only // 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, 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) { } bitmap8_t(bitmap_format format, bitmap8_t &source, const rectangle &subrect) : bitmap_t(format, 8, source, subrect) { }
public: public:
@ -228,7 +233,7 @@ private:
protected: protected:
// construction/destruction -- subclasses only // 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, 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) { } bitmap16_t(bitmap_format format, bitmap16_t &source, const rectangle &subrect) : bitmap_t(format, 16, source, subrect) { }
public: public:
@ -251,7 +256,7 @@ private:
protected: protected:
// construction/destruction -- subclasses only // 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, 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) { } bitmap32_t(bitmap_format format, bitmap32_t &source, const rectangle &subrect) : bitmap_t(format, 32, source, subrect) { }
public: public:
@ -274,7 +279,7 @@ private:
protected: protected:
// construction/destruction -- subclasses only // 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, 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) { } bitmap64_t(bitmap_format format, bitmap64_t &source, const rectangle &subrect) : bitmap_t(format, 64, source, subrect) { }
public: public:
@ -298,7 +303,7 @@ class bitmap_ind8 : public bitmap8_t
public: public:
// construction/destruction // 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(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) { } 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(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); } 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: public:
// construction/destruction // 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(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) { } 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(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); } 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: public:
// construction/destruction // 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(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) { } 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(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); } 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: public:
// construction/destruction // 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(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) { } 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(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); } 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: public:
// construction/destruction // 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(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) { } 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(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); } 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: public:
// construction/destruction // 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(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) { } 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(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); } 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: public:
// construction/destruction // 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(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) { } 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(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); } void wrap(bitmap_argb32 &source, const rectangle &subrect) { bitmap_t::wrap(static_cast<bitmap_t &>(source), subrect); }

View File

@ -64,8 +64,8 @@ static int get_lightgun_pos(screen_device &screen, int player, int *x, int *y)
if (xpos == -1 || ypos == -1) if (xpos == -1 || ypos == -1)
return FALSE; return FALSE;
*x = visarea.min_x + xpos * (visarea.max_x - visarea.min_x + 1) / 255; *x = visarea.min_x + xpos * visarea.width() / 255;
*y = visarea.min_y + ypos * (visarea.max_y - visarea.min_y + 1) / 255; *y = visarea.min_y + ypos * visarea.height() / 255;
return TRUE; return TRUE;
} }

View File

@ -86,7 +86,7 @@ SCREEN_UPDATE_RGB32(aristmk6)
g = (g << 2) | (g & 3); g = (g << 2) | (g & 3);
b = (b << 3) | (b & 0x7); 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; bitmap.pix32(y, x) = r | g<<8 | b<<16;
count+=2; count+=2;
@ -97,7 +97,7 @@ SCREEN_UPDATE_RGB32(aristmk6)
color = blit_ram[count]; 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]; bitmap.pix32(y, x) = screen.machine().pens[color];
count++; count++;

View File

@ -251,10 +251,7 @@ static void draw_polygon(atarisy4_state *state, UINT16 color)
poly_vertex v1, v2, v3; poly_vertex v1, v2, v3;
poly_extra_data *extra = (poly_extra_data *)poly_get_extra_data(state->m_poly); poly_extra_data *extra = (poly_extra_data *)poly_get_extra_data(state->m_poly);
clip.min_x = 0; clip.set(0, 511, 0, 511);
clip.min_y = 0;
clip.max_x = 511;
clip.max_y = 511;
extra->color = color; extra->color = color;
extra->screen_ram = state->m_screen_ram; extra->screen_ram = state->m_screen_ram;

View File

@ -474,22 +474,22 @@ static SCREEN_UPDATE_RGB32(bingor)
color = (state->m_blit_ram[count] & 0xf000)>>12; 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]; bitmap.pix32(y, x+3) = screen.machine().pens[color];
color = (state->m_blit_ram[count] & 0x0f00)>>8; 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]; bitmap.pix32(y, x+2) = screen.machine().pens[color];
color = (state->m_blit_ram[count] & 0x00f0)>>4; 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]; bitmap.pix32(y, x+1) = screen.machine().pens[color];
color = (state->m_blit_ram[count] & 0x000f)>>0; 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]; bitmap.pix32(y, x+0) = screen.machine().pens[color];
count++; count++;

View File

@ -210,10 +210,7 @@ static MACHINE_START( ccastles )
assert(state->m_vblank_end < state->m_vblank_start); assert(state->m_vblank_end < state->m_vblank_start);
/* reconfigure the visible area to match */ /* reconfigure the visible area to match */
visarea.min_x = 0; visarea.set(0, 255, state->m_vblank_end, state->m_vblank_start - 1);
visarea.max_x = 255;
visarea.min_y = state->m_vblank_end;
visarea.max_y = state->m_vblank_start - 1;
machine.primary_screen->configure(320, 256, visarea, HZ_TO_ATTOSECONDS(PIXEL_CLOCK) * VTOTAL * HTOTAL); machine.primary_screen->configure(320, 256, visarea, HZ_TO_ATTOSECONDS(PIXEL_CLOCK) * VTOTAL * HTOTAL);
/* configure the ROM banking */ /* configure the ROM banking */

View File

@ -179,10 +179,7 @@ static MACHINE_START( cloud9 )
assert(state->m_vblank_end < state->m_vblank_start); assert(state->m_vblank_end < state->m_vblank_start);
/* reconfigure the visible area to match */ /* reconfigure the visible area to match */
visarea.min_x = 0; visarea.set(0, 255, state->m_vblank_end + 1, state->m_vblank_start);
visarea.max_x = 255;
visarea.min_y = state->m_vblank_end + 1;
visarea.max_y = state->m_vblank_start;
machine.primary_screen->configure(320, 256, visarea, HZ_TO_ATTOSECONDS(PIXEL_CLOCK) * VTOTAL * HTOTAL); 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 */ /* create a timer for IRQs and set up the first callback */

View File

@ -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') // 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_bitmap.allocate(512*2,224*2);
state->m_renderbuffer_clip.min_x = 0; state->m_renderbuffer_clip.set(0, state->m_screenwidth-1, 0, 224-1);
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_bitmap.fill(0x3f, state->m_renderbuffer_clip); 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; if (drawline>cliprect.max_y+4) return;
clip.min_x = cliprect.min_x; clip.set(cliprect.min_x, cliprect.max_x, drawline, drawline);
clip.max_x = cliprect.max_x;
clip.min_y = drawline;
clip.max_y = drawline;
for (x=0;x<(cliprect.max_x/16)+2;x++) for (x=0;x<(cliprect.max_x/16)+2;x++)
{ {
@ -964,8 +958,7 @@ static SCREEN_UPDATE_RGB32(cps3)
if (state->m_screenwidth!=496) if (state->m_screenwidth!=496)
{ {
state->m_screenwidth = 496; state->m_screenwidth = 496;
visarea.min_x = 0; visarea.max_x = 496-1; visarea.set(0, 496-1, 0, 224-1);
visarea.min_y = 0; visarea.max_y = 224-1;
screen.configure(496, 224, visarea, period); screen.configure(496, 224, visarea, period);
} }
} }
@ -974,8 +967,7 @@ static SCREEN_UPDATE_RGB32(cps3)
if (state->m_screenwidth!=384) if (state->m_screenwidth!=384)
{ {
state->m_screenwidth = 384; state->m_screenwidth = 384;
visarea.min_x = 0; visarea.max_x = 384-1; visarea.set(0, 384-1, 0, 224-1);
visarea.min_y = 0; visarea.max_y = 224-1;
screen.configure(384, 224, visarea, period); screen.configure(384, 224, visarea, period);
} }
} }

View File

@ -208,11 +208,7 @@ static VIDEO_START( cybertnk )
static void draw_pixel( bitmap_ind16 &bitmap, const rectangle &cliprect, int y, int x, int pen) static void draw_pixel( bitmap_ind16 &bitmap, const rectangle &cliprect, int y, int x, int pen)
{ {
if (x>cliprect.max_x) return; if (cliprect.contains(x, y))
if (x<cliprect.min_x) return;
if (y>cliprect.max_y) return;
if (y<cliprect.min_y) return;
bitmap.pix16(y, x) = pen; bitmap.pix16(y, x) = pen;
} }

View File

@ -107,10 +107,7 @@ static SCREEN_UPDATE_IND16( flyball )
for (y = bally; y < bally + 2; y++) for (y = bally; y < bally + 2; y++)
for (x = ballx; x < ballx + 2; x++) for (x = ballx; x < ballx + 2; x++)
if (x >= cliprect.min_x && if (cliprect.contains(x, y))
x <= cliprect.max_x &&
y >= cliprect.min_y &&
y <= cliprect.max_y)
bitmap.pix16(y, x) = 1; bitmap.pix16(y, x) = 1;
return 0; return 0;
} }

View File

@ -97,12 +97,7 @@ INLINE void draw_pixel(bitmap_ind16 &bitmap,const rectangle &cliprect,int x,int
y = bitmap.height() - y - 1; y = bitmap.height() - y - 1;
} }
if (x < cliprect.min_x || if (cliprect.contains(x, y))
x > cliprect.max_x ||
y < cliprect.min_y ||
y > cliprect.max_y)
return;
bitmap.pix16(y, x) = color; bitmap.pix16(y, x) = color;
} }

View File

@ -89,7 +89,7 @@ static SCREEN_UPDATE_RGB32( gunpey )
g = (color & 0x03e0) >> 2; g = (color & 0x03e0) >> 2;
r = (color & 0x7c00) >> 7; 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); bitmap.pix32(y, x) = b | (g<<8) | (r<<16);

View File

@ -125,12 +125,12 @@ static SCREEN_UPDATE_RGB32(tourvisn)
color = ((state->m_blit_ram[count]) & 0x00ff)>>0; 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]; bitmap.pix32(y, (x*2)+0) = screen.machine().pens[color];
color = ((state->m_blit_ram[count]) & 0xff00)>>8; 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]; bitmap.pix32(y, (x*2)+1) = screen.machine().pens[color];
count++; count++;
@ -162,7 +162,7 @@ static SCREEN_UPDATE_RGB32(brasil)
b = (color & 0x001f) << 3; b = (color & 0x001f) << 3;
g = (color & 0x07e0) >> 3; g = (color & 0x07e0) >> 3;
r = (color & 0xf800) >> 8; 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); bitmap.pix32(y, x) = b | (g<<8) | (r<<16);
count++; count++;

View File

@ -935,10 +935,7 @@ static WRITE32_HANDLER( tcram_w )
state->m_screen_dis = 0; state->m_screen_dis = 0;
visarea.min_x = min_x; visarea.set(min_x, min_x + max_x - 1, min_y, min_y + max_y - 1);
visarea.max_x = min_x + max_x - 1;
visarea.min_y = min_y;
visarea.max_y = min_y + max_y - 1;
space->machine().primary_screen->configure(HTOTAL, VTOTAL, visarea, space->machine().primary_screen->frame_period().attoseconds ); space->machine().primary_screen->configure(HTOTAL, VTOTAL, visarea, space->machine().primary_screen->frame_period().attoseconds );
} }
} }

View File

@ -298,10 +298,7 @@ static SCREEN_UPDATE_IND16(jingbell)
int rowenable = state->m_bg_scroll2[zz]; int rowenable = state->m_bg_scroll2[zz];
/* draw top of screen */ /* draw top of screen */
clip.min_x = visarea.min_x; clip.set(visarea.min_x, visarea.max_x, startclipmin, startclipmin+2);
clip.max_x = visarea.max_x;
clip.min_y = startclipmin;
clip.max_y = startclipmin+2;
bitmap.fill(screen.machine().pens[rowenable], clip); bitmap.fill(screen.machine().pens[rowenable], clip);

View File

@ -436,7 +436,7 @@ static WRITE16_HANDLER( igs011_blit_flags_w )
} }
// plot it // 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; if (clear) dest[x + y * 512] = clear_pen;
else if (pen != trans_pen) dest[x + y * 512] = pen | pen_hi; else if (pen != trans_pen) dest[x + y * 512] = pen | pen_hi;

View File

@ -126,7 +126,7 @@ static SCREEN_UPDATE_RGB32( itgambl2 )
color = (blit_ram[count] & 0xff)>>0; 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]; bitmap.pix32(y, x) = screen.machine().pens[color];
count++; count++;

View File

@ -114,7 +114,7 @@ static SCREEN_UPDATE_RGB32( itgambl3 )
color = (blit_ram[count] & 0xff)>>0; 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]; bitmap.pix32(y, x) = screen.machine().pens[color];
count++; count++;

View File

@ -196,10 +196,7 @@ static SCREEN_UPDATE_IND16(jackie)
int rowenable = state->m_bg_scroll2[j]; int rowenable = state->m_bg_scroll2[j];
/* draw top of screen */ /* draw top of screen */
clip.min_x = visarea.min_x; clip.set(visarea.min_x, visarea.max_x, startclipmin, startclipmin+1);
clip.max_x = visarea.max_x;
clip.min_y = startclipmin;
clip.max_y = startclipmin+1;
if (rowenable==0) if (rowenable==0)
{ {

View File

@ -158,7 +158,7 @@ static SCREEN_UPDATE_RGB32(jantotsu)
for(pen_i = 0;pen_i<4;pen_i++) for(pen_i = 0;pen_i<4;pen_i++)
color |= (((state->m_bitmap[count + pen_i*0x2000]) >> (7 - i)) & 1) << 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]; bitmap.pix32(y, x + i) = screen.machine().pens[color];
} }

View File

@ -222,10 +222,7 @@ static SCREEN_UPDATE_IND16(kingdrby)
tilemap_set_scrolly( state->m_sc0w_tilemap,0, 32); tilemap_set_scrolly( state->m_sc0w_tilemap,0, 32);
/* maybe it needs two window tilemaps? (one at the top, the other at the bottom)*/ /* maybe it needs two window tilemaps? (one at the top, the other at the bottom)*/
clip.min_x = visarea.min_x; clip.set(visarea.min_x, 256, 192, visarea.max_y);
clip.max_x = 256;
clip.min_y = 192;
clip.max_y = visarea.max_y;
/*TILEMAP_DRAW_CATEGORY + TILEMAP_DRAW_OPAQUE doesn't suit well?*/ /*TILEMAP_DRAW_CATEGORY + TILEMAP_DRAW_OPAQUE doesn't suit well?*/
tilemap_draw(bitmap,cliprect,state->m_sc0_tilemap,0,0); tilemap_draw(bitmap,cliprect,state->m_sc0_tilemap,0,0);

View File

@ -119,11 +119,7 @@ static CUSTOM_INPUT( spriteram_bit_r )
static WRITE32_HANDLER( spriteram_buffer_w ) static WRITE32_HANDLER( spriteram_buffer_w )
{ {
limenko_state *state = space->machine().driver_data<limenko_state>(); limenko_state *state = space->machine().driver_data<limenko_state>();
rectangle clip; rectangle clip(0, 383, 0, 239);
clip.min_x = 0;
clip.max_x = 383;
clip.min_y = 0;
clip.max_y = 239;
state->m_sprites_bitmap_pri.fill(0, clip); state->m_sprites_bitmap_pri.fill(0, clip);
state->m_sprites_bitmap.fill(0, clip); state->m_sprites_bitmap.fill(0, clip);

View File

@ -269,12 +269,7 @@ static SCREEN_UPDATE_IND16(luckgrln)
const rectangle &visarea = screen.visible_area(); const rectangle &visarea = screen.visible_area();
int i; int i;
rectangle clip; rectangle clip = visarea;
clip.min_x = visarea.min_x;
clip.max_x = visarea.max_x;
clip.min_y = visarea.min_y;
clip.max_y = visarea.max_y;
bitmap.fill(0, cliprect); bitmap.fill(0, cliprect);

View File

@ -402,22 +402,22 @@ static SCREEN_UPDATE_RGB32(magicard)
color = ((state->m_magicram[count]) & 0x000f)>>0; 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]; bitmap.pix32(y, (x*4)+3) = screen.machine().pens[color];
color = ((state->m_magicram[count]) & 0x00f0)>>4; 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]; bitmap.pix32(y, (x*4)+2) = screen.machine().pens[color];
color = ((state->m_magicram[count]) & 0x0f00)>>8; 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]; bitmap.pix32(y, (x*4)+1) = screen.machine().pens[color];
color = ((state->m_magicram[count]) & 0xf000)>>12; 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]; bitmap.pix32(y, (x*4)+0) = screen.machine().pens[color];
count++; count++;
@ -434,12 +434,12 @@ static SCREEN_UPDATE_RGB32(magicard)
color = ((state->m_magicram[count]) & 0x00ff)>>0; 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]; bitmap.pix32(y, (x*2)+1) = screen.machine().pens[color];
color = ((state->m_magicram[count]) & 0xff00)>>8; 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]; bitmap.pix32(y, (x*2)+0) = screen.machine().pens[color];
count++; count++;

View File

@ -532,10 +532,8 @@ static SCREEN_UPDATE_IND16(majorpkr)
/* The following custom_clip is to exclude the last char column (unused) /* 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. form the render. We need more proof about how the video is working.
*/ */
custom_clip.min_x=cliprect.min_x; custom_clip = cliprect;
custom_clip.max_x=cliprect.max_x-16; custom_clip.max_x -= 16;
custom_clip.min_y=cliprect.min_y;
custom_clip.max_y=cliprect.max_y;
tilemap_draw(bitmap, custom_clip, state->m_bg_tilemap, 0, 0); tilemap_draw(bitmap, custom_clip, state->m_bg_tilemap, 0, 0);
tilemap_draw(bitmap, custom_clip, state->m_fg_tilemap, 0, 0); tilemap_draw(bitmap, custom_clip, state->m_fg_tilemap, 0, 0);

View File

@ -547,7 +547,7 @@ static SCREEN_UPDATE_IND16( marinedt )
int x = OBJ_X(state->m_obj1_x) + sx; int x = OBJ_X(state->m_obj1_x) + sx;
int y = OBJ_Y(state->m_obj1_y) + sy; 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; continue;
if (state->m_obj1->pix16(sy, sx) == 0) if (state->m_obj1->pix16(sy, sx) == 0)

View File

@ -251,9 +251,7 @@ static void draw_framebuffer(running_machine &machine, bitmap_rgb32 &bitmap, con
state->m_frame_width = width; state->m_frame_width = width;
state->m_frame_height = height; state->m_frame_height = height;
visarea.min_x = visarea.min_y = 0; visarea.set(0, width - 1, 0, height - 1);
visarea.max_x = width - 1;
visarea.max_y = height - 1;
machine.primary_screen->configure(width, height * 262 / 240, visarea, machine.primary_screen->frame_period().attoseconds); machine.primary_screen->configure(width, height * 262 / 240, visarea, machine.primary_screen->frame_period().attoseconds);
} }

View File

@ -531,8 +531,8 @@ static WRITE32_HANDLER( invasn_gun_w )
{ "GUNX1", "GUNY1" }, { "GUNX1", "GUNY1" },
{ "GUNX2", "GUNY2" } { "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_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.max_y + 1 - visarea.min_y) / 255 + visarea.min_y; 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); 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);
} }
} }

View File

@ -84,18 +84,13 @@ static SCREEN_UPDATE_IND16( mogura )
const rectangle &visarea = screen.visible_area(); const rectangle &visarea = screen.visible_area();
/* tilemap layout is a bit strange ... */ /* tilemap layout is a bit strange ... */
rectangle clip; rectangle clip = visarea;
clip.min_x = visarea.min_x;
clip.max_x = 256 - 1; 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_set_scrollx(state->m_tilemap, 0, 256);
tilemap_draw(bitmap, clip, state->m_tilemap, 0, 0); tilemap_draw(bitmap, clip, state->m_tilemap, 0, 0);
clip.min_x = 256; clip.min_x = 256;
clip.max_x = 512 - 1; 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_set_scrollx(state->m_tilemap, 0, -128);
tilemap_draw(bitmap, clip, state->m_tilemap, 0, 0); tilemap_draw(bitmap, clip, state->m_tilemap, 0, 0);

View File

@ -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 */ /* Set the clipping rect to mask off the other portion of the sprite */
rect.min_x=sx; rect.set(sx, sx+(sizex-1), sy, sy+(sizey-1));
rect.max_x=sx+(sizex-1); rect &= cliprect;
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;
if( !bBigSprite ) if( !bBigSprite )
{ {
@ -604,10 +597,7 @@ namcos2_draw_sprites_metalhawk(running_machine &machine, bitmap_ind16 &bitmap, c
sx -= (tile&1)?16:0; sx -= (tile&1)?16:0;
sy -= (tile&2)?16:0; sy -= (tile&2)?16:0;
rect.min_x=sx; rect.set(sx, sx+(sizex-1), sy, sy+(sizey-1));
rect.max_x=sx+(sizex-1);
rect.min_y=sy;
rect.max_y=sy+(sizey-1);
rect.min_x += (tile&1)?16:0; rect.min_x += (tile&1)?16:0;
rect.max_x += (tile&1)?16:0; rect.max_x += (tile&1)?16:0;
rect.min_y += (tile&2)?16:0; rect.min_y += (tile&2)?16:0;
@ -804,14 +794,8 @@ draw_spriteC355(running_machine &machine, _BitmapClass &bitmap, const rectangle
hpos -= xscroll; hpos -= xscroll;
vpos -= yscroll; vpos -= yscroll;
pWinAttr = &spriteram16[0x2400/2+((palette>>8)&0xf)*4]; pWinAttr = &spriteram16[0x2400/2+((palette>>8)&0xf)*4];
clip.min_x = pWinAttr[0] - xscroll; clip.set(pWinAttr[0] - xscroll, pWinAttr[1] - xscroll, pWinAttr[2] - yscroll, pWinAttr[3] - yscroll);
clip.max_x = pWinAttr[1] - xscroll; clip &= cliprect;
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; }
hpos&=0x7ff; if( hpos&0x400 ) hpos |= ~0x7ff; /* sign extend */ hpos&=0x7ff; if( hpos&0x400 ) hpos |= ~0x7ff; /* sign extend */
vpos&=0x7ff; if( vpos&0x400 ) vpos |= ~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 ); UnpackRozParam( pSource, &rozInfo );
if( pri == rozInfo.priority ) if( pri == rozInfo.priority )
{ {
clip.min_x = 0; clip.set(0, bitmap.width()-1, line, line);
clip.max_x = bitmap.width()-1; clip &= cliprect;
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; }
DrawRozHelper( bitmap, mRozTilemap[which], clip, &rozInfo ); DrawRozHelper( bitmap, mRozTilemap[which], clip, &rozInfo );
} /* priority */ } /* priority */

View File

@ -120,7 +120,7 @@ static SCREEN_UPDATE_RGB32( tetriskr )
for(pen_i = 0;pen_i<4;pen_i++) 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; 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]; bitmap.pix32(y*8+yi, x*8+xi) = screen.machine().pens[color];
} }
} }

View File

@ -321,8 +321,8 @@ static void handle_lightpen( device_t *device )
const rectangle &vis_area = device->machine().primary_screen->visible_area(); const rectangle &vis_area = device->machine().primary_screen->visible_area();
int xt, yt; int xt, yt;
xt = x_val * (vis_area.max_x - vis_area.min_x) / 1024 + vis_area.min_x; xt = x_val * vis_area.width() / 1024 + vis_area.min_x;
yt = y_val * (vis_area.max_y - vis_area.min_y) / 1024 + vis_area.min_y; 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); device->machine().scheduler().timer_set(device->machine().primary_screen->time_until_pos(yt, xt), FUNC(assert_lp_cb), 0, device);
} }

View File

@ -127,7 +127,7 @@ static SCREEN_UPDATE_IND16( progolf )
{ {
color = state->m_fg_fb[(xi+yi*8)+count*0x40]; 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)]; bitmap.pix16(x+yi, 256-y+xi) = screen.machine().pens[(color & 0x7)];
} }
} }

View File

@ -377,10 +377,7 @@ static VIDEO_START(rabbit)
tilemap_map_pen_to_layer(state->m_tilemap[3], 1, 255, TILEMAP_PIXEL_TRANSPARENT); 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_bitmap = auto_bitmap_ind16_alloc(machine,0x1000,0x1000);
state->m_sprite_clip.min_x = 0; state->m_sprite_clip.set(0, 0x1000-1, 0, 0x1000-1);
state->m_sprite_clip.max_x = 0x1000-1;
state->m_sprite_clip.min_y = 0;
state->m_sprite_clip.max_y = 0x1000-1;
} }
/* /*

View File

@ -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); //printf("%04x %04x %d\n",zz, xxxscroll, line/8);
/* draw top of screen */ /* draw top of screen */
clip.min_x = visarea.min_x; clip.set(visarea.min_x, 511, startclipmin, startclipmin);
clip.max_x = 511;
clip.min_y = startclipmin;
clip.max_y = startclipmin;

View File

@ -92,7 +92,6 @@ static SCREEN_UPDATE_RGB32( srmp5 )
UINT16 *sprite_list=state->m_sprram; UINT16 *sprite_list=state->m_sprram;
UINT16 *sprite_list_end=&state->m_sprram[0x4000]; //guess UINT16 *sprite_list_end=&state->m_sprram[0x4000]; //guess
UINT8 *pixels=(UINT8 *)state->m_tileram; 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. //Table surface seems to be tiles, but display corrupts when switching the scene if always ON.
//Currently the tiles are OFF. //Currently the tiles are OFF.
@ -168,7 +167,7 @@ static SCREEN_UPDATE_RGB32( srmp5 )
xs2 = (sprite_sublist[SPRITE_PALETTE] & 0x8000) ? (sizex - xs) : xs; xs2 = (sprite_sublist[SPRITE_PALETTE] & 0x8000) ? (sizex - xs) : xs;
if(pen) 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)]; 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); bitmap.pix32(yb+ys2, xb+xs2) = ((pixdata&0x7c00)>>7) | ((pixdata&0x3e0)<<6) | ((pixdata&0x1f)<<19);

View File

@ -80,7 +80,7 @@ static SCREEN_UPDATE_RGB32( taitowlf )
color = (blit_ram[count] & 0xff); 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]; bitmap.pix32(y, x+0) = screen.machine().pens[color];
count++; count++;

View File

@ -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(); 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; *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.max_y - visarea.min_y)) >> 8) + visarea.min_y; *y = (((input_port_read(machine, player ? "GUNY2" : "GUNY1") & 0xff) * visarea.height()) >> 8) + visarea.min_y;
} }

View File

@ -192,7 +192,7 @@ static void ttmjprd_draw_tile(running_machine &machine, bitmap_ind16 &bitmap, co
if (!depth) 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; dat = (rom[(tileaddr*32)+count] & 0xf0)>>4;
if (dat!=15) if (dat!=15)
@ -203,7 +203,7 @@ static void ttmjprd_draw_tile(running_machine &machine, bitmap_ind16 &bitmap, co
} }
} }
drawx++; 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); dat = (rom[(tileaddr*32)+count] & 0x0f);
if (dat!=15) if (dat!=15)
@ -218,7 +218,7 @@ static void ttmjprd_draw_tile(running_machine &machine, bitmap_ind16 &bitmap, co
} }
else 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); dat = (rom[(tileaddr*32)+count] & 0xff);
if (dat!=255) if (dat!=255)

View File

@ -9483,10 +9483,7 @@ int megadrive_z80irq_hpos = 320;
} }
// mame_printf_debug("my mode %02x", megadrive_vdp_register[0x0c]); // mame_printf_debug("my mode %02x", megadrive_vdp_register[0x0c]);
visarea.min_x = 0; visarea.set(0, scr_width-1, 0, megadrive_visible_scanlines-1);
visarea.max_x = scr_width-1;
visarea.min_y = 0;
visarea.max_y = megadrive_visible_scanlines-1;
screen.machine().primary_screen->configure(scr_width, megadrive_visible_scanlines, visarea, HZ_TO_ATTOSECONDS(megadriv_framerate)); screen.machine().primary_screen->configure(scr_width, megadrive_visible_scanlines, visarea, HZ_TO_ATTOSECONDS(megadriv_framerate));

View File

@ -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 */ if (chip->vdp_type!=GG_VDP) /* In GG mode the Game Gear resolution is fixed */
{ {
rectangle visarea; rectangle visarea(0, 256-1, 0, sms_mode_table[chip->screen_mode].sms2_height-1);
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;
if (chip->chip_id==3) machine.primary_screen->configure(256, 256, visarea, HZ_TO_ATTOSECONDS(chip->sms_framerate)); if (chip->chip_id==3) machine.primary_screen->configure(256, 256, visarea, HZ_TO_ATTOSECONDS(chip->sms_framerate));
} }
else /* 160x144 */ else /* 160x144 */
{ {
rectangle visarea; rectangle visarea((256-160)/2, (256-160)/2+160-1, (192-144)/2, (192-144)/2+144-1);
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;
machine.primary_screen->configure(256, 256, visarea, HZ_TO_ATTOSECONDS(chip->sms_framerate)); machine.primary_screen->configure(256, 256, visarea, HZ_TO_ATTOSECONDS(chip->sms_framerate));
} }

View File

@ -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 */ 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 */ /* draw top of screen */
clip.min_x = 8*0; clip.set(8*0, 8*16-1, visarea.min_y, visarea.max_y);
clip.max_x = 8*16-1;
clip.min_y = visarea.min_y;
clip.max_y = visarea.max_y;
if ((state->m_layer_ctrl & 0x80) == 0x00) if ((state->m_layer_ctrl & 0x80) == 0x00)
tilemap_draw(bitmap, clip, state->m_bgtop_tilemap, 0, 0); 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); tilemap_draw(bitmap, clip, state->m_tx_tilemap, 0, 0);
/* draw bottom of screen */ /* draw bottom of screen */
clip.min_x = 8*16; clip.set(8*16, 8*32-1, visarea.min_y, visarea.max_y);
clip.max_x = 8*32-1;
clip.min_y = visarea.min_y;
clip.max_y = visarea.max_y;
if ((state->m_layer_ctrl & 0x40) == 0x00) if ((state->m_layer_ctrl & 0x40) == 0x00)
tilemap_draw(bitmap, clip, state->m_bgbot_tilemap, 0, 0); tilemap_draw(bitmap, clip, state->m_bgbot_tilemap, 0, 0);

View File

@ -64,20 +64,14 @@ SCREEN_UPDATE_RGB32( archimds_vidc )
if(vidc_interlace) if(vidc_interlace)
{ {
if ((res_x) >= 0 && if (cliprect.contains(res_x, res_y) && (res_x) <= xend && (res_y) <= yend)
(res_y) >= 0 &&
(res_x) <= screen.visible_area().max_x && (res_y) <= screen.visible_area().max_y && (res_x) <= xend && (res_y) <= yend)
bitmap.pix32(res_y, res_x) = screen.machine().pens[(pen>>(xi))&0x1]; bitmap.pix32(res_y, res_x) = screen.machine().pens[(pen>>(xi))&0x1];
if ((res_x) >= 0 && if (cliprect.contains(res_x, res_y+1) && (res_x) <= xend && (res_y+1) <= yend)
(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)
bitmap.pix32(res_y+1, res_x) = screen.machine().pens[(pen>>(xi))&0x1]; bitmap.pix32(res_y+1, res_x) = screen.machine().pens[(pen>>(xi))&0x1];
} }
else else
{ {
if ((res_x) >= 0 && if (cliprect.contains(res_x, res_y) && (res_x) <= xend && (res_y) <= yend)
(res_y) >= 0 &&
(res_x) <= screen.visible_area().max_x && (res_y) <= screen.visible_area().max_y && (res_x) <= xend && (res_y) <= yend)
bitmap.pix32(res_y, res_x) = screen.machine().pens[(pen>>(xi))&0x1]; 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(vidc_interlace)
{ {
if ((res_x) >= 0 && if (cliprect.contains(res_x, res_y) && (res_x) <= xend && (res_y) <= yend)
(res_y) >= 0 &&
(res_x) <= screen.visible_area().max_x && (res_y) <= screen.visible_area().max_y && (res_x) <= xend && (res_y) <= yend)
bitmap.pix32(res_y, res_x) = screen.machine().pens[(pen&0xff)+0x100]; bitmap.pix32(res_y, res_x) = screen.machine().pens[(pen&0xff)+0x100];
if ((res_x) >= 0 && if (cliprect.contains(res_x, res_y) && (res_x) <= xend && (res_y+1) <= yend)
(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)
bitmap.pix32(res_y+1, res_x) = screen.machine().pens[(pen&0xff)+0x100]; bitmap.pix32(res_y+1, res_x) = screen.machine().pens[(pen&0xff)+0x100];
} }
else else
{ {
if ((res_x) >= 0 && if (cliprect.contains(res_x, res_y) && (res_x) <= xend && (res_y) <= yend)
(res_y) >= 0 &&
(res_x) <= screen.visible_area().max_x && (res_y) <= screen.visible_area().max_y && (res_x) <= xend && (res_y) <= yend)
bitmap.pix32(res_y, res_x) = screen.machine().pens[(pen&0xff)+0x100]; bitmap.pix32(res_y, res_x) = screen.machine().pens[(pen&0xff)+0x100];
} }

View File

@ -182,7 +182,7 @@ UINT32 beathead_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap
} }
/* then draw it */ /* 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; return 0;
} }

View File

@ -77,7 +77,7 @@ static void update_pixels( running_machine &machine, int x, int y )
int color; int color;
const rectangle &visarea = machine.primary_screen->visible_area(); 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; return;
front = state->m_videoram[y * 256 + x / 2]; front = state->m_videoram[y * 256 + x / 2];

View File

@ -271,7 +271,7 @@ static void draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rec
{ {
if (flip) x += 20*8; 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; bitmap.pix16(y, x) = STARS_COLOR_BASE + star_seed_tab[star_cntr].col;
} }
} }

View File

@ -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 sx = 254 - state->m_videoram[0x3d0 + 2 * i + 0x5];
int sy = 246 - state->m_videoram[0x3d0 + 2 * i + 0xc]; int sy = 246 - state->m_videoram[0x3d0 + 2 * i + 0xc];
rectangle rect; rectangle rect(sx, sx + 1, sy, sy + 1);
rect &= cliprect;
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;
bitmap.fill(1 + 2 * i, rect); bitmap.fill(1 + 2 * i, rect);
} }

View File

@ -124,8 +124,8 @@ VIDEO_START( cchasm )
cchasm_state *state = machine.driver_data<cchasm_state>(); cchasm_state *state = machine.driver_data<cchasm_state>();
const rectangle &visarea = machine.primary_screen->visible_area(); const rectangle &visarea = machine.primary_screen->visible_area();
state->m_xcenter=((visarea.max_x + visarea.min_x)/2) << 16; state->m_xcenter=visarea.xcenter() << 16;
state->m_ycenter=((visarea.max_y + visarea.min_y)/2) << 16; state->m_ycenter=visarea.ycenter() << 16;
VIDEO_START_CALL(vector); VIDEO_START_CALL(vector);
} }

View File

@ -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); col = ((col & 0xe0) >> 1) + (screen.frame_number() / 16 & 0x0f);
if (sx >= cliprect.min_x && sx <= cliprect.max_x && if (cliprect.contains(sx, sy))
sy >= cliprect.min_y && sy <= cliprect.max_y)
bitmap.pix16(sy, sx) = 0xa00 + col; 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); col = ((col & 0xe0) >> 1) + (screen.frame_number() / 16 & 0x0f);
if (sx >= cliprect.min_x && sx <= cliprect.max_x && if (cliprect.contains(sx, sy))
sy >= cliprect.min_y && sy <= cliprect.max_y)
bitmap.pix16(sy, sx) = 0x800 + col; bitmap.pix16(sy, sx) = 0x800 + col;
} }
} }

View File

@ -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)) 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.grab[a].busy = 1;
state_ta.renderselect = a; state_ta.renderselect = a;
state_ta.start_render_received=1; 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].fbwsof1=state->pvrta_regs[FB_W_SOF1];
state_ta.grab[a].fbwsof2=state->pvrta_regs[FB_W_SOF2]; state_ta.grab[a].fbwsof2=state->pvrta_regs[FB_W_SOF2];
clip.min_x = 0; rectangle clip(0, 1023, 0, 1023);
clip.max_x = 1023;
clip.min_y = 0;
clip.max_y = 1023;
// we've got a request to draw, so, draw to the accumulation buffer! // we've got a request to draw, so, draw to the accumulation buffer!
// this should really be done for each tile! // this should really be done for each tile!

View File

@ -647,11 +647,7 @@ SCREEN_UPDATE_RGB32( dragngun )
// for now we only draw these 2 layers on the last update call // for now we only draw these 2 layers on the last update call
if (cliprect.max_y == 247) if (cliprect.max_y == 247)
{ {
rectangle clip; rectangle clip(cliprect.min_x, cliprect.max_x, 8, 247);
clip.min_x = cliprect.min_x;
clip.max_x = cliprect.max_x;
clip.min_y = 8;
clip.max_y = 247;
dragngun_draw_sprites(screen.machine(),bitmap,clip,screen.machine().generic.buffered_spriteram.u32); 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); deco16ic_tilemap_1_draw(state->m_deco_tilegen1, bitmap, clip, 0, 0);

View File

@ -269,8 +269,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
{ {
if (rom[i] & 0x0f) if (rom[i] & 0x0f)
{ {
if (sx + x >= cliprect.min_x && sx + x <= cliprect.max_x && if (cliprect.contains(sx + x, y))
y >= cliprect.min_y && y <= cliprect.max_y)
{ {
if ((machine.priority_bitmap.pix8(y, sx + x) & primask) == 0) if ((machine.priority_bitmap.pix8(y, sx + x) & primask) == 0)
bitmap.pix16(y, sx + x) = color * 16 + (rom[i] & 0x0f); 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 (rom[i] & 0xf0)
{ {
if (sx + x >= cliprect.min_x && sx + x <= cliprect.max_x && if (cliprect.contains(sx + x, y))
y >= cliprect.min_y && y <= cliprect.max_y)
{ {
if ((machine.priority_bitmap.pix8(y, sx + x) & primask) == 0) if ((machine.priority_bitmap.pix8(y, sx + x) & primask) == 0)
bitmap.pix16(y, sx + x) = color * 16+(rom[i] >> 4); 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 (rom[i] & 0xf0)
{ {
if (sx + x >= cliprect.min_x && sx + x <= cliprect.max_x && if (cliprect.contains(sx + x, y))
y >= cliprect.min_y && y <= cliprect.max_y)
{ {
if ((machine.priority_bitmap.pix8(y, sx + x) & primask) == 0) if ((machine.priority_bitmap.pix8(y, sx + x) & primask) == 0)
bitmap.pix16(y, sx + x) = color * 16 + (rom[i] >> 4); 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 (rom[i] & 0x0f)
{ {
if (sx + x >= cliprect.min_x && sx + x <= cliprect.max_x && if (cliprect.contains(sx + x, y))
y >= cliprect.min_y && y <= cliprect.max_y)
{ {
if ((machine.priority_bitmap.pix8(y, sx + x) & primask) == 0) if ((machine.priority_bitmap.pix8(y, sx + x) & primask) == 0)
bitmap.pix16(y, sx + x) = color * 16 + (rom[i] & 0x0f); bitmap.pix16(y, sx + x) = color * 16 + (rom[i] & 0x0f);

View File

@ -339,7 +339,7 @@ static void draw_background( running_machine &machine, bitmap_ind16 &bitmap, con
} }
/* draw the scanline */ /* 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);
} }
} }

View File

@ -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; 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; 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; bitmap.pix16(y, x) = STARS_COLOR_BASE + star_seed_tab[ star_cntr ].col;
} }

View File

@ -444,13 +444,9 @@ SCREEN_UPDATE_IND16( galastrm )
UINT8 pivlayer[3]; UINT8 pivlayer[3];
UINT16 priority; UINT16 priority;
static const int primasks[4] = {0xfffc, 0xfff0, 0xff00, 0x0}; static const int primasks[4] = {0xfffc, 0xfff0, 0xff00, 0x0};
rectangle clip;
bitmap_ind8 &priority_bitmap = screen.machine().priority_bitmap; bitmap_ind8 &priority_bitmap = screen.machine().priority_bitmap;
clip.min_x = 0; rectangle clip(0, screen.width() -1, 0, screen.height() -1);
clip.min_y = 0;
clip.max_x = screen.width() -1;
clip.max_y = screen.height() -1;
tc0100scn_tilemap_update(tc0100scn); tc0100scn_tilemap_update(tc0100scn);
tc0480scp_tilemap_update(tc0480scp); tc0480scp_tilemap_update(tc0480scp);

View File

@ -623,7 +623,7 @@ static void theend_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap,
{ {
x--; 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; bitmap.pix16(y, x) = BULLETS_COLOR_BASE;
} }
} }
@ -1143,7 +1143,7 @@ static void galaxold_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap
{ {
x--; 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; int color;
@ -1163,7 +1163,7 @@ static void scrambold_draw_bullets(running_machine &machine, bitmap_ind16 &bitma
x = x - 6; 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 */ /* yellow bullets */
bitmap.pix16(y, x) = BULLETS_COLOR_BASE; 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; 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; 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--; 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; 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) static void dambustr_draw_upper_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
galaxold_state *state = machine.driver_data<galaxold_state>(); galaxold_state *state = machine.driver_data<galaxold_state>();
rectangle clip;
if (flip_screen_x_get(machine)) if (flip_screen_x_get(machine))
{ {
clip.min_x = 254 - state->m_dambustr_bg_split_line; rectangle clip(254 - state->m_dambustr_bg_split_line, state->m_dambustr_bg_split_line, 0, 255);
clip.max_x = state->m_dambustr_bg_split_line;
clip.min_y = 0;
clip.max_y = 255;
copybitmap(bitmap, *state->m_dambustr_tmpbitmap, 0, 0, 0, 0, clip); copybitmap(bitmap, *state->m_dambustr_tmpbitmap, 0, 0, 0, 0, clip);
} }
else else
{ {
clip.min_x = 0; rectangle clip(0, 254 - state->m_dambustr_bg_split_line, 0, 255);
clip.max_x = 254 - state->m_dambustr_bg_split_line;
clip.min_y = 0;
clip.max_y = 255;
copybitmap(bitmap, *state->m_dambustr_tmpbitmap, 0, 0, 0, 0, clip); 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) if (state->m_flipscreen_y)
y = 255 - 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; bitmap.pix16(y, x) = state->m_stars_colors_start + color;
} }

View File

@ -914,7 +914,7 @@ void gp9001vdp_device::draw_sprites( running_machine &machine, bitmap_ind16 &bit
{ {
int drawxx = xx+sx; 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]; UINT8 pix = srcdata[count];
UINT16* dstptr = &bitmap.pix16(drawyy, drawxx); UINT16* dstptr = &bitmap.pix16(drawyy, drawxx);

View File

@ -148,8 +148,7 @@ static int collision_check(running_machine &machine, grchamp_state *state, bitma
if( pixel != sprite_transp ){ if( pixel != sprite_transp ){
sx = x+x0; sx = x+x0;
sy = y+y0; sy = y+y0;
if( (sx >= visarea->min_x) && (sx <= visarea->max_x) && if(visarea->contains(sx, sy))
(sy >= visarea->min_y) && (sy <= visarea->max_y) )
{ {
// Collision check uses only 16 pens! // Collision check uses only 16 pens!
pixel = bitmap.pix16(sy, sx) % 16; pixel = bitmap.pix16(sy, sx) % 16;

View File

@ -10,10 +10,7 @@ VIDEO_START( groundfx )
state->m_spritelist = auto_alloc_array(machine, struct tempsprite, 0x4000); state->m_spritelist = auto_alloc_array(machine, struct tempsprite, 0x4000);
/* Hack */ /* Hack */
state->m_hack_cliprect.min_x = 69; state->m_hack_cliprect.set(69, 250, 24 + 5, 24 + 44);
state->m_hack_cliprect.max_x = 250;
state->m_hack_cliprect.min_y = 24 + 5;
state->m_hack_cliprect.max_y = 24 + 44;
} }
/*************************************************************** /***************************************************************

View File

@ -1110,10 +1110,7 @@ static void hng64_drawtilemap(running_machine& machine, bitmap_rgb32 &bitmap, co
int xinc,yinc; int xinc,yinc;
const rectangle &visarea = machine.primary_screen->visible_area(); const rectangle &visarea = machine.primary_screen->visible_area();
clip.min_x = visarea.min_x; clip = visarea;
clip.max_x = visarea.max_x;
clip.min_y = visarea.min_y;
clip.max_y = visarea.max_y;
if (global_tileregs&0x04000000) // globally selects alt scroll register layout??? 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 // Blit the color buffer into the primary bitmap
for (y = cliprect.min_y; y <= cliprect.max_y; y++) 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); UINT32 *dst = &bitmap.pix32(y, cliprect.min_x);
for (x = cliprect.min_x; x <= cliprect.max_x; x++) for (x = cliprect.min_x; x <= cliprect.max_x; x++)
@ -1698,8 +1695,8 @@ VIDEO_START( hng64 )
state->m_additive_tilemap_debug = 0; state->m_additive_tilemap_debug = 0;
// 3d Buffer Allocation // 3d Buffer Allocation
state->m_depthBuffer3d = auto_alloc_array(machine, float, (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)*(visarea.max_y)); state->m_colorBuffer3d = auto_alloc_array(machine, UINT32, (visarea.max_x + 1)*(visarea.max_y + 1));
} }

View File

@ -140,12 +140,8 @@ INLINE offs_t compute_safe_address(itech32_state *state, int x, int y)
INLINE void disable_clipping(itech32_state *state) INLINE void disable_clipping(itech32_state *state)
{ {
state->m_clip_save = state->m_clip_rect; state->m_clip_save = state->m_clip_rect;
state->m_clip_rect.set(0, 0xfff, 0, 0xfff);
state->m_clip_rect.min_x = state->m_clip_rect.min_y = 0; state->m_scaled_clip_rect.set(0, 0xfff << 8, 0, 0xfff << 8);
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;
} }
INLINE void enable_clipping(itech32_state *state) 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 */ /* render all pixels */
sx = startx; sx = startx;
for (x = 0; x < width && sx < state->m_scaled_clip_rect.max_x; x += xsrcstep, sx += xdststep, ty += ystep) 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 && if (state->m_scaled_clip_rect.contains(sx, ty))
sx >= state->m_scaled_clip_rect.min_x && sx < state->m_scaled_clip_rect.max_x)
{ {
int pixel = rowsrc[x >> 8]; int pixel = rowsrc[x >> 8];
if (pixel != transparent_pen) 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) 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) 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 && if (state->m_scaled_clip_rect.contains(sx, ty))
sx >= state->m_scaled_clip_rect.min_x && sx < state->m_scaled_clip_rect.max_x)
{ {
int pixel = rowsrc[x >> 8]; int pixel = rowsrc[x >> 8];
if (pixel != transparent_pen) 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) 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) 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 && if (state->m_scaled_clip_rect.contains(sx, ty))
sx >= state->m_scaled_clip_rect.min_x && sx < state->m_scaled_clip_rect.max_x)
{ {
int pixel = rowsrc[x >> 8]; int pixel = rowsrc[x >> 8];
UINT16 *zbuf = &zbase[compute_safe_address(state, sx >> 8, ty >> 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 else
{ {
for (x = 0; x < width && sx < state->m_scaled_clip_rect.max_x; x += xsrcstep, sx += xdststep, ty += ystep) 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 && if (state->m_scaled_clip_rect.contains(sx, ty))
sx >= state->m_scaled_clip_rect.min_x && sx < state->m_scaled_clip_rect.max_x)
{ {
int pixel = rowsrc[x >> 8]; int pixel = rowsrc[x >> 8];
UINT16 *zbuf = &zbase[compute_safe_address(state, sx >> 8, ty >> 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 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 */ /* otherwise, draw directly from VRAM */
else 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; return 0;
} }

View File

@ -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(); const rectangle &visarea = machine.primary_screen->visible_area();
int width = visarea.max_x + 1 - visarea.min_x; int width = visarea.width();
int height = visarea.max_y + 1 - visarea.min_y; int height = visarea.height();
/* only 2 lightguns are connected */ /* only 2 lightguns are connected */
*x = visarea.min_x + (((input_port_read(machine, player ? "FAKE2_X" : "FAKE1_X") & 0xff) * width) >> 8); *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); *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 */ /* adjust for the half-lines */
if (hperiod != 0 && vperiod != 0 && hbend < hbstart && vbend < vbstart && hbstart < hperiod) if (hperiod != 0 && vperiod != 0 && hbend < hbstart && vbend < vbstart && hbstart < hperiod)
{ {
rectangle visarea; rectangle visarea(hbend / 2, hbstart / 2 - 1, vbend / 2, vbstart / 2 - 1);
visarea.min_x = hbend / 2;
visarea.max_x = hbstart / 2 - 1;
visarea.min_y = vbend / 2;
visarea.max_y = vbstart / 2 - 1;
space->machine().primary_screen->configure(hperiod / 2, vperiod / 2, visarea, HZ_TO_ATTOSECONDS((double)pixel_clock * 2 / hperiod / vperiod)); space->machine().primary_screen->configure(hperiod / 2, vperiod / 2, visarea, HZ_TO_ATTOSECONDS((double)pixel_clock * 2 / hperiod / vperiod));
} }
} }

View File

@ -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) void K053936GP_set_cliprect(int chip, int minx, int maxx, int miny, int maxy)
{ {
rectangle &cliprect = K053936_cliprect[chip]; rectangle &cliprect = K053936_cliprect[chip];
cliprect.min_x = minx; cliprect.set(minx, maxx, miny, maxy);
cliprect.max_x = maxx;
cliprect.min_y = miny;
cliprect.max_y = maxy;
} }
INLINE void K053936GP_copyroz32clip( running_machine &machine, 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(); const rectangle &visarea = machine.primary_screen->visible_area();
int w = visarea.max_x - visarea.min_x + 1; int w = visarea.width();
int h = visarea.max_y - visarea.min_y + 1; int h = visarea.height();
UINT8 *zptr = gx_objzbuf; UINT8 *zptr = gx_objzbuf;
int ecx = h; int ecx = h;
@ -1575,7 +1572,7 @@ void konamigx_mixer(running_machine &machine, bitmap_rgb32 &bitmap, const rectan
{ {
int pixeldouble_output = 0; int pixeldouble_output = 0;
const rectangle &visarea = machine.primary_screen->visible_area(); 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 if (width>512) // vsnetscr case
pixeldouble_output = 1; 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_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.set(0, 512-1, 0, 512-1);
gxtype1_roz_dstbitmapclip.max_x = 512-1;
gxtype1_roz_dstbitmapclip.min_y = 0;
gxtype1_roz_dstbitmapclip.max_y = 512-1;
K053936_wraparound_enable(0, 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_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.set(0, 512-1, 0, 512-1);
gxtype1_roz_dstbitmapclip.max_x = 512-1;
gxtype1_roz_dstbitmapclip.min_y = 0;
gxtype1_roz_dstbitmapclip.max_y = 512-1;
K053936_wraparound_enable(0, 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 // we're going to throw half of this away anyway in post-process, so only render what's needed
rectangle temprect; rectangle temprect;
temprect.min_x = cliprect.min_x; temprect = cliprect;
temprect.max_x = cliprect.min_x+320; 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 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 else K053936_0_zoom_draw(*type3_roz_temp_bitmap, temprect,gx_psac_tilemap, 0,0,0); // soccerss playfield

View File

@ -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" }; static const char *const gunnames[] = { "LIGHT0_X", "LIGHT0_Y", "LIGHT1_X", "LIGHT1_Y" };
const rectangle &visarea = machine.primary_screen->visible_area(); const rectangle &visarea = machine.primary_screen->visible_area();
int width = visarea.max_x + 1 - visarea.min_x; int width = visarea.width();
int height = visarea.max_y + 1 - visarea.min_y; int height = visarea.height();
*x = ((input_port_read_safe(machine, gunnames[player * 2], 0x00) & 0xff) * width) / 255; *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; *y = ((input_port_read_safe(machine, gunnames[1 + player * 2], 0x00) & 0xff) * height) / 255;

View File

@ -211,10 +211,7 @@ void lordgun_update_gun(running_machine &machine, int i)
lorddgun_calc_gun_scr(machine, i); lorddgun_calc_gun_scr(machine, i);
if ( (state->m_gun[i].scr_x < visarea.min_x) || if (!visarea.contains(state->m_gun[i].scr_x, state->m_gun[i].scr_y))
(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) )
state->m_gun[i].hw_x = state->m_gun[i].hw_y = 0; state->m_gun[i].hw_x = state->m_gun[i].hw_y = 0;
} }

View File

@ -319,10 +319,7 @@ static void m107_tilemap_draw(running_machine &machine, bitmap_ind16 &bitmap, co
int line; int line;
rectangle clip; rectangle clip;
const rectangle &visarea = machine.primary_screen->visible_area(); const rectangle &visarea = machine.primary_screen->visible_area();
clip.min_x = visarea.min_x; clip = visarea;
clip.max_x = visarea.max_x;
clip.min_y = visarea.min_y;
clip.max_y = visarea.max_y;
if (state->m_control[0x08 + laynum] & 0x02) if (state->m_control[0x08 + laynum] & 0x02)
{ {

View File

@ -316,14 +316,7 @@ SCREEN_VBLANK( mermaid )
rect.max_x = sx + screen.machine().gfx[1]->width - 1; rect.max_x = sx + screen.machine().gfx[1]->width - 1;
rect.max_y = sy + screen.machine().gfx[1]->height - 1; rect.max_y = sy + screen.machine().gfx[1]->height - 1;
if (rect.min_x < visarea.min_x) rect &= visarea;
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;
// check collision sprite - background // check collision sprite - background
@ -426,14 +419,7 @@ SCREEN_VBLANK( mermaid )
rect.max_x = sx + screen.machine().gfx[1]->width - 1; rect.max_x = sx + screen.machine().gfx[1]->width - 1;
rect.max_y = sy + screen.machine().gfx[1]->height - 1; rect.max_y = sy + screen.machine().gfx[1]->height - 1;
if (rect.min_x < visarea.min_x) rect &= visarea;
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;
// check collision sprite - sprite // check collision sprite - sprite
@ -514,14 +500,7 @@ SCREEN_VBLANK( mermaid )
rect.max_x = sx + screen.machine().gfx[1]->width - 1; rect.max_x = sx + screen.machine().gfx[1]->width - 1;
rect.max_y = sy + screen.machine().gfx[1]->height - 1; rect.max_y = sy + screen.machine().gfx[1]->height - 1;
if (rect.min_x < visarea.min_x) rect &= visarea;
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;
// check collision sprite - sprite // check collision sprite - sprite

View File

@ -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) 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); WAVERAM_WRITEPIX(zeus_renderbase, y, x, color);
} }
INLINE void waveram_plot_depth(int y, int x, UINT16 color, UINT16 depth) 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_WRITEPIX(zeus_renderbase, y, x, color);
WAVERAM_WRITEDEPTH(zeus_renderbase, y, x, depth); 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) 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); UINT16 *depthptr = WAVERAM_PTRDEPTH(zeus_renderbase, y, x);
if (depth <= *depthptr) if (depth <= *depthptr)
@ -213,7 +213,7 @@ INLINE void waveram_plot_check_depth(int y, int x, UINT16 color, UINT16 depth)
#ifdef UNUSED_FUNCTION #ifdef UNUSED_FUNCTION
INLINE void waveram_plot_check_depth_nowrite(int y, int x, UINT16 color, UINT16 depth) 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); UINT16 *depthptr = WAVERAM_PTRDEPTH(zeus_renderbase, y, x);
if (depth <= *depthptr) if (depth <= *depthptr)
@ -743,12 +743,8 @@ static void zeus_register_update(running_machine &machine, offs_t offset)
{ {
int vtotal = zeusbase[0xca] >> 16; int vtotal = zeusbase[0xca] >> 16;
int htotal = zeusbase[0xc6] >> 16; int htotal = zeusbase[0xc6] >> 16;
rectangle visarea;
visarea.min_x = zeusbase[0xc6] & 0xffff; rectangle visarea(zeusbase[0xc6] & 0xffff, htotal - 3, 0, zeusbase[0xc8] & 0xffff);
visarea.max_x = htotal - 3;
visarea.min_y = 0;
visarea.max_y = zeusbase[0xc8] & 0xffff;
if (htotal > 0 && vtotal > 0 && visarea.min_x < visarea.max_x && visarea.max_y < vtotal) 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))); machine.primary_screen->configure(htotal, vtotal, visarea, HZ_TO_ATTOSECONDS((double)MIDZEUS_VIDEO_CLOCK / 8.0 / (htotal * vtotal)));

View File

@ -187,14 +187,14 @@ INLINE void *waveram0_ptr_from_texture_addr(UINT32 addr, int width)
#ifdef UNUSED_FUNCTION #ifdef UNUSED_FUNCTION
INLINE void waveram_plot(int y, int x, UINT32 color) 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); WAVERAM_WRITEPIX(zeus_renderbase, y, x, color);
} }
#endif #endif
INLINE void waveram_plot_depth(int y, int x, UINT32 color, UINT16 depth) 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_WRITEPIX(zeus_renderbase, y, x, color);
WAVERAM_WRITEDEPTH(zeus_renderbase, y, x, depth); 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 #ifdef UNUSED_FUNCTION
INLINE void waveram_plot_check_depth(int y, int x, UINT32 color, UINT16 depth) 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); UINT16 *depthptr = WAVERAM_PTRDEPTH(zeus_renderbase, y, x);
if (depth <= *depthptr) if (depth <= *depthptr)
@ -219,7 +219,7 @@ INLINE void waveram_plot_check_depth(int y, int x, UINT32 color, UINT16 depth)
#ifdef UNUSED_FUNCTION #ifdef UNUSED_FUNCTION
INLINE void waveram_plot_check_depth_nowrite(int y, int x, UINT32 color, UINT16 depth) 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); UINT16 *depthptr = WAVERAM_PTRDEPTH(zeus_renderbase, y, x);
if (depth <= *depthptr) 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 vtotal = zeusbase[0x37] & 0xffff;
int htotal = zeusbase[0x34] >> 16; int htotal = zeusbase[0x34] >> 16;
rectangle visarea;
visarea.min_x = zeusbase[0x33] >> 16; rectangle visarea(zeusbase[0x33] >> 16, (zeusbase[0x34] & 0xffff) - 1, 0, zeusbase[0x35] & 0xffff);
visarea.max_x = (zeusbase[0x34] & 0xffff) - 1;
visarea.min_y = 0;
visarea.max_y = zeusbase[0x35] & 0xffff;
if (htotal > 0 && vtotal > 0 && visarea.min_x < visarea.max_x && visarea.max_y < vtotal) 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))); machine.primary_screen->configure(htotal, vtotal, visarea, HZ_TO_ATTOSECONDS((double)MIDZEUS_VIDEO_CLOCK / 4.0 / (htotal * vtotal)));

View File

@ -928,21 +928,13 @@ static void model2_3d_render( model2_state *state, bitmap_rgb32 &bitmap, triangl
poly_manager *poly = state->m_poly; poly_manager *poly = state->m_poly;
poly_extra_data *extra = (poly_extra_data *)poly_get_extra_data(poly); poly_extra_data *extra = (poly_extra_data *)poly_get_extra_data(poly);
UINT8 renderer; UINT8 renderer;
rectangle vp;
/* select renderer based on attributes (bit15 = checker, bit14 = textured, bit13 = transparent */ /* select renderer based on attributes (bit15 = checker, bit14 = textured, bit13 = transparent */
renderer = (tri->texheader[0] >> 13) & 7; renderer = (tri->texheader[0] >> 13) & 7;
/* calculate and clip to viewport */ /* calculate and clip to viewport */
vp.min_x = tri->viewport[0] - 8; rectangle vp(tri->viewport[0] - 8, tri->viewport[2] - 8, (384-tri->viewport[3])+90, (384-tri->viewport[1])+90);
vp.max_x = tri->viewport[2] - 8; vp &= cliprect;
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;
extra->state = state; extra->state = state;
extra->lumabase = ((tri->texheader[1] & 0xFF) << 7) + ((tri->luma >> 5) ^ 0x7); 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>(); model2_state *state = machine.driver_data<model2_state>();
const rectangle &visarea = machine.primary_screen->visible_area(); const rectangle &visarea = machine.primary_screen->visible_area();
int width = visarea.max_x - visarea.min_x; int width = visarea.width();
int height = visarea.max_y - visarea.min_y; int height = visarea.height();
state->m_sys24_bitmap.allocate(width, height+4); state->m_sys24_bitmap.allocate(width, height+4);

View File

@ -357,10 +357,7 @@ SCREEN_UPDATE_IND16( model3 )
#endif #endif
state->m_screen_clip = (rectangle*)&cliprect; state->m_screen_clip = (rectangle*)&cliprect;
state->m_clip3d.min_x = cliprect.min_x; state->m_clip3d = cliprect;
state->m_clip3d.max_x = cliprect.max_x;
state->m_clip3d.min_y = cliprect.min_y;
state->m_clip3d.max_y = cliprect.max_y;
/* layer disable debug keys */ /* layer disable debug keys */
state->m_tick++; state->m_tick++;

View File

@ -143,10 +143,7 @@ SCREEN_UPDATE_IND16( namconb1 )
clip.min_y = (yclip>>16) - 0x21; clip.min_y = (yclip>>16) - 0x21;
clip.max_y = (yclip&0xffff) - 0x21 - 1; clip.max_y = (yclip&0xffff) - 0x21 - 1;
/* intersect with master clip rectangle */ /* intersect with master clip rectangle */
if( clip.min_x < cliprect.min_x ){ clip.min_x = cliprect.min_x; } clip &= cliprect;
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; }
bitmap.fill(get_black_pen(screen.machine()), cliprect ); bitmap.fill(get_black_pen(screen.machine()), cliprect );
@ -184,10 +181,7 @@ SCREEN_UPDATE_IND16( namconb2 )
clip.min_y = (yclip>>16) - 0x21; clip.min_y = (yclip>>16) - 0x21;
clip.max_y = (yclip&0xffff) - 0x21 - 1; clip.max_y = (yclip&0xffff) - 0x21 - 1;
/* intersect with master clip rectangle */ /* intersect with master clip rectangle */
if( clip.min_x < cliprect.min_x ){ clip.min_x = cliprect.min_x; } clip &= cliprect;
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; }
bitmap.fill(get_black_pen(screen.machine()), cliprect ); bitmap.fill(get_black_pen(screen.machine()), cliprect );

View File

@ -395,7 +395,7 @@ SCREEN_UPDATE_IND16( namcos1 )
i = ((state->m_cus116[6] << 8) | state->m_cus116[7]) - 0x11 - 1; // max y 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_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; return 0;

View File

@ -293,10 +293,7 @@ poly3d_Clip( float vx, float vy, float vw, float vh )
int cy = 240+vy; int cy = 240+vy;
mClip.cx = cx; mClip.cx = cx;
mClip.cy = cy; mClip.cy = cy;
mClip.scissor.min_x = cx + vw; mClip.scissor.set(cx + vw, cx - vw, cy + vh, cy - vh);
mClip.scissor.max_x = cx - vw;
mClip.scissor.min_y = cy + vh;
mClip.scissor.max_y = cy - vh;
if( mClip.scissor.min_x<0 ) mClip.scissor.min_x = 0; 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.max_x>639 ) mClip.scissor.max_x = 639;
if( mClip.scissor.min_y<0 ) mClip.scissor.min_y = 0; 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 ) sprite_Clip( int min_x, int max_x, int min_y, int max_y )
{ {
// cx/cy not used // cx/cy not used
mClip.scissor.min_x = min_x; mClip.scissor.set(min_x, max_x, min_y, max_y);
mClip.scissor.max_x = max_x;
mClip.scissor.min_y = min_y;
mClip.scissor.max_y = max_y;
if( mClip.scissor.min_x<0 ) mClip.scissor.min_x = 0; 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.max_x>639 ) mClip.scissor.max_x = 639;
if( mClip.scissor.min_y<0 ) mClip.scissor.min_y = 0; if( mClip.scissor.min_y<0 ) mClip.scissor.min_y = 0;
@ -322,10 +316,7 @@ poly3d_NoClip( void )
{ {
mClip.cx = 320; mClip.cx = 320;
mClip.cy = 240; mClip.cy = 240;
mClip.scissor.min_x = 0; mClip.scissor.set(0, 639, 0, 479);
mClip.scissor.max_x = 639;
mClip.scissor.min_y = 0;
mClip.scissor.max_y = 479;
} }
typedef struct typedef struct

View File

@ -259,17 +259,8 @@ SCREEN_UPDATE_IND16( pitnrun )
if (flip_screen_y_get(screen.machine())) if (flip_screen_y_get(screen.machine()))
dy=128-dy; dy=128-dy;
myclip.min_x=dx; myclip.set(dx, dx+127, dy, dy+127);
myclip.min_y=dy; myclip &= cliprect;
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;
tilemap_draw(bitmap,myclip,state->m_bg, 0,0); tilemap_draw(bitmap,myclip,state->m_bg, 0,0);
} }

Some files were not shown because too many files have changed in this diff Show More