diff options
author | Aaron Giles <aaron@aarongiles.com> | 2012-01-16 11:06:28 +0000 |
---|---|---|
committer | Aaron Giles <aaron@aarongiles.com> | 2012-01-16 11:06:28 +0000 |
commit | 59d84eb1b05c653c1e5c727e648e807bc8340baf (patch) | |
tree | 837413310dbe2d9b678860c072206bb244e8e693 /src/mame | |
parent | 051af55fa90955e11ba7fb08b586ba3227c4f7d1 (diff) |
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.
Diffstat (limited to 'src/mame')
106 files changed, 230 insertions, 648 deletions
diff --git a/src/mame/drivers/alg.c b/src/mame/drivers/alg.c index caabd183ad5..d54133bf06a 100644 --- a/src/mame/drivers/alg.c +++ b/src/mame/drivers/alg.c @@ -64,8 +64,8 @@ static int get_lightgun_pos(screen_device &screen, int player, int *x, int *y) if (xpos == -1 || ypos == -1) return FALSE; - *x = visarea.min_x + xpos * (visarea.max_x - visarea.min_x + 1) / 255; - *y = visarea.min_y + ypos * (visarea.max_y - visarea.min_y + 1) / 255; + *x = visarea.min_x + xpos * visarea.width() / 255; + *y = visarea.min_y + ypos * visarea.height() / 255; return TRUE; } diff --git a/src/mame/drivers/aristmk6.c b/src/mame/drivers/aristmk6.c index 2044bcb8533..f3b72584b74 100644 --- a/src/mame/drivers/aristmk6.c +++ b/src/mame/drivers/aristmk6.c @@ -86,7 +86,7 @@ SCREEN_UPDATE_RGB32(aristmk6) g = (g << 2) | (g & 3); b = (b << 3) | (b & 0x7); - if((x)<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y) + if(cliprect.contains(x, y)) bitmap.pix32(y, x) = r | g<<8 | b<<16; count+=2; @@ -97,7 +97,7 @@ SCREEN_UPDATE_RGB32(aristmk6) color = blit_ram[count]; - if((x)<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y) + if(cliprect.contains(x, y)) bitmap.pix32(y, x) = screen.machine().pens[color]; count++; diff --git a/src/mame/drivers/atarisy4.c b/src/mame/drivers/atarisy4.c index 018cba46edb..535867f3633 100644 --- a/src/mame/drivers/atarisy4.c +++ b/src/mame/drivers/atarisy4.c @@ -251,10 +251,7 @@ static void draw_polygon(atarisy4_state *state, UINT16 color) poly_vertex v1, v2, v3; poly_extra_data *extra = (poly_extra_data *)poly_get_extra_data(state->m_poly); - clip.min_x = 0; - clip.min_y = 0; - clip.max_x = 511; - clip.max_y = 511; + clip.set(0, 511, 0, 511); extra->color = color; extra->screen_ram = state->m_screen_ram; diff --git a/src/mame/drivers/bingor.c b/src/mame/drivers/bingor.c index 65b31428abc..d057e403fef 100644 --- a/src/mame/drivers/bingor.c +++ b/src/mame/drivers/bingor.c @@ -474,22 +474,22 @@ static SCREEN_UPDATE_RGB32(bingor) color = (state->m_blit_ram[count] & 0xf000)>>12; - if((x+3)<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y) + if(cliprect.contains(x+3, y)) bitmap.pix32(y, x+3) = screen.machine().pens[color]; color = (state->m_blit_ram[count] & 0x0f00)>>8; - if((x+2)<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y) + if(cliprect.contains(x+2, y)) bitmap.pix32(y, x+2) = screen.machine().pens[color]; color = (state->m_blit_ram[count] & 0x00f0)>>4; - if((x+1)<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y) + if(cliprect.contains(x+1, y)) bitmap.pix32(y, x+1) = screen.machine().pens[color]; color = (state->m_blit_ram[count] & 0x000f)>>0; - if((x+0)<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y) + if(cliprect.contains(x+0, y)) bitmap.pix32(y, x+0) = screen.machine().pens[color]; count++; diff --git a/src/mame/drivers/ccastles.c b/src/mame/drivers/ccastles.c index a6c8b323a44..b021db38401 100644 --- a/src/mame/drivers/ccastles.c +++ b/src/mame/drivers/ccastles.c @@ -210,10 +210,7 @@ static MACHINE_START( ccastles ) assert(state->m_vblank_end < state->m_vblank_start); /* reconfigure the visible area to match */ - visarea.min_x = 0; - visarea.max_x = 255; - visarea.min_y = state->m_vblank_end; - visarea.max_y = state->m_vblank_start - 1; + visarea.set(0, 255, state->m_vblank_end, state->m_vblank_start - 1); machine.primary_screen->configure(320, 256, visarea, HZ_TO_ATTOSECONDS(PIXEL_CLOCK) * VTOTAL * HTOTAL); /* configure the ROM banking */ diff --git a/src/mame/drivers/cloud9.c b/src/mame/drivers/cloud9.c index 09a08745806..863be86e742 100644 --- a/src/mame/drivers/cloud9.c +++ b/src/mame/drivers/cloud9.c @@ -179,10 +179,7 @@ static MACHINE_START( cloud9 ) assert(state->m_vblank_end < state->m_vblank_start); /* reconfigure the visible area to match */ - visarea.min_x = 0; - visarea.max_x = 255; - visarea.min_y = state->m_vblank_end + 1; - visarea.max_y = state->m_vblank_start; + visarea.set(0, 255, state->m_vblank_end + 1, state->m_vblank_start); machine.primary_screen->configure(320, 256, visarea, HZ_TO_ATTOSECONDS(PIXEL_CLOCK) * VTOTAL * HTOTAL); /* create a timer for IRQs and set up the first callback */ diff --git a/src/mame/drivers/cps3.c b/src/mame/drivers/cps3.c index 338baa4d142..7024b3fc387 100644 --- a/src/mame/drivers/cps3.c +++ b/src/mame/drivers/cps3.c @@ -847,10 +847,7 @@ static VIDEO_START(cps3) // between 0x00 and 0x80 (0x40 is normal, 0x80 would be 'view twice as much', 0x20 is 'view half as much') state->m_renderbuffer_bitmap.allocate(512*2,224*2); - state->m_renderbuffer_clip.min_x = 0; - state->m_renderbuffer_clip.max_x = state->m_screenwidth-1; - state->m_renderbuffer_clip.min_y = 0; - state->m_renderbuffer_clip.max_y = 224-1; + state->m_renderbuffer_clip.set(0, state->m_screenwidth-1, 0, 224-1); state->m_renderbuffer_bitmap.fill(0x3f, state->m_renderbuffer_clip); @@ -912,10 +909,7 @@ static void cps3_draw_tilemapsprite_line(running_machine &machine, int tmnum, in if (drawline>cliprect.max_y+4) return; - clip.min_x = cliprect.min_x; - clip.max_x = cliprect.max_x; - clip.min_y = drawline; - clip.max_y = drawline; + clip.set(cliprect.min_x, cliprect.max_x, drawline, drawline); for (x=0;x<(cliprect.max_x/16)+2;x++) { @@ -964,8 +958,7 @@ static SCREEN_UPDATE_RGB32(cps3) if (state->m_screenwidth!=496) { state->m_screenwidth = 496; - visarea.min_x = 0; visarea.max_x = 496-1; - visarea.min_y = 0; visarea.max_y = 224-1; + visarea.set(0, 496-1, 0, 224-1); screen.configure(496, 224, visarea, period); } } @@ -974,8 +967,7 @@ static SCREEN_UPDATE_RGB32(cps3) if (state->m_screenwidth!=384) { state->m_screenwidth = 384; - visarea.min_x = 0; visarea.max_x = 384-1; - visarea.min_y = 0; visarea.max_y = 224-1; + visarea.set(0, 384-1, 0, 224-1); screen.configure(384, 224, visarea, period); } } diff --git a/src/mame/drivers/cybertnk.c b/src/mame/drivers/cybertnk.c index c0d4706bb76..f73f0afe96f 100644 --- a/src/mame/drivers/cybertnk.c +++ b/src/mame/drivers/cybertnk.c @@ -208,12 +208,8 @@ static VIDEO_START( cybertnk ) static void draw_pixel( bitmap_ind16 &bitmap, const rectangle &cliprect, int y, int x, int pen) { - if (x>cliprect.max_x) return; - if (x<cliprect.min_x) return; - if (y>cliprect.max_y) return; - if (y<cliprect.min_y) return; - - bitmap.pix16(y, x) = pen; + if (cliprect.contains(x, y)) + bitmap.pix16(y, x) = pen; } static UINT32 update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int screen_shift) diff --git a/src/mame/drivers/flyball.c b/src/mame/drivers/flyball.c index 3ba3d79ad20..79ae63b4484 100644 --- a/src/mame/drivers/flyball.c +++ b/src/mame/drivers/flyball.c @@ -107,10 +107,7 @@ static SCREEN_UPDATE_IND16( flyball ) for (y = bally; y < bally + 2; y++) for (x = ballx; x < ballx + 2; x++) - if (x >= cliprect.min_x && - x <= cliprect.max_x && - y >= cliprect.min_y && - y <= cliprect.max_y) + if (cliprect.contains(x, y)) bitmap.pix16(y, x) = 1; return 0; } diff --git a/src/mame/drivers/gpworld.c b/src/mame/drivers/gpworld.c index 88bda1e0778..f87ca864db5 100644 --- a/src/mame/drivers/gpworld.c +++ b/src/mame/drivers/gpworld.c @@ -97,13 +97,8 @@ INLINE void draw_pixel(bitmap_ind16 &bitmap,const rectangle &cliprect,int x,int y = bitmap.height() - y - 1; } - if (x < cliprect.min_x || - x > cliprect.max_x || - y < cliprect.min_y || - y > cliprect.max_y) - return; - - bitmap.pix16(y, x) = color; + if (cliprect.contains(x, y)) + bitmap.pix16(y, x) = color; } static void gpworld_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) diff --git a/src/mame/drivers/gunpey.c b/src/mame/drivers/gunpey.c index 8328f5d7e38..b948045f0e5 100644 --- a/src/mame/drivers/gunpey.c +++ b/src/mame/drivers/gunpey.c @@ -89,7 +89,7 @@ static SCREEN_UPDATE_RGB32( gunpey ) g = (color & 0x03e0) >> 2; r = (color & 0x7c00) >> 7; - if(x<screen.visible_area().max_x && y<screen.visible_area().max_y) + if(cliprect.contains(x, y)) bitmap.pix32(y, x) = b | (g<<8) | (r<<16); diff --git a/src/mame/drivers/highvdeo.c b/src/mame/drivers/highvdeo.c index 080689516c2..4e3675cf2a3 100644 --- a/src/mame/drivers/highvdeo.c +++ b/src/mame/drivers/highvdeo.c @@ -125,12 +125,12 @@ static SCREEN_UPDATE_RGB32(tourvisn) color = ((state->m_blit_ram[count]) & 0x00ff)>>0; - if((x*2)<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y) + if(cliprect.contains((x*2)+0, y)) bitmap.pix32(y, (x*2)+0) = screen.machine().pens[color]; color = ((state->m_blit_ram[count]) & 0xff00)>>8; - if(((x*2)+1)<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y) + if(cliprect.contains((x*2)+1, y)) bitmap.pix32(y, (x*2)+1) = screen.machine().pens[color]; count++; @@ -162,7 +162,7 @@ static SCREEN_UPDATE_RGB32(brasil) b = (color & 0x001f) << 3; g = (color & 0x07e0) >> 3; r = (color & 0xf800) >> 8; - if(x<screen.visible_area().max_x && y<screen.visible_area().max_y) + if(cliprect.contains(x, y)) bitmap.pix32(y, x) = b | (g<<8) | (r<<16); count++; diff --git a/src/mame/drivers/hng64.c b/src/mame/drivers/hng64.c index 93d18712217..ae3915c6b46 100644 --- a/src/mame/drivers/hng64.c +++ b/src/mame/drivers/hng64.c @@ -935,10 +935,7 @@ static WRITE32_HANDLER( tcram_w ) state->m_screen_dis = 0; - visarea.min_x = min_x; - visarea.max_x = min_x + max_x - 1; - visarea.min_y = min_y; - visarea.max_y = min_y + max_y - 1; + visarea.set(min_x, min_x + max_x - 1, min_y, min_y + max_y - 1); space->machine().primary_screen->configure(HTOTAL, VTOTAL, visarea, space->machine().primary_screen->frame_period().attoseconds ); } } diff --git a/src/mame/drivers/igs009.c b/src/mame/drivers/igs009.c index c86230922f6..94bc2fd7c7e 100644 --- a/src/mame/drivers/igs009.c +++ b/src/mame/drivers/igs009.c @@ -298,10 +298,7 @@ static SCREEN_UPDATE_IND16(jingbell) int rowenable = state->m_bg_scroll2[zz]; /* draw top of screen */ - clip.min_x = visarea.min_x; - clip.max_x = visarea.max_x; - clip.min_y = startclipmin; - clip.max_y = startclipmin+2; + clip.set(visarea.min_x, visarea.max_x, startclipmin, startclipmin+2); bitmap.fill(screen.machine().pens[rowenable], clip); diff --git a/src/mame/drivers/igs011.c b/src/mame/drivers/igs011.c index 380f7cb7f27..68f185f4c99 100644 --- a/src/mame/drivers/igs011.c +++ b/src/mame/drivers/igs011.c @@ -436,7 +436,7 @@ static WRITE16_HANDLER( igs011_blit_flags_w ) } // plot it - if (x >= clip.min_x && x <= clip.max_x && y >= clip.min_y && y <= clip.max_y) + if (clip.contains(x, y)) { if (clear) dest[x + y * 512] = clear_pen; else if (pen != trans_pen) dest[x + y * 512] = pen | pen_hi; diff --git a/src/mame/drivers/itgambl2.c b/src/mame/drivers/itgambl2.c index 6518c018c7a..cb2616b4971 100644 --- a/src/mame/drivers/itgambl2.c +++ b/src/mame/drivers/itgambl2.c @@ -126,7 +126,7 @@ static SCREEN_UPDATE_RGB32( itgambl2 ) color = (blit_ram[count] & 0xff)>>0; - if((x)<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y) + if(cliprect.contains(x, y)) bitmap.pix32(y, x) = screen.machine().pens[color]; count++; diff --git a/src/mame/drivers/itgambl3.c b/src/mame/drivers/itgambl3.c index a4413230735..9446d97846c 100644 --- a/src/mame/drivers/itgambl3.c +++ b/src/mame/drivers/itgambl3.c @@ -114,7 +114,7 @@ static SCREEN_UPDATE_RGB32( itgambl3 ) color = (blit_ram[count] & 0xff)>>0; - if((x)<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y) + if(cliprect.contains(x, y)) bitmap.pix32(y, x) = screen.machine().pens[color]; count++; diff --git a/src/mame/drivers/jackie.c b/src/mame/drivers/jackie.c index e4a638afb20..30478f81dfb 100644 --- a/src/mame/drivers/jackie.c +++ b/src/mame/drivers/jackie.c @@ -196,10 +196,7 @@ static SCREEN_UPDATE_IND16(jackie) int rowenable = state->m_bg_scroll2[j]; /* draw top of screen */ - clip.min_x = visarea.min_x; - clip.max_x = visarea.max_x; - clip.min_y = startclipmin; - clip.max_y = startclipmin+1; + clip.set(visarea.min_x, visarea.max_x, startclipmin, startclipmin+1); if (rowenable==0) { diff --git a/src/mame/drivers/jantotsu.c b/src/mame/drivers/jantotsu.c index 402e41eca06..55726f21311 100644 --- a/src/mame/drivers/jantotsu.c +++ b/src/mame/drivers/jantotsu.c @@ -158,7 +158,7 @@ static SCREEN_UPDATE_RGB32(jantotsu) for(pen_i = 0;pen_i<4;pen_i++) color |= (((state->m_bitmap[count + pen_i*0x2000]) >> (7 - i)) & 1) << pen_i; - if ((x + i) <= screen.visible_area().max_x && (y + 0) < screen.visible_area().max_y) + if (cliprect.contains(x + i, y)) bitmap.pix32(y, x + i) = screen.machine().pens[color]; } diff --git a/src/mame/drivers/kingdrby.c b/src/mame/drivers/kingdrby.c index df0edf0c3a6..28d596c9e2c 100644 --- a/src/mame/drivers/kingdrby.c +++ b/src/mame/drivers/kingdrby.c @@ -222,10 +222,7 @@ static SCREEN_UPDATE_IND16(kingdrby) tilemap_set_scrolly( state->m_sc0w_tilemap,0, 32); /* maybe it needs two window tilemaps? (one at the top, the other at the bottom)*/ - clip.min_x = visarea.min_x; - clip.max_x = 256; - clip.min_y = 192; - clip.max_y = visarea.max_y; + clip.set(visarea.min_x, 256, 192, visarea.max_y); /*TILEMAP_DRAW_CATEGORY + TILEMAP_DRAW_OPAQUE doesn't suit well?*/ tilemap_draw(bitmap,cliprect,state->m_sc0_tilemap,0,0); diff --git a/src/mame/drivers/limenko.c b/src/mame/drivers/limenko.c index f257d85a78d..bbe77ba77c3 100644 --- a/src/mame/drivers/limenko.c +++ b/src/mame/drivers/limenko.c @@ -119,11 +119,7 @@ static CUSTOM_INPUT( spriteram_bit_r ) static WRITE32_HANDLER( spriteram_buffer_w ) { limenko_state *state = space->machine().driver_data<limenko_state>(); - rectangle clip; - clip.min_x = 0; - clip.max_x = 383; - clip.min_y = 0; - clip.max_y = 239; + rectangle clip(0, 383, 0, 239); state->m_sprites_bitmap_pri.fill(0, clip); state->m_sprites_bitmap.fill(0, clip); diff --git a/src/mame/drivers/luckgrln.c b/src/mame/drivers/luckgrln.c index ddb27752d0d..001f51588e0 100644 --- a/src/mame/drivers/luckgrln.c +++ b/src/mame/drivers/luckgrln.c @@ -269,12 +269,7 @@ static SCREEN_UPDATE_IND16(luckgrln) const rectangle &visarea = screen.visible_area(); int i; - rectangle clip; - - clip.min_x = visarea.min_x; - clip.max_x = visarea.max_x; - clip.min_y = visarea.min_y; - clip.max_y = visarea.max_y; + rectangle clip = visarea; bitmap.fill(0, cliprect); diff --git a/src/mame/drivers/magicard.c b/src/mame/drivers/magicard.c index a5f70ac9fa3..55d78c070bf 100644 --- a/src/mame/drivers/magicard.c +++ b/src/mame/drivers/magicard.c @@ -402,22 +402,22 @@ static SCREEN_UPDATE_RGB32(magicard) color = ((state->m_magicram[count]) & 0x000f)>>0; - if(((x*4)+3)<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y) + if(cliprect.contains((x*4)+3, y)) bitmap.pix32(y, (x*4)+3) = screen.machine().pens[color]; color = ((state->m_magicram[count]) & 0x00f0)>>4; - if(((x*4)+2)<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y) + if(cliprect.contains((x*4)+2, y)) bitmap.pix32(y, (x*4)+2) = screen.machine().pens[color]; color = ((state->m_magicram[count]) & 0x0f00)>>8; - if(((x*4)+1)<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y) + if(cliprect.contains((x*4)+1, y)) bitmap.pix32(y, (x*4)+1) = screen.machine().pens[color]; color = ((state->m_magicram[count]) & 0xf000)>>12; - if(((x*4)+0)<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y) + if(cliprect.contains((x*4)+0, y)) bitmap.pix32(y, (x*4)+0) = screen.machine().pens[color]; count++; @@ -434,12 +434,12 @@ static SCREEN_UPDATE_RGB32(magicard) color = ((state->m_magicram[count]) & 0x00ff)>>0; - if(((x*2)+1)<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y) + if(cliprect.contains((x*2)+1, y)) bitmap.pix32(y, (x*2)+1) = screen.machine().pens[color]; color = ((state->m_magicram[count]) & 0xff00)>>8; - if(((x*2)+0)<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y) + if(cliprect.contains((x*2)+0, y)) bitmap.pix32(y, (x*2)+0) = screen.machine().pens[color]; count++; diff --git a/src/mame/drivers/majorpkr.c b/src/mame/drivers/majorpkr.c index 5df9310d52c..01e96f1ed06 100644 --- a/src/mame/drivers/majorpkr.c +++ b/src/mame/drivers/majorpkr.c @@ -532,10 +532,8 @@ static SCREEN_UPDATE_IND16(majorpkr) /* The following custom_clip is to exclude the last char column (unused) form the render. We need more proof about how the video is working. */ - custom_clip.min_x=cliprect.min_x; - custom_clip.max_x=cliprect.max_x-16; - custom_clip.min_y=cliprect.min_y; - custom_clip.max_y=cliprect.max_y; + custom_clip = cliprect; + custom_clip.max_x -= 16; tilemap_draw(bitmap, custom_clip, state->m_bg_tilemap, 0, 0); tilemap_draw(bitmap, custom_clip, state->m_fg_tilemap, 0, 0); diff --git a/src/mame/drivers/marinedt.c b/src/mame/drivers/marinedt.c index 3f7745ab127..a4612f6327e 100644 --- a/src/mame/drivers/marinedt.c +++ b/src/mame/drivers/marinedt.c @@ -547,7 +547,7 @@ static SCREEN_UPDATE_IND16( marinedt ) int x = OBJ_X(state->m_obj1_x) + sx; int y = OBJ_Y(state->m_obj1_y) + sy; - if (x < cliprect.min_x || x > cliprect.max_x || y < cliprect.min_y || y > cliprect.max_y) + if (!cliprect.contains(x, y)) continue; if (state->m_obj1->pix16(sy, sx) == 0) diff --git a/src/mame/drivers/mediagx.c b/src/mame/drivers/mediagx.c index 6e103633998..dc2ee5500a9 100644 --- a/src/mame/drivers/mediagx.c +++ b/src/mame/drivers/mediagx.c @@ -251,9 +251,7 @@ static void draw_framebuffer(running_machine &machine, bitmap_rgb32 &bitmap, con state->m_frame_width = width; state->m_frame_height = height; - visarea.min_x = visarea.min_y = 0; - visarea.max_x = width - 1; - visarea.max_y = height - 1; + visarea.set(0, width - 1, 0, height - 1); machine.primary_screen->configure(width, height * 262 / 240, visarea, machine.primary_screen->frame_period().attoseconds); } diff --git a/src/mame/drivers/midzeus.c b/src/mame/drivers/midzeus.c index a26142af808..c1071839e5d 100644 --- a/src/mame/drivers/midzeus.c +++ b/src/mame/drivers/midzeus.c @@ -531,8 +531,8 @@ static WRITE32_HANDLER( invasn_gun_w ) { "GUNX1", "GUNY1" }, { "GUNX2", "GUNY2" } }; - gun_x[player] = input_port_read(space->machine(), names[player][0]) * (visarea.max_x + 1 - visarea.min_x) / 255 + visarea.min_x + BEAM_XOFFS; - gun_y[player] = input_port_read(space->machine(), names[player][1]) * (visarea.max_y + 1 - visarea.min_y) / 255 + visarea.min_y; + gun_x[player] = input_port_read(space->machine(), names[player][0]) * visarea.width() / 255 + visarea.min_x + BEAM_XOFFS; + gun_y[player] = input_port_read(space->machine(), names[player][1]) * visarea.height() / 255 + visarea.min_y; gun_timer[player]->adjust(space->machine().primary_screen->time_until_pos(MAX(0, gun_y[player] - BEAM_DY), MAX(0, gun_x[player] - BEAM_DX)), player); } } diff --git a/src/mame/drivers/mogura.c b/src/mame/drivers/mogura.c index 0b70415a7d0..a735263e4bf 100644 --- a/src/mame/drivers/mogura.c +++ b/src/mame/drivers/mogura.c @@ -84,18 +84,13 @@ static SCREEN_UPDATE_IND16( mogura ) const rectangle &visarea = screen.visible_area(); /* tilemap layout is a bit strange ... */ - rectangle clip; - clip.min_x = visarea.min_x; + rectangle clip = visarea; clip.max_x = 256 - 1; - clip.min_y = visarea.min_y; - clip.max_y = visarea.max_y; tilemap_set_scrollx(state->m_tilemap, 0, 256); tilemap_draw(bitmap, clip, state->m_tilemap, 0, 0); clip.min_x = 256; clip.max_x = 512 - 1; - clip.min_y = visarea.min_y; - clip.max_y = visarea.max_y; tilemap_set_scrollx(state->m_tilemap, 0, -128); tilemap_draw(bitmap, clip, state->m_tilemap, 0, 0); diff --git a/src/mame/drivers/namcoic.c b/src/mame/drivers/namcoic.c index 14964993423..4b964350b29 100644 --- a/src/mame/drivers/namcoic.c +++ b/src/mame/drivers/namcoic.c @@ -584,15 +584,8 @@ namcos2_draw_sprites_metalhawk(running_machine &machine, bitmap_ind16 &bitmap, c } /* Set the clipping rect to mask off the other portion of the sprite */ - rect.min_x=sx; - rect.max_x=sx+(sizex-1); - rect.min_y=sy; - rect.max_y=sy+(sizey-1); - - if (cliprect.min_x > rect.min_x) rect.min_x = cliprect.min_x; - if (cliprect.max_x < rect.max_x) rect.max_x = cliprect.max_x; - if (cliprect.min_y > rect.min_y) rect.min_y = cliprect.min_y; - if (cliprect.max_y < rect.max_y) rect.max_y = cliprect.max_y; + rect.set(sx, sx+(sizex-1), sy, sy+(sizey-1)); + rect &= cliprect; if( !bBigSprite ) { @@ -604,10 +597,7 @@ namcos2_draw_sprites_metalhawk(running_machine &machine, bitmap_ind16 &bitmap, c sx -= (tile&1)?16:0; sy -= (tile&2)?16:0; - rect.min_x=sx; - rect.max_x=sx+(sizex-1); - rect.min_y=sy; - rect.max_y=sy+(sizey-1); + rect.set(sx, sx+(sizex-1), sy, sy+(sizey-1)); rect.min_x += (tile&1)?16:0; rect.max_x += (tile&1)?16:0; rect.min_y += (tile&2)?16:0; @@ -804,14 +794,8 @@ draw_spriteC355(running_machine &machine, _BitmapClass &bitmap, const rectangle hpos -= xscroll; vpos -= yscroll; pWinAttr = &spriteram16[0x2400/2+((palette>>8)&0xf)*4]; - clip.min_x = pWinAttr[0] - xscroll; - clip.max_x = pWinAttr[1] - xscroll; - clip.min_y = pWinAttr[2] - yscroll; - clip.max_y = pWinAttr[3] - yscroll; - if( clip.min_x < cliprect.min_x ){ clip.min_x = cliprect.min_x; } - if( clip.min_y < cliprect.min_y ){ clip.min_y = cliprect.min_y; } - if( clip.max_x > cliprect.max_x ){ clip.max_x = cliprect.max_x; } - if( clip.max_y > cliprect.max_y ){ clip.max_y = cliprect.max_y; } + clip.set(pWinAttr[0] - xscroll, pWinAttr[1] - xscroll, pWinAttr[2] - yscroll, pWinAttr[3] - yscroll); + clip &= cliprect; hpos&=0x7ff; if( hpos&0x400 ) hpos |= ~0x7ff; /* sign extend */ vpos&=0x7ff; if( vpos&0x400 ) vpos |= ~0x7ff; /* sign extend */ @@ -1310,14 +1294,8 @@ DrawRozScanline( bitmap_ind16 &bitmap, int line, int which, int pri, const recta UnpackRozParam( pSource, &rozInfo ); if( pri == rozInfo.priority ) { - clip.min_x = 0; - clip.max_x = bitmap.width()-1; - clip.min_y = clip.max_y = line; - - if( clip.min_x < cliprect.min_x ){ clip.min_x = cliprect.min_x; } - if( clip.min_y < cliprect.min_y ){ clip.min_y = cliprect.min_y; } - if( clip.max_x > cliprect.max_x ){ clip.max_x = cliprect.max_x; } - if( clip.max_y > cliprect.max_y ){ clip.max_y = cliprect.max_y; } + clip.set(0, bitmap.width()-1, line, line); + clip &= cliprect; DrawRozHelper( bitmap, mRozTilemap[which], clip, &rozInfo ); } /* priority */ diff --git a/src/mame/drivers/pcxt.c b/src/mame/drivers/pcxt.c index d78bfb82b82..62fda31692f 100644 --- a/src/mame/drivers/pcxt.c +++ b/src/mame/drivers/pcxt.c @@ -120,7 +120,7 @@ static SCREEN_UPDATE_RGB32( tetriskr ) for(pen_i = 0;pen_i<4;pen_i++) color |= ((bg_rom[y*320/8+x+(pen_i*0x20000)+yi*0x400+state->m_bg_bank*0x2000+1] >> (7-xi)) & 1) << pen_i; - if((x+xi)<screen.visible_area().max_x && ((y)+yi)<screen.visible_area().max_y) + if(cliprect.contains(x*8+xi, y*8+yi)) bitmap.pix32(y*8+yi, x*8+xi) = screen.machine().pens[color]; } } diff --git a/src/mame/drivers/peplus.c b/src/mame/drivers/peplus.c index 035728fad8f..e6b9837334a 100644 --- a/src/mame/drivers/peplus.c +++ b/src/mame/drivers/peplus.c @@ -321,8 +321,8 @@ static void handle_lightpen( device_t *device ) const rectangle &vis_area = device->machine().primary_screen->visible_area(); int xt, yt; - xt = x_val * (vis_area.max_x - vis_area.min_x) / 1024 + vis_area.min_x; - yt = y_val * (vis_area.max_y - vis_area.min_y) / 1024 + vis_area.min_y; + xt = x_val * vis_area.width() / 1024 + vis_area.min_x; + yt = y_val * vis_area.height() / 1024 + vis_area.min_y; device->machine().scheduler().timer_set(device->machine().primary_screen->time_until_pos(yt, xt), FUNC(assert_lp_cb), 0, device); } diff --git a/src/mame/drivers/progolf.c b/src/mame/drivers/progolf.c index 79275c7dc01..0d200c586d7 100644 --- a/src/mame/drivers/progolf.c +++ b/src/mame/drivers/progolf.c @@ -127,7 +127,7 @@ static SCREEN_UPDATE_IND16( progolf ) { color = state->m_fg_fb[(xi+yi*8)+count*0x40]; - if((x+yi) <= cliprect.max_x && (256-y+xi) <= cliprect.max_y && color != 0) + if(cliprect.contains(x+yi, 256-y+xi)) bitmap.pix16(x+yi, 256-y+xi) = screen.machine().pens[(color & 0x7)]; } } diff --git a/src/mame/drivers/rabbit.c b/src/mame/drivers/rabbit.c index 7640e8ea5e6..9c1fb2079e9 100644 --- a/src/mame/drivers/rabbit.c +++ b/src/mame/drivers/rabbit.c @@ -377,10 +377,7 @@ static VIDEO_START(rabbit) tilemap_map_pen_to_layer(state->m_tilemap[3], 1, 255, TILEMAP_PIXEL_TRANSPARENT); state->m_sprite_bitmap = auto_bitmap_ind16_alloc(machine,0x1000,0x1000); - state->m_sprite_clip.min_x = 0; - state->m_sprite_clip.max_x = 0x1000-1; - state->m_sprite_clip.min_y = 0; - state->m_sprite_clip.max_y = 0x1000-1; + state->m_sprite_clip.set(0, 0x1000-1, 0, 0x1000-1); } /* diff --git a/src/mame/drivers/sfbonus.c b/src/mame/drivers/sfbonus.c index 7fe98e6465a..c574fd265fb 100644 --- a/src/mame/drivers/sfbonus.c +++ b/src/mame/drivers/sfbonus.c @@ -830,10 +830,7 @@ static void sfbonus_draw_reel_layer(screen_device &screen, bitmap_ind16 &bitmap, //printf("%04x %04x %d\n",zz, xxxscroll, line/8); /* draw top of screen */ - clip.min_x = visarea.min_x; - clip.max_x = 511; - clip.min_y = startclipmin; - clip.max_y = startclipmin; + clip.set(visarea.min_x, 511, startclipmin, startclipmin); diff --git a/src/mame/drivers/srmp5.c b/src/mame/drivers/srmp5.c index 23edbb54596..90cea6a8c16 100644 --- a/src/mame/drivers/srmp5.c +++ b/src/mame/drivers/srmp5.c @@ -92,7 +92,6 @@ static SCREEN_UPDATE_RGB32( srmp5 ) UINT16 *sprite_list=state->m_sprram; UINT16 *sprite_list_end=&state->m_sprram[0x4000]; //guess UINT8 *pixels=(UINT8 *)state->m_tileram; - const rectangle &visarea = screen.visible_area(); //Table surface seems to be tiles, but display corrupts when switching the scene if always ON. //Currently the tiles are OFF. @@ -168,7 +167,7 @@ static SCREEN_UPDATE_RGB32( srmp5 ) xs2 = (sprite_sublist[SPRITE_PALETTE] & 0x8000) ? (sizex - xs) : xs; if(pen) { - if(xb+xs2<=visarea.max_x && xb+xs2>=visarea.min_x && yb+ys2<=visarea.max_y && yb+ys2>=visarea.min_y ) + if(cliprect.contains(xb+xs2, yb+ys2)) { UINT16 pixdata=state->m_palram[pen+((sprite_sublist[SPRITE_PALETTE]&0xff)<<8)]; bitmap.pix32(yb+ys2, xb+xs2) = ((pixdata&0x7c00)>>7) | ((pixdata&0x3e0)<<6) | ((pixdata&0x1f)<<19); diff --git a/src/mame/drivers/taitowlf.c b/src/mame/drivers/taitowlf.c index 838fd420010..b287b405ae2 100644 --- a/src/mame/drivers/taitowlf.c +++ b/src/mame/drivers/taitowlf.c @@ -80,7 +80,7 @@ static SCREEN_UPDATE_RGB32( taitowlf ) color = (blit_ram[count] & 0xff); - if((x)+0<screen.visible_area().max_x && ((y)+0)<screen.visible_area().max_y) + if(cliprect.contains(x+0, y)) bitmap.pix32(y, x+0) = screen.machine().pens[color]; count++; diff --git a/src/mame/drivers/tickee.c b/src/mame/drivers/tickee.c index 1c90be35307..4b8dc70000a 100644 --- a/src/mame/drivers/tickee.c +++ b/src/mame/drivers/tickee.c @@ -60,8 +60,8 @@ INLINE void get_crosshair_xy(running_machine &machine, int player, int *x, int * { const rectangle &visarea = machine.primary_screen->visible_area(); - *x = (((input_port_read(machine, player ? "GUNX2" : "GUNX1") & 0xff) * (visarea.max_x - visarea.min_x)) >> 8) + visarea.min_x; - *y = (((input_port_read(machine, player ? "GUNY2" : "GUNY1") & 0xff) * (visarea.max_y - visarea.min_y)) >> 8) + visarea.min_y; + *x = (((input_port_read(machine, player ? "GUNX2" : "GUNX1") & 0xff) * visarea.width()) >> 8) + visarea.min_x; + *y = (((input_port_read(machine, player ? "GUNY2" : "GUNY1") & 0xff) * visarea.height()) >> 8) + visarea.min_y; } diff --git a/src/mame/drivers/tmmjprd.c b/src/mame/drivers/tmmjprd.c index cc7cb0f291a..40be0f3dc0e 100644 --- a/src/mame/drivers/tmmjprd.c +++ b/src/mame/drivers/tmmjprd.c @@ -192,7 +192,7 @@ static void ttmjprd_draw_tile(running_machine &machine, bitmap_ind16 &bitmap, co if (!depth) { - if ((drawx < cliprect.max_x) && (drawx > cliprect.min_x) && (drawy < cliprect.max_y) && (drawy > cliprect.min_y)) + if (cliprect.contains(drawx, drawy)) { dat = (rom[(tileaddr*32)+count] & 0xf0)>>4; if (dat!=15) @@ -203,7 +203,7 @@ static void ttmjprd_draw_tile(running_machine &machine, bitmap_ind16 &bitmap, co } } drawx++; - if ((drawx < cliprect.max_x) && (drawx > cliprect.min_x) && (drawy < cliprect.max_y) && (drawy > cliprect.min_y)) + if (cliprect.contains(drawx, drawy)) { dat = (rom[(tileaddr*32)+count] & 0x0f); if (dat!=15) @@ -218,7 +218,7 @@ static void ttmjprd_draw_tile(running_machine &machine, bitmap_ind16 &bitmap, co } else { - if ((drawx < cliprect.max_x) && (drawx > cliprect.min_x) && (drawy < cliprect.max_y) && (drawy > cliprect.min_y)) + if (cliprect.contains(drawx, drawy)) { dat = (rom[(tileaddr*32)+count] & 0xff); if (dat!=255) diff --git a/src/mame/machine/megadriv.c b/src/mame/machine/megadriv.c index e6eaa5aacd4..c1ab95fa3fa 100644 --- a/src/mame/machine/megadriv.c +++ b/src/mame/machine/megadriv.c @@ -9483,10 +9483,7 @@ int megadrive_z80irq_hpos = 320; } // mame_printf_debug("my mode %02x", megadrive_vdp_register[0x0c]); - visarea.min_x = 0; - visarea.max_x = scr_width-1; - visarea.min_y = 0; - visarea.max_y = megadrive_visible_scanlines-1; + visarea.set(0, scr_width-1, 0, megadrive_visible_scanlines-1); screen.machine().primary_screen->configure(scr_width, megadrive_visible_scanlines, visarea, HZ_TO_ATTOSECONDS(megadriv_framerate)); diff --git a/src/mame/machine/segamsys.c b/src/mame/machine/segamsys.c index fbcbe640462..3f2163a76ad 100644 --- a/src/mame/machine/segamsys.c +++ b/src/mame/machine/segamsys.c @@ -1150,23 +1150,14 @@ static void end_of_frame(running_machine &machine, struct sms_vdp *chip) if (chip->vdp_type!=GG_VDP) /* In GG mode the Game Gear resolution is fixed */ { - rectangle visarea; - - visarea.min_x = 0; - visarea.max_x = 256-1; - visarea.min_y = 0; - visarea.max_y = sms_mode_table[chip->screen_mode].sms2_height-1; + rectangle visarea(0, 256-1, 0, sms_mode_table[chip->screen_mode].sms2_height-1); if (chip->chip_id==3) machine.primary_screen->configure(256, 256, visarea, HZ_TO_ATTOSECONDS(chip->sms_framerate)); } else /* 160x144 */ { - rectangle visarea; - visarea.min_x = (256-160)/2; - visarea.max_x = (256-160)/2+160-1; - visarea.min_y = (192-144)/2; - visarea.max_y = (192-144)/2+144-1; + rectangle visarea((256-160)/2, (256-160)/2+160-1, (192-144)/2, (192-144)/2+144-1); machine.primary_screen->configure(256, 256, visarea, HZ_TO_ATTOSECONDS(chip->sms_framerate)); } diff --git a/src/mame/video/angelkds.c b/src/mame/video/angelkds.c index 9656436f639..222aae91228 100644 --- a/src/mame/video/angelkds.c +++ b/src/mame/video/angelkds.c @@ -281,10 +281,7 @@ SCREEN_UPDATE_IND16( angelkds ) bitmap.fill(0x3f, cliprect); /* is there a register controling the colour?, we currently use the last colour of the tx palette */ /* draw top of screen */ - clip.min_x = 8*0; - clip.max_x = 8*16-1; - clip.min_y = visarea.min_y; - clip.max_y = visarea.max_y; + clip.set(8*0, 8*16-1, visarea.min_y, visarea.max_y); if ((state->m_layer_ctrl & 0x80) == 0x00) tilemap_draw(bitmap, clip, state->m_bgtop_tilemap, 0, 0); @@ -295,10 +292,7 @@ SCREEN_UPDATE_IND16( angelkds ) tilemap_draw(bitmap, clip, state->m_tx_tilemap, 0, 0); /* draw bottom of screen */ - clip.min_x = 8*16; - clip.max_x = 8*32-1; - clip.min_y = visarea.min_y; - clip.max_y = visarea.max_y; + clip.set(8*16, 8*32-1, visarea.min_y, visarea.max_y); if ((state->m_layer_ctrl & 0x40) == 0x00) tilemap_draw(bitmap, clip, state->m_bgbot_tilemap, 0, 0); diff --git a/src/mame/video/archimds.c b/src/mame/video/archimds.c index 1a5a4f976cd..8b436ce1e83 100644 --- a/src/mame/video/archimds.c +++ b/src/mame/video/archimds.c @@ -64,20 +64,14 @@ SCREEN_UPDATE_RGB32( archimds_vidc ) if(vidc_interlace) { - if ((res_x) >= 0 && - (res_y) >= 0 && - (res_x) <= screen.visible_area().max_x && (res_y) <= screen.visible_area().max_y && (res_x) <= xend && (res_y) <= yend) + if (cliprect.contains(res_x, res_y) && (res_x) <= xend && (res_y) <= yend) bitmap.pix32(res_y, res_x) = screen.machine().pens[(pen>>(xi))&0x1]; - if ((res_x) >= 0 && - (res_y) >= 0 && - (res_x) <= screen.visible_area().max_x && (res_y+1) <= screen.visible_area().max_y && (res_x) <= xend && (res_y+1) <= yend) + if (cliprect.contains(res_x, res_y+1) && (res_x) <= xend && (res_y+1) <= yend) bitmap.pix32(res_y+1, res_x) = screen.machine().pens[(pen>>(xi))&0x1]; } else { - if ((res_x) >= 0 && - (res_y) >= 0 && - (res_x) <= screen.visible_area().max_x && (res_y) <= screen.visible_area().max_y && (res_x) <= xend && (res_y) <= yend) + if (cliprect.contains(res_x, res_y) && (res_x) <= xend && (res_y) <= yend) bitmap.pix32(res_y, res_x) = screen.machine().pens[(pen>>(xi))&0x1]; } } @@ -100,20 +94,14 @@ SCREEN_UPDATE_RGB32( archimds_vidc ) if(vidc_interlace) { - if ((res_x) >= 0 && - (res_y) >= 0 && - (res_x) <= screen.visible_area().max_x && (res_y) <= screen.visible_area().max_y && (res_x) <= xend && (res_y) <= yend) + if (cliprect.contains(res_x, res_y) && (res_x) <= xend && (res_y) <= yend) bitmap.pix32(res_y, res_x) = screen.machine().pens[(pen&0xff)+0x100]; - if ((res_x) >= 0 && - (res_y) >= 0 && - (res_x) <= screen.visible_area().max_x && (res_y+1) <= screen.visible_area().max_y && (res_x) <= xend && (res_y+1) <= yend) + if (cliprect.contains(res_x, res_y) && (res_x) <= xend && (res_y+1) <= yend) bitmap.pix32(res_y+1, res_x) = screen.machine().pens[(pen&0xff)+0x100]; } else { - if ((res_x) >= 0 && - (res_y) >= 0 && - (res_x) <= screen.visible_area().max_x && (res_y) <= screen.visible_area().max_y && (res_x) <= xend && (res_y) <= yend) + if (cliprect.contains(res_x, res_y) && (res_x) <= xend && (res_y) <= yend) bitmap.pix32(res_y, res_x) = screen.machine().pens[(pen&0xff)+0x100]; } diff --git a/src/mame/video/beathead.c b/src/mame/video/beathead.c index 35b4b3e389b..c961bc90d50 100644 --- a/src/mame/video/beathead.c +++ b/src/mame/video/beathead.c @@ -182,7 +182,7 @@ UINT32 beathead_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap } /* then draw it */ - draw_scanline16(bitmap, cliprect.min_x, y, cliprect.max_x - cliprect.min_x + 1, &scanline[cliprect.min_x], NULL); + draw_scanline16(bitmap, cliprect.min_x, y, cliprect.width(), &scanline[cliprect.min_x], NULL); } return 0; } diff --git a/src/mame/video/blockout.c b/src/mame/video/blockout.c index 89e85487bdd..1420c62663a 100644 --- a/src/mame/video/blockout.c +++ b/src/mame/video/blockout.c @@ -77,7 +77,7 @@ static void update_pixels( running_machine &machine, int x, int y ) int color; const rectangle &visarea = machine.primary_screen->visible_area(); - if (x < visarea.min_x || x > visarea.max_x || y < visarea.min_y || y > visarea.max_y) + if (!visarea.contains(x, y)) return; front = state->m_videoram[y * 256 + x / 2]; diff --git a/src/mame/video/bosco.c b/src/mame/video/bosco.c index 35cbed8c32b..b61eb2b0ba3 100644 --- a/src/mame/video/bosco.c +++ b/src/mame/video/bosco.c @@ -271,7 +271,7 @@ static void draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rec { if (flip) x += 20*8; - if (x >= cliprect.min_x && x <= cliprect.max_x && y >= cliprect.min_y && y <= cliprect.max_y) + if (cliprect.contains(x, y)) bitmap.pix16(y, x) = STARS_COLOR_BASE + star_seed_tab[star_cntr].col; } } diff --git a/src/mame/video/canyon.c b/src/mame/video/canyon.c index e9eb21d14e1..a6974224c0a 100644 --- a/src/mame/video/canyon.c +++ b/src/mame/video/canyon.c @@ -65,17 +65,8 @@ static void draw_bombs( running_machine &machine, bitmap_ind16 &bitmap, const re int sx = 254 - state->m_videoram[0x3d0 + 2 * i + 0x5]; int sy = 246 - state->m_videoram[0x3d0 + 2 * i + 0xc]; - rectangle rect; - - rect.min_x = sx; - rect.min_y = sy; - rect.max_x = sx + 1; - rect.max_y = sy + 1; - - if (rect.min_x < cliprect.min_x) rect.min_x = cliprect.min_x; - if (rect.min_y < cliprect.min_y) rect.min_y = cliprect.min_y; - if (rect.max_x > cliprect.max_x) rect.max_x = cliprect.max_x; - if (rect.max_y > cliprect.max_y) rect.max_y = cliprect.max_y; + rectangle rect(sx, sx + 1, sy, sy + 1); + rect &= cliprect; bitmap.fill(1 + 2 * i, rect); } diff --git a/src/mame/video/cchasm.c b/src/mame/video/cchasm.c index 88f341e5c21..2fd656f48b0 100644 --- a/src/mame/video/cchasm.c +++ b/src/mame/video/cchasm.c @@ -124,8 +124,8 @@ VIDEO_START( cchasm ) cchasm_state *state = machine.driver_data<cchasm_state>(); const rectangle &visarea = machine.primary_screen->visible_area(); - state->m_xcenter=((visarea.max_x + visarea.min_x)/2) << 16; - state->m_ycenter=((visarea.max_y + visarea.min_y)/2) << 16; + state->m_xcenter=visarea.xcenter() << 16; + state->m_ycenter=visarea.ycenter() << 16; VIDEO_START_CALL(vector); } diff --git a/src/mame/video/cps1.c b/src/mame/video/cps1.c index a46aa08d433..116dbe4d163 100644 --- a/src/mame/video/cps1.c +++ b/src/mame/video/cps1.c @@ -2723,8 +2723,7 @@ static void cps1_render_stars( screen_device &screen, bitmap_ind16 &bitmap, cons col = ((col & 0xe0) >> 1) + (screen.frame_number() / 16 & 0x0f); - if (sx >= cliprect.min_x && sx <= cliprect.max_x && - sy >= cliprect.min_y && sy <= cliprect.max_y) + if (cliprect.contains(sx, sy)) bitmap.pix16(sy, sx) = 0xa00 + col; } } @@ -2749,8 +2748,7 @@ static void cps1_render_stars( screen_device &screen, bitmap_ind16 &bitmap, cons col = ((col & 0xe0) >> 1) + (screen.frame_number() / 16 & 0x0f); - if (sx >= cliprect.min_x && sx <= cliprect.max_x && - sy >= cliprect.min_y && sy <= cliprect.max_y) + if (cliprect.contains(sx, sy)) bitmap.pix16(sy, sx) = 0x800 + col; } } diff --git a/src/mame/video/dc.c b/src/mame/video/dc.c index 577453a4b7c..31ed87ee107 100644 --- a/src/mame/video/dc.c +++ b/src/mame/video/dc.c @@ -1085,8 +1085,6 @@ WRITE64_HANDLER( pvr_ta_w ) { if ((state_ta.grab[a].ispbase == state->pvrta_regs[PARAM_BASE]) && (state_ta.grab[a].valid == 1) && (state_ta.grab[a].busy == 0)) { - rectangle clip; - state_ta.grab[a].busy = 1; state_ta.renderselect = a; state_ta.start_render_received=1; @@ -1095,10 +1093,7 @@ WRITE64_HANDLER( pvr_ta_w ) state_ta.grab[a].fbwsof1=state->pvrta_regs[FB_W_SOF1]; state_ta.grab[a].fbwsof2=state->pvrta_regs[FB_W_SOF2]; - clip.min_x = 0; - clip.max_x = 1023; - clip.min_y = 0; - clip.max_y = 1023; + rectangle clip(0, 1023, 0, 1023); // we've got a request to draw, so, draw to the accumulation buffer! // this should really be done for each tile! diff --git a/src/mame/video/deco32.c b/src/mame/video/deco32.c index 4bffbc46e88..2ec15bb6766 100644 --- a/src/mame/video/deco32.c +++ b/src/mame/video/deco32.c @@ -647,11 +647,7 @@ SCREEN_UPDATE_RGB32( dragngun ) // for now we only draw these 2 layers on the last update call if (cliprect.max_y == 247) { - rectangle clip; - clip.min_x = cliprect.min_x; - clip.max_x = cliprect.max_x; - clip.min_y = 8; - clip.max_y = 247; + rectangle clip(cliprect.min_x, cliprect.max_x, 8, 247); dragngun_draw_sprites(screen.machine(),bitmap,clip,screen.machine().generic.buffered_spriteram.u32); deco16ic_tilemap_1_draw(state->m_deco_tilegen1, bitmap, clip, 0, 0); diff --git a/src/mame/video/deniam.c b/src/mame/video/deniam.c index dc034ff2931..6ef23b89f8b 100644 --- a/src/mame/video/deniam.c +++ b/src/mame/video/deniam.c @@ -269,8 +269,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const { if (rom[i] & 0x0f) { - if (sx + x >= cliprect.min_x && sx + x <= cliprect.max_x && - y >= cliprect.min_y && y <= cliprect.max_y) + if (cliprect.contains(sx + x, y)) { if ((machine.priority_bitmap.pix8(y, sx + x) & primask) == 0) bitmap.pix16(y, sx + x) = color * 16 + (rom[i] & 0x0f); @@ -289,8 +288,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const { if (rom[i] & 0xf0) { - if (sx + x >= cliprect.min_x && sx + x <= cliprect.max_x && - y >= cliprect.min_y && y <= cliprect.max_y) + if (cliprect.contains(sx + x, y)) { if ((machine.priority_bitmap.pix8(y, sx + x) & primask) == 0) bitmap.pix16(y, sx + x) = color * 16+(rom[i] >> 4); @@ -313,8 +311,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const { if (rom[i] & 0xf0) { - if (sx + x >= cliprect.min_x && sx + x <= cliprect.max_x && - y >= cliprect.min_y && y <= cliprect.max_y) + if (cliprect.contains(sx + x, y)) { if ((machine.priority_bitmap.pix8(y, sx + x) & primask) == 0) bitmap.pix16(y, sx + x) = color * 16 + (rom[i] >> 4); @@ -333,8 +330,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const { if (rom[i] & 0x0f) { - if (sx + x >= cliprect.min_x && sx + x <= cliprect.max_x && - y >= cliprect.min_y && y <= cliprect.max_y) + if (cliprect.contains(sx + x, y)) { if ((machine.priority_bitmap.pix8(y, sx + x) & primask) == 0) bitmap.pix16(y, sx + x) = color * 16 + (rom[i] & 0x0f); diff --git a/src/mame/video/exerion.c b/src/mame/video/exerion.c index b6ee2abad03..c92c19de200 100644 --- a/src/mame/video/exerion.c +++ b/src/mame/video/exerion.c @@ -339,7 +339,7 @@ static void draw_background( running_machine &machine, bitmap_ind16 &bitmap, con } /* draw the scanline */ - draw_scanline16(bitmap, cliprect.min_x, y, cliprect.max_x - cliprect.min_x + 1, &scanline[cliprect.min_x], NULL); + draw_scanline16(bitmap, cliprect.min_x, y, cliprect.width(), &scanline[cliprect.min_x], NULL); } } diff --git a/src/mame/video/galaga.c b/src/mame/video/galaga.c index bd5400953da..53252a28627 100644 --- a/src/mame/video/galaga.c +++ b/src/mame/video/galaga.c @@ -557,7 +557,7 @@ static void draw_stars(running_machine &machine, bitmap_ind16 &bitmap, const rec x = (star_seed_tab[star_cntr].x + state->m_stars_scrollx) % 256 + x_align; y = (y_align + star_seed_tab[star_cntr].y + state->m_stars_scrolly) % 256; - if (x >= cliprect.min_x && x <= cliprect.max_x && y >= cliprect.min_y && y <= cliprect.max_y) + if (cliprect.contains(x, y)) bitmap.pix16(y, x) = STARS_COLOR_BASE + star_seed_tab[ star_cntr ].col; } diff --git a/src/mame/video/galastrm.c b/src/mame/video/galastrm.c index f7db405ea3e..545d79b3c2a 100644 --- a/src/mame/video/galastrm.c +++ b/src/mame/video/galastrm.c @@ -444,13 +444,9 @@ SCREEN_UPDATE_IND16( galastrm ) UINT8 pivlayer[3]; UINT16 priority; static const int primasks[4] = {0xfffc, 0xfff0, 0xff00, 0x0}; - rectangle clip; bitmap_ind8 &priority_bitmap = screen.machine().priority_bitmap; - clip.min_x = 0; - clip.min_y = 0; - clip.max_x = screen.width() -1; - clip.max_y = screen.height() -1; + rectangle clip(0, screen.width() -1, 0, screen.height() -1); tc0100scn_tilemap_update(tc0100scn); tc0480scp_tilemap_update(tc0480scp); diff --git a/src/mame/video/galaxold.c b/src/mame/video/galaxold.c index 35e1f0c8f4e..acbc2b33639 100644 --- a/src/mame/video/galaxold.c +++ b/src/mame/video/galaxold.c @@ -623,7 +623,7 @@ static void theend_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, { x--; - if ((x >= cliprect.min_x) && (x <= cliprect.max_x) && (y >= cliprect.min_y) && (y <= cliprect.max_y)) + if (cliprect.contains(x, y)) bitmap.pix16(y, x) = BULLETS_COLOR_BASE; } } @@ -1143,7 +1143,7 @@ static void galaxold_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap { x--; - if ((x >= cliprect.min_x) && (x <= cliprect.max_x) && (y >= cliprect.min_y) && (y <= cliprect.max_y)) + if (cliprect.contains(x, y)) { int color; @@ -1163,7 +1163,7 @@ static void scrambold_draw_bullets(running_machine &machine, bitmap_ind16 &bitma x = x - 6; - if ((x >= cliprect.min_x) && (x <= cliprect.max_x) && (y >= cliprect.min_y) && (y <= cliprect.max_y)) + if (cliprect.contains(x, y)) /* yellow bullets */ bitmap.pix16(y, x) = BULLETS_COLOR_BASE; } @@ -1175,7 +1175,7 @@ static void darkplnt_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap x = x - 6; - if ((x >= cliprect.min_x) && (x <= cliprect.max_x) && (y >= cliprect.min_y) && (y <= cliprect.max_y)) + if (cliprect.contains(x, y)) bitmap.pix16(y, x) = 32 + state->m_darkplnt_bullet_color; } @@ -1200,7 +1200,7 @@ static void dambustr_draw_bullets(running_machine &machine, bitmap_ind16 &bitmap x--; } - if ((x >= cliprect.min_x) && (x <= cliprect.max_x) && (y >= cliprect.min_y) && (y <= cliprect.max_y)) + if (cliprect.contains(x, y)) bitmap.pix16(y, x) = color; } } @@ -1377,22 +1377,15 @@ static void dambustr_draw_background(running_machine &machine, bitmap_ind16 &bit static void dambustr_draw_upper_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) { galaxold_state *state = machine.driver_data<galaxold_state>(); - rectangle clip; if (flip_screen_x_get(machine)) { - clip.min_x = 254 - state->m_dambustr_bg_split_line; - clip.max_x = state->m_dambustr_bg_split_line; - clip.min_y = 0; - clip.max_y = 255; + rectangle clip(254 - state->m_dambustr_bg_split_line, state->m_dambustr_bg_split_line, 0, 255); copybitmap(bitmap, *state->m_dambustr_tmpbitmap, 0, 0, 0, 0, clip); } else { - clip.min_x = 0; - clip.max_x = 254 - state->m_dambustr_bg_split_line; - clip.min_y = 0; - clip.max_y = 255; + rectangle clip(0, 254 - state->m_dambustr_bg_split_line, 0, 255); copybitmap(bitmap, *state->m_dambustr_tmpbitmap, 0, 0, 0, 0, clip); } } @@ -1482,7 +1475,7 @@ static void plot_star(galaxold_state *state, bitmap_ind16 &bitmap, int x, int y, if (state->m_flipscreen_y) y = 255 - y; - if ((x >= cliprect.min_x) && (x <= cliprect.max_x) && (y >= cliprect.min_y) && (y <= cliprect.max_y)) + if (cliprect.contains(x, y)) bitmap.pix16(y, x) = state->m_stars_colors_start + color; } diff --git a/src/mame/video/gp9001.c b/src/mame/video/gp9001.c index 9bd4b26624e..99795765fa8 100644 --- a/src/mame/video/gp9001.c +++ b/src/mame/video/gp9001.c @@ -914,7 +914,7 @@ void gp9001vdp_device::draw_sprites( running_machine &machine, bitmap_ind16 &bit { int drawxx = xx+sx; - if (drawxx>=cliprect.min_x && drawxx<=cliprect.max_x && drawyy>=cliprect.min_y && drawyy<=cliprect.max_y) + if (cliprect.contains(drawxx, drawyy)) { UINT8 pix = srcdata[count]; UINT16* dstptr = &bitmap.pix16(drawyy, drawxx); diff --git a/src/mame/video/grchamp.c b/src/mame/video/grchamp.c index a6263cfc0f0..2ca4da300a7 100644 --- a/src/mame/video/grchamp.c +++ b/src/mame/video/grchamp.c @@ -148,8 +148,7 @@ static int collision_check(running_machine &machine, grchamp_state *state, bitma if( pixel != sprite_transp ){ sx = x+x0; sy = y+y0; - if( (sx >= visarea->min_x) && (sx <= visarea->max_x) && - (sy >= visarea->min_y) && (sy <= visarea->max_y) ) + if(visarea->contains(sx, sy)) { // Collision check uses only 16 pens! pixel = bitmap.pix16(sy, sx) % 16; diff --git a/src/mame/video/groundfx.c b/src/mame/video/groundfx.c index 16a78166cf3..5cb9873c415 100644 --- a/src/mame/video/groundfx.c +++ b/src/mame/video/groundfx.c @@ -10,10 +10,7 @@ VIDEO_START( groundfx ) state->m_spritelist = auto_alloc_array(machine, struct tempsprite, 0x4000); /* Hack */ - state->m_hack_cliprect.min_x = 69; - state->m_hack_cliprect.max_x = 250; - state->m_hack_cliprect.min_y = 24 + 5; - state->m_hack_cliprect.max_y = 24 + 44; + state->m_hack_cliprect.set(69, 250, 24 + 5, 24 + 44); } /*************************************************************** diff --git a/src/mame/video/hng64.c b/src/mame/video/hng64.c index 5658187414f..46e3e329d2b 100644 --- a/src/mame/video/hng64.c +++ b/src/mame/video/hng64.c @@ -1110,10 +1110,7 @@ static void hng64_drawtilemap(running_machine& machine, bitmap_rgb32 &bitmap, co int xinc,yinc; const rectangle &visarea = machine.primary_screen->visible_area(); - clip.min_x = visarea.min_x; - clip.max_x = visarea.max_x; - clip.min_y = visarea.min_y; - clip.max_y = visarea.max_y; + clip = visarea; if (global_tileregs&0x04000000) // globally selects alt scroll register layout??? { @@ -1541,7 +1538,7 @@ SCREEN_UPDATE_RGB32( hng64 ) // Blit the color buffer into the primary bitmap for (y = cliprect.min_y; y <= cliprect.max_y; y++) { - UINT32 *src = &state->m_colorBuffer3d[y * (cliprect.max_x-cliprect.min_x)]; + UINT32 *src = &state->m_colorBuffer3d[y * cliprect.width()]; UINT32 *dst = &bitmap.pix32(y, cliprect.min_x); for (x = cliprect.min_x; x <= cliprect.max_x; x++) @@ -1698,8 +1695,8 @@ VIDEO_START( hng64 ) state->m_additive_tilemap_debug = 0; // 3d Buffer Allocation - state->m_depthBuffer3d = auto_alloc_array(machine, float, (visarea.max_x)*(visarea.max_y)); - state->m_colorBuffer3d = auto_alloc_array(machine, UINT32, (visarea.max_x)*(visarea.max_y)); + state->m_depthBuffer3d = auto_alloc_array(machine, float, (visarea.max_x + 1)*(visarea.max_y + 1)); + state->m_colorBuffer3d = auto_alloc_array(machine, UINT32, (visarea.max_x + 1)*(visarea.max_y + 1)); } diff --git a/src/mame/video/itech32.c b/src/mame/video/itech32.c index 230d39e3c30..94bb2905f82 100644 --- a/src/mame/video/itech32.c +++ b/src/mame/video/itech32.c @@ -140,12 +140,8 @@ INLINE offs_t compute_safe_address(itech32_state *state, int x, int y) INLINE void disable_clipping(itech32_state *state) { state->m_clip_save = state->m_clip_rect; - - state->m_clip_rect.min_x = state->m_clip_rect.min_y = 0; - state->m_clip_rect.max_x = state->m_clip_rect.max_y = 0xfff; - - state->m_scaled_clip_rect.min_x = state->m_scaled_clip_rect.min_y = 0; - state->m_scaled_clip_rect.max_x = state->m_scaled_clip_rect.max_y = 0xfff << 8; + state->m_clip_rect.set(0, 0xfff, 0, 0xfff); + state->m_scaled_clip_rect.set(0, 0xfff << 8, 0, 0xfff << 8); } INLINE void enable_clipping(itech32_state *state) @@ -561,8 +557,7 @@ static void draw_raw(itech32_state *state, UINT16 *base, UINT16 color) /* render all pixels */ sx = startx; for (x = 0; x < width && sx < state->m_scaled_clip_rect.max_x; x += xsrcstep, sx += xdststep, ty += ystep) - if (ty >= state->m_scaled_clip_rect.min_y && ty < state->m_scaled_clip_rect.max_y && - sx >= state->m_scaled_clip_rect.min_x && sx < state->m_scaled_clip_rect.max_x) + if (state->m_scaled_clip_rect.contains(sx, ty)) { int pixel = rowsrc[x >> 8]; if (pixel != transparent_pen) @@ -747,8 +742,7 @@ static void draw_raw_drivedge(itech32_state *state, UINT16 *base, UINT16 *zbase, if (state->m_drivedge_zbuf_control[3] & 0x8000) { for (x = 0; x < width && sx < state->m_scaled_clip_rect.max_x; x += xsrcstep, sx += xdststep, ty += ystep) - if (ty >= state->m_scaled_clip_rect.min_y && ty < state->m_scaled_clip_rect.max_y && - sx >= state->m_scaled_clip_rect.min_x && sx < state->m_scaled_clip_rect.max_x) + if (state->m_scaled_clip_rect.contains(sx, ty)) { int pixel = rowsrc[x >> 8]; if (pixel != transparent_pen) @@ -762,8 +756,7 @@ static void draw_raw_drivedge(itech32_state *state, UINT16 *base, UINT16 *zbase, else if (state->m_drivedge_zbuf_control[3] & 0x4000) { for (x = 0; x < width && sx < state->m_scaled_clip_rect.max_x; x += xsrcstep, sx += xdststep, ty += ystep) - if (ty >= state->m_scaled_clip_rect.min_y && ty < state->m_scaled_clip_rect.max_y && - sx >= state->m_scaled_clip_rect.min_x && sx < state->m_scaled_clip_rect.max_x) + if (state->m_scaled_clip_rect.contains(sx, ty)) { int pixel = rowsrc[x >> 8]; UINT16 *zbuf = &zbase[compute_safe_address(state, sx >> 8, ty >> 8)]; @@ -778,8 +771,7 @@ static void draw_raw_drivedge(itech32_state *state, UINT16 *base, UINT16 *zbase, else { for (x = 0; x < width && sx < state->m_scaled_clip_rect.max_x; x += xsrcstep, sx += xdststep, ty += ystep) - if (ty >= state->m_scaled_clip_rect.min_y && ty < state->m_scaled_clip_rect.max_y && - sx >= state->m_scaled_clip_rect.min_x && sx < state->m_scaled_clip_rect.max_x) + if (state->m_scaled_clip_rect.contains(sx, ty)) { int pixel = rowsrc[x >> 8]; UINT16 *zbuf = &zbase[compute_safe_address(state, sx >> 8, ty >> 8)]; @@ -1457,12 +1449,12 @@ SCREEN_UPDATE_IND16( itech32 ) } /* draw from the buffer */ - draw_scanline16(bitmap, cliprect.min_x, y, cliprect.max_x - cliprect.min_x + 1, &scanline[cliprect.min_x], NULL); + draw_scanline16(bitmap, cliprect.min_x, y, cliprect.width(), &scanline[cliprect.min_x], NULL); } /* otherwise, draw directly from VRAM */ else - draw_scanline16(bitmap, cliprect.min_x, y, cliprect.max_x - cliprect.min_x + 1, &src1[cliprect.min_x], NULL); + draw_scanline16(bitmap, cliprect.min_x, y, cliprect.width(), &src1[cliprect.min_x], NULL); } return 0; } diff --git a/src/mame/video/jaguar.c b/src/mame/video/jaguar.c index baeeb5d2854..ab9c04fcd49 100644 --- a/src/mame/video/jaguar.c +++ b/src/mame/video/jaguar.c @@ -237,8 +237,8 @@ INLINE void get_crosshair_xy(running_machine &machine, int player, int *x, int * { const rectangle &visarea = machine.primary_screen->visible_area(); - int width = visarea.max_x + 1 - visarea.min_x; - int height = visarea.max_y + 1 - visarea.min_y; + int width = visarea.width(); + int height = visarea.height(); /* only 2 lightguns are connected */ *x = visarea.min_x + (((input_port_read(machine, player ? "FAKE2_X" : "FAKE1_X") & 0xff) * width) >> 8); *y = visarea.min_y + (((input_port_read(machine, player ? "FAKE2_Y" : "FAKE1_Y") & 0xff) * height) >> 8); @@ -751,11 +751,7 @@ WRITE16_HANDLER( jaguar_tom_regs_w ) /* adjust for the half-lines */ if (hperiod != 0 && vperiod != 0 && hbend < hbstart && vbend < vbstart && hbstart < hperiod) { - rectangle visarea; - visarea.min_x = hbend / 2; - visarea.max_x = hbstart / 2 - 1; - visarea.min_y = vbend / 2; - visarea.max_y = vbstart / 2 - 1; + rectangle visarea(hbend / 2, hbstart / 2 - 1, vbend / 2, vbstart / 2 - 1); space->machine().primary_screen->configure(hperiod / 2, vperiod / 2, visarea, HZ_TO_ATTOSECONDS((double)pixel_clock * 2 / hperiod / vperiod)); } } diff --git a/src/mame/video/konamigx.c b/src/mame/video/konamigx.c index 2bb0ec26aa7..905baeea345 100644 --- a/src/mame/video/konamigx.c +++ b/src/mame/video/konamigx.c @@ -90,10 +90,7 @@ void K053936GP_clip_enable(int chip, int status) { K053936_clip_enabled[chip] = void K053936GP_set_cliprect(int chip, int minx, int maxx, int miny, int maxy) { rectangle &cliprect = K053936_cliprect[chip]; - cliprect.min_x = minx; - cliprect.max_x = maxx; - cliprect.min_y = miny; - cliprect.max_y = maxy; + cliprect.set(minx, maxx, miny, maxy); } INLINE void K053936GP_copyroz32clip( running_machine &machine, @@ -1056,8 +1053,8 @@ static void gx_wipezbuf(running_machine &machine, int noshadow) { const rectangle &visarea = machine.primary_screen->visible_area(); - int w = visarea.max_x - visarea.min_x + 1; - int h = visarea.max_y - visarea.min_y + 1; + int w = visarea.width(); + int h = visarea.height(); UINT8 *zptr = gx_objzbuf; int ecx = h; @@ -1575,7 +1572,7 @@ void konamigx_mixer(running_machine &machine, bitmap_rgb32 &bitmap, const rectan { int pixeldouble_output = 0; const rectangle &visarea = machine.primary_screen->visible_area(); - int width = visarea.max_x - visarea.min_x + 1; + int width = visarea.width(); if (width>512) // vsnetscr case pixeldouble_output = 1; @@ -2319,10 +2316,7 @@ VIDEO_START(opengolf) gxtype1_roz_dstbitmap2 = auto_bitmap_ind16_alloc(machine,512,512); // BITMAP_FORMAT_IND16 because we NEED the raw pen data for post-processing - gxtype1_roz_dstbitmapclip.min_x = 0; - gxtype1_roz_dstbitmapclip.max_x = 512-1; - gxtype1_roz_dstbitmapclip.min_y = 0; - gxtype1_roz_dstbitmapclip.max_y = 512-1; + gxtype1_roz_dstbitmapclip.set(0, 512-1, 0, 512-1); K053936_wraparound_enable(0, 1); @@ -2360,10 +2354,7 @@ VIDEO_START(racinfrc) gxtype1_roz_dstbitmap2 = auto_bitmap_ind16_alloc(machine,512,512); // BITMAP_FORMAT_IND16 because we NEED the raw pen data for post-processing - gxtype1_roz_dstbitmapclip.min_x = 0; - gxtype1_roz_dstbitmapclip.max_x = 512-1; - gxtype1_roz_dstbitmapclip.min_y = 0; - gxtype1_roz_dstbitmapclip.max_y = 512-1; + gxtype1_roz_dstbitmapclip.set(0, 512-1, 0, 512-1); K053936_wraparound_enable(0, 1); @@ -2447,10 +2438,8 @@ SCREEN_UPDATE_RGB32(konamigx) { // we're going to throw half of this away anyway in post-process, so only render what's needed rectangle temprect; - temprect.min_x = cliprect.min_x; + temprect = cliprect; temprect.max_x = cliprect.min_x+320; - temprect.min_y = cliprect.min_y; - temprect.max_y = cliprect.max_y; if (konamigx_type3_psac2_actual_bank == 1) K053936_0_zoom_draw(*type3_roz_temp_bitmap, temprect,gx_psac_tilemap_alt, 0,0,0); // soccerss playfield else K053936_0_zoom_draw(*type3_roz_temp_bitmap, temprect,gx_psac_tilemap, 0,0,0); // soccerss playfield diff --git a/src/mame/video/lethalj.c b/src/mame/video/lethalj.c index 1f20f4d06f9..f7f22481246 100644 --- a/src/mame/video/lethalj.c +++ b/src/mame/video/lethalj.c @@ -24,8 +24,8 @@ INLINE void get_crosshair_xy(running_machine &machine, int player, int *x, int * { static const char *const gunnames[] = { "LIGHT0_X", "LIGHT0_Y", "LIGHT1_X", "LIGHT1_Y" }; const rectangle &visarea = machine.primary_screen->visible_area(); - int width = visarea.max_x + 1 - visarea.min_x; - int height = visarea.max_y + 1 - visarea.min_y; + int width = visarea.width(); + int height = visarea.height(); *x = ((input_port_read_safe(machine, gunnames[player * 2], 0x00) & 0xff) * width) / 255; *y = ((input_port_read_safe(machine, gunnames[1 + player * 2], 0x00) & 0xff) * height) / 255; diff --git a/src/mame/video/lordgun.c b/src/mame/video/lordgun.c index 12e2e88bb22..1bf2e4a4572 100644 --- a/src/mame/video/lordgun.c +++ b/src/mame/video/lordgun.c @@ -211,10 +211,7 @@ void lordgun_update_gun(running_machine &machine, int i) lorddgun_calc_gun_scr(machine, i); - if ( (state->m_gun[i].scr_x < visarea.min_x) || - (state->m_gun[i].scr_x > visarea.max_x) || - (state->m_gun[i].scr_y < visarea.min_y) || - (state->m_gun[i].scr_y > visarea.max_y) ) + if (!visarea.contains(state->m_gun[i].scr_x, state->m_gun[i].scr_y)) state->m_gun[i].hw_x = state->m_gun[i].hw_y = 0; } diff --git a/src/mame/video/m107.c b/src/mame/video/m107.c index f36bbab12c3..117f7be9f48 100644 --- a/src/mame/video/m107.c +++ b/src/mame/video/m107.c @@ -319,10 +319,7 @@ static void m107_tilemap_draw(running_machine &machine, bitmap_ind16 &bitmap, co int line; rectangle clip; const rectangle &visarea = machine.primary_screen->visible_area(); - clip.min_x = visarea.min_x; - clip.max_x = visarea.max_x; - clip.min_y = visarea.min_y; - clip.max_y = visarea.max_y; + clip = visarea; if (state->m_control[0x08 + laynum] & 0x02) { diff --git a/src/mame/video/mermaid.c b/src/mame/video/mermaid.c index 6f780de92de..2dca683673e 100644 --- a/src/mame/video/mermaid.c +++ b/src/mame/video/mermaid.c @@ -316,14 +316,7 @@ SCREEN_VBLANK( mermaid ) rect.max_x = sx + screen.machine().gfx[1]->width - 1; rect.max_y = sy + screen.machine().gfx[1]->height - 1; - if (rect.min_x < visarea.min_x) - rect.min_x = visarea.min_x; - if (rect.min_y < visarea.min_y) - rect.min_y = visarea.min_y; - if (rect.max_x > visarea.max_x) - rect.max_x = visarea.max_x; - if (rect.max_y > visarea.max_y) - rect.max_y = visarea.max_y; + rect &= visarea; // check collision sprite - background @@ -426,14 +419,7 @@ SCREEN_VBLANK( mermaid ) rect.max_x = sx + screen.machine().gfx[1]->width - 1; rect.max_y = sy + screen.machine().gfx[1]->height - 1; - if (rect.min_x < visarea.min_x) - rect.min_x = visarea.min_x; - if (rect.min_y < visarea.min_y) - rect.min_y = visarea.min_y; - if (rect.max_x > visarea.max_x) - rect.max_x = visarea.max_x; - if (rect.max_y > visarea.max_y) - rect.max_y = visarea.max_y; + rect &= visarea; // check collision sprite - sprite @@ -514,15 +500,8 @@ SCREEN_VBLANK( mermaid ) rect.max_x = sx + screen.machine().gfx[1]->width - 1; rect.max_y = sy + screen.machine().gfx[1]->height - 1; - if (rect.min_x < visarea.min_x) - rect.min_x = visarea.min_x; - if (rect.min_y < visarea.min_y) - rect.min_y = visarea.min_y; - if (rect.max_x > visarea.max_x) - rect.max_x = visarea.max_x; - if (rect.max_y > visarea.max_y) - rect.max_y = visarea.max_y; - + rect &= visarea; + // check collision sprite - sprite state->m_helper.fill(0, rect); diff --git a/src/mame/video/midzeus.c b/src/mame/video/midzeus.c index beda196b90e..4bad958750f 100644 --- a/src/mame/video/midzeus.c +++ b/src/mame/video/midzeus.c @@ -184,13 +184,13 @@ INLINE void *waveram0_ptr_from_texture_addr(UINT32 addr, int width) INLINE void waveram_plot(int y, int x, UINT16 color) { - if (x >= 0 && x <= zeus_cliprect.max_x && y >= 0 && y < zeus_cliprect.max_y) + if (zeus_cliprect.contains(x, y)) WAVERAM_WRITEPIX(zeus_renderbase, y, x, color); } INLINE void waveram_plot_depth(int y, int x, UINT16 color, UINT16 depth) { - if (x >= 0 && x <= zeus_cliprect.max_x && y >= 0 && y < zeus_cliprect.max_y) + if (zeus_cliprect.contains(x, y)) { WAVERAM_WRITEPIX(zeus_renderbase, y, x, color); WAVERAM_WRITEDEPTH(zeus_renderbase, y, x, depth); @@ -199,7 +199,7 @@ INLINE void waveram_plot_depth(int y, int x, UINT16 color, UINT16 depth) INLINE void waveram_plot_check_depth(int y, int x, UINT16 color, UINT16 depth) { - if (x >= 0 && x <= zeus_cliprect.max_x && y >= 0 && y < zeus_cliprect.max_y) + if (zeus_cliprect.contains(x, y)) { UINT16 *depthptr = WAVERAM_PTRDEPTH(zeus_renderbase, y, x); if (depth <= *depthptr) @@ -213,7 +213,7 @@ INLINE void waveram_plot_check_depth(int y, int x, UINT16 color, UINT16 depth) #ifdef UNUSED_FUNCTION INLINE void waveram_plot_check_depth_nowrite(int y, int x, UINT16 color, UINT16 depth) { - if (x >= 0 && x <= zeus_cliprect.max_x && y >= 0 && y < zeus_cliprect.max_y) + if (zeus_cliprect.contains(x, y)) { UINT16 *depthptr = WAVERAM_PTRDEPTH(zeus_renderbase, y, x); if (depth <= *depthptr) @@ -743,12 +743,8 @@ static void zeus_register_update(running_machine &machine, offs_t offset) { int vtotal = zeusbase[0xca] >> 16; int htotal = zeusbase[0xc6] >> 16; - rectangle visarea; - visarea.min_x = zeusbase[0xc6] & 0xffff; - visarea.max_x = htotal - 3; - visarea.min_y = 0; - visarea.max_y = zeusbase[0xc8] & 0xffff; + rectangle visarea(zeusbase[0xc6] & 0xffff, htotal - 3, 0, zeusbase[0xc8] & 0xffff); if (htotal > 0 && vtotal > 0 && visarea.min_x < visarea.max_x && visarea.max_y < vtotal) { machine.primary_screen->configure(htotal, vtotal, visarea, HZ_TO_ATTOSECONDS((double)MIDZEUS_VIDEO_CLOCK / 8.0 / (htotal * vtotal))); diff --git a/src/mame/video/midzeus2.c b/src/mame/video/midzeus2.c index 06f7f813739..42a87e3bb63 100644 --- a/src/mame/video/midzeus2.c +++ b/src/mame/video/midzeus2.c @@ -187,14 +187,14 @@ INLINE void *waveram0_ptr_from_texture_addr(UINT32 addr, int width) #ifdef UNUSED_FUNCTION INLINE void waveram_plot(int y, int x, UINT32 color) { - if (x >= 0 && x <= zeus_cliprect.max_x && y >= 0 && y < zeus_cliprect.max_y) + if (zeus_cliprect.contains(x, y)) WAVERAM_WRITEPIX(zeus_renderbase, y, x, color); } #endif INLINE void waveram_plot_depth(int y, int x, UINT32 color, UINT16 depth) { - if (x >= 0 && x <= zeus_cliprect.max_x && y >= 0 && y < zeus_cliprect.max_y) + if (zeus_cliprect.contains(x, y)) { WAVERAM_WRITEPIX(zeus_renderbase, y, x, color); WAVERAM_WRITEDEPTH(zeus_renderbase, y, x, depth); @@ -204,7 +204,7 @@ INLINE void waveram_plot_depth(int y, int x, UINT32 color, UINT16 depth) #ifdef UNUSED_FUNCTION INLINE void waveram_plot_check_depth(int y, int x, UINT32 color, UINT16 depth) { - if (x >= 0 && x <= zeus_cliprect.max_x && y >= 0 && y < zeus_cliprect.max_y) + if (zeus_cliprect.contains(x, y)) { UINT16 *depthptr = WAVERAM_PTRDEPTH(zeus_renderbase, y, x); if (depth <= *depthptr) @@ -219,7 +219,7 @@ INLINE void waveram_plot_check_depth(int y, int x, UINT32 color, UINT16 depth) #ifdef UNUSED_FUNCTION INLINE void waveram_plot_check_depth_nowrite(int y, int x, UINT32 color, UINT16 depth) { - if (x >= 0 && x <= zeus_cliprect.max_x && y >= 0 && y < zeus_cliprect.max_y) + if (zeus_cliprect.contains(x, y)) { UINT16 *depthptr = WAVERAM_PTRDEPTH(zeus_renderbase, y, x); if (depth <= *depthptr) @@ -564,12 +564,8 @@ static void zeus_register_update(running_machine &machine, offs_t offset, UINT32 { int vtotal = zeusbase[0x37] & 0xffff; int htotal = zeusbase[0x34] >> 16; - rectangle visarea; - visarea.min_x = zeusbase[0x33] >> 16; - visarea.max_x = (zeusbase[0x34] & 0xffff) - 1; - visarea.min_y = 0; - visarea.max_y = zeusbase[0x35] & 0xffff; + rectangle visarea(zeusbase[0x33] >> 16, (zeusbase[0x34] & 0xffff) - 1, 0, zeusbase[0x35] & 0xffff); if (htotal > 0 && vtotal > 0 && visarea.min_x < visarea.max_x && visarea.max_y < vtotal) { machine.primary_screen->configure(htotal, vtotal, visarea, HZ_TO_ATTOSECONDS((double)MIDZEUS_VIDEO_CLOCK / 4.0 / (htotal * vtotal))); diff --git a/src/mame/video/model2.c b/src/mame/video/model2.c index dbc3ba414db..d06ad831646 100644 --- a/src/mame/video/model2.c +++ b/src/mame/video/model2.c @@ -928,21 +928,13 @@ static void model2_3d_render( model2_state *state, bitmap_rgb32 &bitmap, triangl poly_manager *poly = state->m_poly; poly_extra_data *extra = (poly_extra_data *)poly_get_extra_data(poly); UINT8 renderer; - rectangle vp; /* select renderer based on attributes (bit15 = checker, bit14 = textured, bit13 = transparent */ renderer = (tri->texheader[0] >> 13) & 7; /* calculate and clip to viewport */ - vp.min_x = tri->viewport[0] - 8; - vp.max_x = tri->viewport[2] - 8; - vp.min_y = (384-tri->viewport[3])+90; - vp.max_y = (384-tri->viewport[1])+90; - - if ( vp.min_x < cliprect.min_x ) vp.min_x = cliprect.min_x; - if ( vp.max_x > cliprect.max_x ) vp.max_x = cliprect.max_x; - if ( vp.min_y < cliprect.min_y ) vp.min_y = cliprect.min_y; - if ( vp.max_y > cliprect.max_y ) vp.max_y = cliprect.max_y; + rectangle vp(tri->viewport[0] - 8, tri->viewport[2] - 8, (384-tri->viewport[3])+90, (384-tri->viewport[1])+90); + vp &= cliprect; extra->state = state; extra->lumabase = ((tri->texheader[1] & 0xFF) << 7) + ((tri->luma >> 5) ^ 0x7); @@ -2712,8 +2704,8 @@ VIDEO_START(model2) { model2_state *state = machine.driver_data<model2_state>(); const rectangle &visarea = machine.primary_screen->visible_area(); - int width = visarea.max_x - visarea.min_x; - int height = visarea.max_y - visarea.min_y; + int width = visarea.width(); + int height = visarea.height(); state->m_sys24_bitmap.allocate(width, height+4); diff --git a/src/mame/video/model3.c b/src/mame/video/model3.c index 60b429d0c16..0b19f5de9ee 100644 --- a/src/mame/video/model3.c +++ b/src/mame/video/model3.c @@ -357,10 +357,7 @@ SCREEN_UPDATE_IND16( model3 ) #endif state->m_screen_clip = (rectangle*)&cliprect; - state->m_clip3d.min_x = cliprect.min_x; - state->m_clip3d.max_x = cliprect.max_x; - state->m_clip3d.min_y = cliprect.min_y; - state->m_clip3d.max_y = cliprect.max_y; + state->m_clip3d = cliprect; /* layer disable debug keys */ state->m_tick++; diff --git a/src/mame/video/namconb1.c b/src/mame/video/namconb1.c index 5a604e4230f..c348d55a5c5 100644 --- a/src/mame/video/namconb1.c +++ b/src/mame/video/namconb1.c @@ -143,10 +143,7 @@ SCREEN_UPDATE_IND16( namconb1 ) clip.min_y = (yclip>>16) - 0x21; clip.max_y = (yclip&0xffff) - 0x21 - 1; /* intersect with master clip rectangle */ - if( clip.min_x < cliprect.min_x ){ clip.min_x = cliprect.min_x; } - if( clip.min_y < cliprect.min_y ){ clip.min_y = cliprect.min_y; } - if( clip.max_x > cliprect.max_x ){ clip.max_x = cliprect.max_x; } - if( clip.max_y > cliprect.max_y ){ clip.max_y = cliprect.max_y; } + clip &= cliprect; bitmap.fill(get_black_pen(screen.machine()), cliprect ); @@ -184,10 +181,7 @@ SCREEN_UPDATE_IND16( namconb2 ) clip.min_y = (yclip>>16) - 0x21; clip.max_y = (yclip&0xffff) - 0x21 - 1; /* intersect with master clip rectangle */ - if( clip.min_x < cliprect.min_x ){ clip.min_x = cliprect.min_x; } - if( clip.min_y < cliprect.min_y ){ clip.min_y = cliprect.min_y; } - if( clip.max_x > cliprect.max_x ){ clip.max_x = cliprect.max_x; } - if( clip.max_y > cliprect.max_y ){ clip.max_y = cliprect.max_y; } + clip &= cliprect; bitmap.fill(get_black_pen(screen.machine()), cliprect ); diff --git a/src/mame/video/namcos1.c b/src/mame/video/namcos1.c index 46918510115..900c5183073 100644 --- a/src/mame/video/namcos1.c +++ b/src/mame/video/namcos1.c @@ -395,7 +395,7 @@ SCREEN_UPDATE_IND16( namcos1 ) i = ((state->m_cus116[6] << 8) | state->m_cus116[7]) - 0x11 - 1; // max y if (new_clip.max_y > i) new_clip.max_y = i; - if (new_clip.max_x < new_clip.min_x || new_clip.max_y < new_clip.min_y) + if (new_clip.empty()) return 0; diff --git a/src/mame/video/namcos22.c b/src/mame/video/namcos22.c index c9eaadf05e2..bdf3f97758d 100644 --- a/src/mame/video/namcos22.c +++ b/src/mame/video/namcos22.c @@ -293,10 +293,7 @@ poly3d_Clip( float vx, float vy, float vw, float vh ) int cy = 240+vy; mClip.cx = cx; mClip.cy = cy; - mClip.scissor.min_x = cx + vw; - mClip.scissor.max_x = cx - vw; - mClip.scissor.min_y = cy + vh; - mClip.scissor.max_y = cy - vh; + mClip.scissor.set(cx + vw, cx - vw, cy + vh, cy - vh); if( mClip.scissor.min_x<0 ) mClip.scissor.min_x = 0; if( mClip.scissor.max_x>639 ) mClip.scissor.max_x = 639; if( mClip.scissor.min_y<0 ) mClip.scissor.min_y = 0; @@ -307,10 +304,7 @@ static void sprite_Clip( int min_x, int max_x, int min_y, int max_y ) { // cx/cy not used - mClip.scissor.min_x = min_x; - mClip.scissor.max_x = max_x; - mClip.scissor.min_y = min_y; - mClip.scissor.max_y = max_y; + mClip.scissor.set(min_x, max_x, min_y, max_y); if( mClip.scissor.min_x<0 ) mClip.scissor.min_x = 0; if( mClip.scissor.max_x>639 ) mClip.scissor.max_x = 639; if( mClip.scissor.min_y<0 ) mClip.scissor.min_y = 0; @@ -322,10 +316,7 @@ poly3d_NoClip( void ) { mClip.cx = 320; mClip.cy = 240; - mClip.scissor.min_x = 0; - mClip.scissor.max_x = 639; - mClip.scissor.min_y = 0; - mClip.scissor.max_y = 479; + mClip.scissor.set(0, 639, 0, 479); } typedef struct diff --git a/src/mame/video/pitnrun.c b/src/mame/video/pitnrun.c index 70eff3b904d..793828cc2eb 100644 --- a/src/mame/video/pitnrun.c +++ b/src/mame/video/pitnrun.c @@ -259,17 +259,8 @@ SCREEN_UPDATE_IND16( pitnrun ) if (flip_screen_y_get(screen.machine())) dy=128-dy; - myclip.min_x=dx; - myclip.min_y=dy; - myclip.max_x=dx+127; - myclip.max_y=dy+127; - - - if(myclip.min_y<cliprect.min_y)myclip.min_y=cliprect.min_y; - if(myclip.min_x<cliprect.min_x)myclip.min_x=cliprect.min_x; - - if(myclip.max_y>cliprect.max_y)myclip.max_y=cliprect.max_y; - if(myclip.max_x>cliprect.max_x)myclip.max_x=cliprect.max_x; + myclip.set(dx, dx+127, dy, dy+127); + myclip &= cliprect; tilemap_draw(bitmap,myclip,state->m_bg, 0,0); } diff --git a/src/mame/video/pk8000.c b/src/mame/video/pk8000.c index 3685082f511..460f9e41408 100644 --- a/src/mame/video/pk8000.c +++ b/src/mame/video/pk8000.c @@ -100,10 +100,7 @@ UINT32 pk8000_video_update(screen_device &screen, bitmap_ind16 &bitmap, const re int x,y,j,b; UINT16 offset = (pk8000_video_mode & 0xc0) << 8; rectangle my_rect; - my_rect.min_x = 0; - my_rect.max_x = 256+32-1; - my_rect.min_y = 0; - my_rect.max_y = 192+32-1; + my_rect.set(0, 256+32-1, 0, 192+32-1); if (pk8000_video_enable) { bitmap.fill((pk8000_video_color >> 4) & 0x0f, my_rect); diff --git a/src/mame/video/policetr.c b/src/mame/video/policetr.c index aedd6210bd0..7a99df30feb 100644 --- a/src/mame/video/policetr.c +++ b/src/mame/video/policetr.c @@ -351,7 +351,7 @@ WRITE32_HANDLER( policetr_palette_data_w ) SCREEN_UPDATE_IND16( policetr ) { policetr_state *state = screen.machine().driver_data<policetr_state>(); - int width = cliprect.max_x - cliprect.min_x + 1; + int width = cliprect.width(); int y; /* render all the scanlines from the dstbitmap to MAME's bitmap */ diff --git a/src/mame/video/psikyosh.c b/src/mame/video/psikyosh.c index bd4a9c1b23b..d697e40018c 100644 --- a/src/mame/video/psikyosh.c +++ b/src/mame/video/psikyosh.c @@ -342,10 +342,7 @@ static void cache_bitmap(int scanline, psikyosh_state *state, gfx_element *gfx, { rectangle cliprect; - cliprect.min_x = 0; - cliprect.max_x = state->m_bg_bitmap.width() - 1; - cliprect.min_y = sy * 16; - cliprect.max_y = cliprect.min_y + 16 - 1; + cliprect.set(0, state->m_bg_bitmap.width() - 1, sy * 16, cliprect.min_y + 16 - 1); state->m_bg_bitmap.fill(BG_TRANSPEN, cliprect); int width = size * 16; @@ -391,8 +388,8 @@ static void draw_bglayerscroll( running_machine &machine, int layer, bitmap_rgb3 int last_bank[32]; // corresponds to bank of bitmap in state->m_bg_bitmap. bg_bitmap is split into 16/32-rows of one-tile high each for(int ii = 0; ii < 32; ii++) last_bank[ii] = -1; - int scr_width = (cliprect.max_x-cliprect.min_x + 1); - int scr_height = (cliprect.max_y-cliprect.min_y + 1); + int scr_width = cliprect.width(); + int scr_height = cliprect.height(); UINT32 *scroll_reg = &state->m_bgram[(linebank * 0x800) / 4 - 0x4000 / 4]; UINT32 *pzab_reg = &state->m_bgram[(linebank * 0x800) / 4 - 0x4000 / 4 + 0x400 / 4]; // pri, zoom, alpha, bank diff --git a/src/mame/video/psychic5.c b/src/mame/video/psychic5.c index 41c361ce498..c4d8999a0b9 100644 --- a/src/mame/video/psychic5.c +++ b/src/mame/video/psychic5.c @@ -405,7 +405,7 @@ static void draw_background(running_machine &machine, bitmap_rgb32 &bitmap, cons switch (state->m_bg_clip_mode) { case 0: case 4: case 8: case 12: case 16: - clip.min_x = clip.max_x = clip.min_y = clip.max_y = 0; + clip.set(0, 0, 0, 0); break; case 1: clip.min_y = state->m_sy1; break; case 3: clip.max_y = state->m_sy2; break; @@ -416,17 +416,7 @@ static void draw_background(running_machine &machine, bitmap_rgb32 &bitmap, cons } if (flip_screen_get(machine)) - { - int min_x,max_x,min_y,max_y; - min_x = 255 - clip.max_x; - max_x = 255 - clip.min_x; - min_y = 255 - clip.max_y; - max_y = 255 - clip.min_y; - clip.min_x = min_x; - clip.max_x = max_x; - clip.min_y = min_y; - clip.max_y = max_y; - } + clip.set(255 - clip.max_x, 255 - clip.min_x, 255 - clip.max_y, 255 - clip.min_y); } tilemap_draw(bitmap, clip, state->m_bg_tilemap, 0, 0); diff --git a/src/mame/video/rallyx.c b/src/mame/video/rallyx.c index 0f7bf67b5c9..267d0326246 100644 --- a/src/mame/video/rallyx.c +++ b/src/mame/video/rallyx.c @@ -448,8 +448,7 @@ WRITE8_HANDLER( tactcian_starson_w ) static void plot_star( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, int color ) { - if (y < cliprect.min_y || y > cliprect.max_y || - x < cliprect.min_x || x > cliprect.max_x) + if (!cliprect.contains(x, y)) return; if (flip_screen_x_get(machine)) diff --git a/src/mame/video/realbrk.c b/src/mame/video/realbrk.c index b9b6e9d5047..72d8ea00d7d 100644 --- a/src/mame/video/realbrk.c +++ b/src/mame/video/realbrk.c @@ -222,11 +222,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re int max_x = machine.primary_screen->width(); int max_y = machine.primary_screen->height(); - rectangle spritetile_clip; - spritetile_clip.min_x = 0; - spritetile_clip.min_y = 0; - spritetile_clip.max_x = 31; - spritetile_clip.max_y = 31; + rectangle spritetile_clip(0, 31, 0, 31); for ( offs = 0x3000/2; offs < 0x3600/2; offs += 2/2 ) { diff --git a/src/mame/video/redclash.c b/src/mame/video/redclash.c index 0fcff897ce8..3a1e38141a4 100644 --- a/src/mame/video/redclash.c +++ b/src/mame/video/redclash.c @@ -283,8 +283,7 @@ static void draw_bullets( running_machine &machine, bitmap_ind16 &bitmap, const sx = 240 - sx; } - if (sx >= cliprect.min_x && sx <= cliprect.max_x && - sy >= cliprect.min_y && sy <= cliprect.max_y) + if (cliprect.contains(sx, sy)) bitmap.pix16(sy, sx) = 0x19; } } @@ -396,7 +395,7 @@ void redclash_draw_stars( running_machine &machine, bitmap_ind16 &bitmap, const else vcond = yloc & 0x01; - if (xloc >= cliprect.min_x && xloc <= cliprect.max_x && yloc >= cliprect.min_y && yloc <= cliprect.max_y) + if (cliprect.contains(xloc, yloc)) { if ((hcond ^ vcond) == 0) { diff --git a/src/mame/video/sega16sp.c b/src/mame/video/sega16sp.c index 359f619985e..428b3dc09ca 100644 --- a/src/mame/video/sega16sp.c +++ b/src/mame/video/sega16sp.c @@ -1105,7 +1105,7 @@ void segaic16_sprites_yboard_draw(running_machine &machine, device_t *device, bi /* clear out any scanlines we might be using */ for (y = cliprect.min_y; y <= cliprect.max_y; y++) if (!(rotatebase[y & ~1] & 0xc000)) - memset(&bitmap.pix16(y, cliprect.min_x), 0xff, (cliprect.max_x - cliprect.min_x + 1) * sizeof(UINT16)); + memset(&bitmap.pix16(y, cliprect.min_x), 0xff, cliprect.width() * sizeof(UINT16)); /* now scan backwards and render the sprites in order */ for (data = sega16sp->spriteram; !(data[0] & 0x8000) && !visited[next]; data = sega16sp->spriteram + next * 8) diff --git a/src/mame/video/segaybd.c b/src/mame/video/segaybd.c index 0030d457db5..8e080be252e 100644 --- a/src/mame/video/segaybd.c +++ b/src/mame/video/segaybd.c @@ -52,8 +52,7 @@ SCREEN_UPDATE_IND16( yboard ) } /* draw the yboard sprites */ - yboard_clip.min_x = yboard_clip.min_y = 0; - yboard_clip.max_x = yboard_clip.max_y = 511; + yboard_clip.set(0, 511, 0, 511); segaic16_sprites_draw(screen, *state->m_tmp_bitmap, yboard_clip, 1); /* apply rotation */ diff --git a/src/mame/video/senjyo.c b/src/mame/video/senjyo.c index 1a4ccf0d0d9..93d2bc619de 100644 --- a/src/mame/video/senjyo.c +++ b/src/mame/video/senjyo.c @@ -232,8 +232,7 @@ static void draw_radar(running_machine &machine,bitmap_ind16 &bitmap,const recta sy = 255 - sy; } - if (sy >= cliprect.min_y && sy <= cliprect.max_y && - sx >= cliprect.min_x && sx <= cliprect.max_x) + if (cliprect.contains(sx, sy)) bitmap.pix16(sy, sx) = offs < 0x200 ? 512 : 513; } } diff --git a/src/mame/video/shangha3.c b/src/mame/video/shangha3.c index 120410d63f8..cc9288a2d67 100644 --- a/src/mame/video/shangha3.c +++ b/src/mame/video/shangha3.c @@ -151,10 +151,7 @@ WRITE16_HANDLER( shangha3_blitter_go_w ) //if (shangha3_ram[offs+11] || shangha3_ram[offs+12]) //logerror("offs %04x: sx %04x sy %04x zoom %04x %04x %04x %04x fx %d fy %d\n",offs,sx,sy,zoomx,shangha3_ram[offs+11]),shangha3_ram[offs+12],zoomy,flipx,flipy); - myclip.min_x = sx; - myclip.max_x = sx + sizex; - myclip.min_y = sy; - myclip.max_y = sy + sizey; + myclip.set(sx, sx + sizex, sy, sy + sizey); myclip &= rawbitmap.cliprect(); if (shangha3_ram[offs+4] & 0x08) /* tilemap */ diff --git a/src/mame/video/skyraid.c b/src/mame/video/skyraid.c index 51e91f7ff8a..ac0a32adf48 100644 --- a/src/mame/video/skyraid.c +++ b/src/mame/video/skyraid.c @@ -57,12 +57,7 @@ static void draw_terrain(running_machine &machine, bitmap_ind16 &bitmap, const r int color = val / 32; int count = val % 32; - rectangle r; - - r.min_y = y; - r.min_x = x; - r.max_y = y + 1; - r.max_x = x + 31 - count; + rectangle r(x, x + 31 - count, y, y+ 1); bitmap.fill(color, r); diff --git a/src/mame/video/sprint2.c b/src/mame/video/sprint2.c index 58df3d4707b..0be93d81701 100644 --- a/src/mame/video/sprint2.c +++ b/src/mame/video/sprint2.c @@ -172,14 +172,7 @@ SCREEN_VBLANK( sprint2 ) rect.max_x = get_sprite_x(video_ram, i) + screen.machine().gfx[1]->width - 1; rect.max_y = get_sprite_y(video_ram, i) + screen.machine().gfx[1]->height - 1; - if (rect.min_x < visarea.min_x) - rect.min_x = visarea.min_x; - if (rect.min_y < visarea.min_y) - rect.min_y = visarea.min_y; - if (rect.max_x > visarea.max_x) - rect.max_x = visarea.max_x; - if (rect.max_y > visarea.max_y) - rect.max_y = visarea.max_y; + rect &= visarea; /* check for sprite-tilemap collisions */ diff --git a/src/mame/video/ssv.c b/src/mame/video/ssv.c index 925ae3ed3d5..70ade6f4649 100644 --- a/src/mame/video/ssv.c +++ b/src/mame/video/ssv.c @@ -628,10 +628,7 @@ static void draw_row(running_machine &machine, bitmap_ind16 &bitmap, const recta /* Set up a clipping region for the tilemap slice .. */ - clip.min_x = sx; - clip.max_x = sx + xnum * 0x10 - 1; - clip.min_y = sy; - clip.max_y = sy + ynum * 0x8 - 1; + clip.set(sx, sx + xnum * 0x10 - 1, sy, sy + ynum * 0x8 - 1); /* .. and clip it against the visible screen */ diff --git a/src/mame/video/st0016.c b/src/mame/video/st0016.c index 4d9650c247e..9460c891751 100644 --- a/src/mame/video/st0016.c +++ b/src/mame/video/st0016.c @@ -380,7 +380,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r if (drawxpos > cliprect.max_x) drawxpos -= 512; // wrap around - if ((drawxpos >= cliprect.min_x) && (drawxpos <= cliprect.max_x) && (drawypos >= cliprect.min_y) && (drawypos <= cliprect.max_y) ) + if (cliprect.contains(drawxpos, drawypos)) { if(st0016_spriteram[offset+5]&0x40) { @@ -546,7 +546,7 @@ static void draw_bgmap(running_machine &machine, bitmap_ind16 &bitmap,const rect if (drawxpos > cliprect.max_x) drawxpos -= 512; // wrap around - if ((drawxpos >= cliprect.min_x) && (drawxpos <= cliprect.max_x) && (drawypos >= cliprect.min_y) && (drawypos <= cliprect.max_y) ) + if (cliprect.contains(drawxpos, drawypos)) { if(st0016_vregs[j+7]==0x12) diff --git a/src/mame/video/starcrus.c b/src/mame/video/starcrus.c index 7bb0d9eb8f7..57e71cd27a6 100644 --- a/src/mame/video/starcrus.c +++ b/src/mame/video/starcrus.c @@ -167,12 +167,7 @@ static int collision_check_s1s2(running_machine &machine) starcrus_state *state = machine.driver_data<starcrus_state>(); int org_x, org_y; int sx, sy; - rectangle clip; - - clip.min_x=0; - clip.max_x=15; - clip.min_y=0; - clip.max_y=15; + rectangle clip(0, 15, 0, 15); state->m_ship1_vid->fill(0, clip); state->m_ship2_vid->fill(0, clip); @@ -215,7 +210,7 @@ static int collision_check_p1p2(running_machine &machine) starcrus_state *state = machine.driver_data<starcrus_state>(); int org_x, org_y; int sx, sy; - rectangle clip; + rectangle clip(0, 15, 0, 15); /* if both are scores, return */ if ( ((state->m_p1_sprite & 0x08) == 0) && @@ -224,11 +219,6 @@ static int collision_check_p1p2(running_machine &machine) return 0; } - clip.min_x=0; - clip.max_x=15; - clip.min_y=0; - clip.max_y=15; - state->m_proj1_vid->fill(0, clip); state->m_proj2_vid->fill(0, clip); @@ -276,7 +266,7 @@ static int collision_check_s1p1p2(running_machine &machine) starcrus_state *state = machine.driver_data<starcrus_state>(); int org_x, org_y; int sx, sy; - rectangle clip; + rectangle clip(0, 15, 0, 15); /* if both are scores, return */ if ( ((state->m_p1_sprite & 0x08) == 0) && @@ -285,11 +275,6 @@ static int collision_check_s1p1p2(running_machine &machine) return 0; } - clip.min_x=0; - clip.max_x=15; - clip.min_y=0; - clip.max_y=15; - state->m_ship1_vid->fill(0, clip); state->m_proj1_vid->fill(0, clip); state->m_proj2_vid->fill(0, clip); @@ -353,7 +338,7 @@ static int collision_check_s2p1p2(running_machine &machine) starcrus_state *state = machine.driver_data<starcrus_state>(); int org_x, org_y; int sx, sy; - rectangle clip; + rectangle clip(0, 15, 0, 15); /* if both are scores, return */ if ( ((state->m_p1_sprite & 0x08) == 0) && @@ -362,11 +347,6 @@ static int collision_check_s2p1p2(running_machine &machine) return 0; } - clip.min_x=0; - clip.max_x=15; - clip.min_y=0; - clip.max_y=15; - state->m_ship2_vid->fill(0, clip); state->m_proj1_vid->fill(0, clip); state->m_proj2_vid->fill(0, clip); diff --git a/src/mame/video/stvvdp1.c b/src/mame/video/stvvdp1.c index 3172727795b..9e6e672e771 100644 --- a/src/mame/video/stvvdp1.c +++ b/src/mame/video/stvvdp1.c @@ -2002,18 +2002,12 @@ static void stv_vdp1_process_list(running_machine &machine) case 0x0008: if (VDP1_LOG) logerror ("Sprite List Set Command for User Clipping (%d,%d),(%d,%d)\n", stv2_current_sprite.CMDXA, stv2_current_sprite.CMDYA, stv2_current_sprite.CMDXC, stv2_current_sprite.CMDYC); - state->m_vdp1.user_cliprect.min_x = stv2_current_sprite.CMDXA; - state->m_vdp1.user_cliprect.min_y = stv2_current_sprite.CMDYA; - state->m_vdp1.user_cliprect.max_x = stv2_current_sprite.CMDXC; - state->m_vdp1.user_cliprect.max_y = stv2_current_sprite.CMDYC; + state->m_vdp1.user_cliprect.set(stv2_current_sprite.CMDXA, stv2_current_sprite.CMDXC, stv2_current_sprite.CMDYA, stv2_current_sprite.CMDYC); break; case 0x0009: if (VDP1_LOG) logerror ("Sprite List Set Command for System Clipping (0,0),(%d,%d)\n", stv2_current_sprite.CMDXC, stv2_current_sprite.CMDYC); - state->m_vdp1.system_cliprect.min_x = 0; - state->m_vdp1.system_cliprect.min_y = 0; - state->m_vdp1.system_cliprect.max_x = stv2_current_sprite.CMDXC; - state->m_vdp1.system_cliprect.max_y = stv2_current_sprite.CMDYC; + state->m_vdp1.system_cliprect.set(0, stv2_current_sprite.CMDXC, 0, stv2_current_sprite.CMDYC); break; case 0x000a: @@ -2178,13 +2172,9 @@ int stv_vdp1_start ( running_machine &machine ) stv_clear_framebuffer(machine, state->m_vdp1.framebuffer_current_draw); state->m_vdp1.framebuffer_clear_on_next_frame = 0; - state->m_vdp1.system_cliprect.min_x = state->m_vdp1.system_cliprect.max_x = 0; - state->m_vdp1.system_cliprect.min_y = state->m_vdp1.system_cliprect.max_y = 0; + state->m_vdp1.system_cliprect.set(0, 0, 0, 0); /* Kidou Senshi Z Gundam - Zenpen Zeta no Kodou loves to use the user cliprect vars in an undefined state ... */ - state->m_vdp1.user_cliprect.min_x = 0; - state->m_vdp1.user_cliprect.min_y = 0; - state->m_vdp1.user_cliprect.max_x = 512; - state->m_vdp1.user_cliprect.max_y = 256; + state->m_vdp1.user_cliprect.set(0, 512, 0, 256); // save state state_save_register_global_pointer(machine, state->m_vdp1_regs, 0x020/2); diff --git a/src/mame/video/stvvdp2.c b/src/mame/video/stvvdp2.c index 61106fcc318..4a98328b459 100644 --- a/src/mame/video/stvvdp2.c +++ b/src/mame/video/stvvdp2.c @@ -4223,11 +4223,7 @@ static void stv_vdp2_check_tilemap(running_machine &machine, bitmap_rgb32 &bitma saturn_state *state = machine.driver_data<saturn_state>(); // int window_applied = 0; - rectangle mycliprect; - mycliprect.min_x = cliprect.min_x; - mycliprect.max_x = cliprect.max_x; - mycliprect.min_y = cliprect.min_y; - mycliprect.max_y = cliprect.max_y; + rectangle mycliprect = cliprect; if ( stv2_current_tilemap.linescroll_enable || stv2_current_tilemap.vertical_linescroll_enable || @@ -5295,10 +5291,7 @@ static void stv_vdp2_draw_rotation_screen(running_machine &machine, bitmap_rgb32 stv2_current_tilemap.transparency = STV_TRANSPARENCY_ALPHA; } - mycliprect.min_x = cliprect.min_x; - mycliprect.max_x = cliprect.max_x; - mycliprect.min_y = cliprect.min_y; - mycliprect.max_y = cliprect.max_y; + mycliprect = cliprect; if ( window_control ) { @@ -5962,12 +5955,8 @@ void stv_vdp2_dynamic_res_change(running_machine &machine) { int vblank_period,hblank_period; - rectangle visarea = machine.primary_screen->visible_area(); attoseconds_t refresh;; - visarea.min_x = 0; - visarea.max_x = horz_res-1; - visarea.min_y = 0; - visarea.max_y = vert_res-1; + rectangle visarea(0, horz_res-1, 0, vert_res-1); vblank_period = get_vblank_duration(machine); hblank_period = get_hblank_duration(machine); @@ -6362,10 +6351,7 @@ static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const r (STV_VDP2_SPW0A * 0x10) | (STV_VDP2_SPW1A * 0x20) | (STV_VDP2_SPSWA * 0x40); - mycliprect.min_x = cliprect.min_x; - mycliprect.max_x = cliprect.max_x; - mycliprect.min_y = cliprect.min_y; - mycliprect.max_y = cliprect.max_y; + mycliprect = cliprect; stv_vdp2_apply_window_on_layer(machine,mycliprect); diff --git a/src/mame/video/suprloco.c b/src/mame/video/suprloco.c index c5423e6631c..e7ca4a34b09 100644 --- a/src/mame/video/suprloco.c +++ b/src/mame/video/suprloco.c @@ -169,13 +169,8 @@ INLINE void draw_pixel(bitmap_ind16 &bitmap,const rectangle &cliprect,int x,int y = bitmap.height() - y - 1; } - if (x < cliprect.min_x || - x > cliprect.max_x || - y < cliprect.min_y || - y > cliprect.max_y) - return; - - bitmap.pix16(y, x) = color; + if (cliprect.contains(x, y)) + bitmap.pix16(y, x) = color; } diff --git a/src/mame/video/taitoic.c b/src/mame/video/taitoic.c index edf56f226e1..2e93491158f 100644 --- a/src/mame/video/taitoic.c +++ b/src/mame/video/taitoic.c @@ -506,7 +506,7 @@ INLINE void taitoic_drawscanline( bitmap_ind16 &bitmap, const rectangle &cliprec { UINT16 *dsti = &bitmap.pix16(y, x); UINT8 *dstp = &priority.pix8(y, x); - int length = cliprect.max_x - cliprect.min_x + 1; + int length = cliprect.width(); src += cliprect.min_x; dsti += cliprect.min_x; @@ -2352,7 +2352,7 @@ static void tc0100scn_tilemap_draw_fg( device_t *device, bitmap_ind16 &bitmap, c src_x = (256 - 64 - src_x) & width_mask; // Col offsets are 'tilemap' space 0-511, and apply to blocks of 8 pixels at once - for (x = 0; x <= (cliprect.max_x - cliprect.min_x); x++) + for (x = 0; x < cliprect.width(); x++) { column_offset = tc0100scn->colscroll_ram[(src_x & 0x3ff) / 8]; p = src_bitmap.pix16((src_y - column_offset) & height_mask, src_x); @@ -3264,7 +3264,7 @@ static void tc0480scp_bg01_draw( device_t *device, bitmap_ind16 &bitmap, const r int x_index, x_step; int machine_flip = 0; /* for ROT 180 ? */ - UINT16 screen_width = 512; //cliprect.max_x - cliprect.min_x + 1; + UINT16 screen_width = 512; //cliprect.width(); UINT16 min_y = cliprect.min_y; UINT16 max_y = cliprect.max_y; @@ -3400,7 +3400,7 @@ static void tc0480scp_bg23_draw( device_t *device, bitmap_ind16 &bitmap, const r int flipscreen = tc0480scp->pri_reg & 0x40; int machine_flip = 0; /* for ROT 180 ? */ - UINT16 screen_width = 512; //cliprect.max_x - cliprect.min_x + 1; + UINT16 screen_width = 512; //cliprect.width(); UINT16 min_y = cliprect.min_y; UINT16 max_y = cliprect.max_y; diff --git a/src/mame/video/tank8.c b/src/mame/video/tank8.c index a6b7d9c1eb3..b3b1c6cba36 100644 --- a/src/mame/video/tank8.c +++ b/src/mame/video/tank8.c @@ -158,26 +158,13 @@ static void draw_bullets(running_machine &machine, bitmap_ind16 &bitmap, const r for (i = 0; i < 8; i++) { - rectangle rect; - int x = get_x_pos(state, 8 + i); int y = get_y_pos(state, 8 + i); x -= 4; /* ? */ - rect.min_x = x; - rect.min_y = y; - rect.max_x = rect.min_x + 3; - rect.max_y = rect.min_y + 4; - - if (rect.min_x < cliprect.min_x) - rect.min_x = cliprect.min_x; - if (rect.min_y < cliprect.min_y) - rect.min_y = cliprect.min_y; - if (rect.max_x > cliprect.max_x) - rect.max_x = cliprect.max_x; - if (rect.max_y > cliprect.max_y) - rect.max_y = cliprect.max_y; + rectangle rect(x, x + 3, y, y + 4); + rect &= cliprect; bitmap.fill((i << 1) | 0x01, rect); } diff --git a/src/mame/video/taotaido.c b/src/mame/video/taotaido.c index f12ccc9561c..f92a47bc956 100644 --- a/src/mame/video/taotaido.c +++ b/src/mame/video/taotaido.c @@ -208,10 +208,7 @@ SCREEN_UPDATE_IND16(taotaido) rectangle clip; const rectangle &visarea = screen.visible_area(); - clip.min_x = visarea.min_x; - clip.max_x = visarea.max_x; - clip.min_y = visarea.min_y; - clip.max_y = visarea.max_y; + clip = visarea; for (line = 0; line < 224;line++) { diff --git a/src/mame/video/toaplan1.c b/src/mame/video/toaplan1.c index 12f00a438fa..79078fa00b8 100644 --- a/src/mame/video/toaplan1.c +++ b/src/mame/video/toaplan1.c @@ -1094,9 +1094,9 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r { const rectangle &visarea = machine.primary_screen->visible_area(); - sx_base = ((visarea.max_x + 1) - visarea.min_x) - (sx_base + 8); /* visarea.x = 320 */ - sy_base = ((visarea.max_y + 1) - visarea.min_y) - (sy_base + 8); /* visarea.y = 240 */ - sy_base += ((visarea.max_y + 1) - ((visarea.max_y + 1) - visarea.min_y)) * 2; /* Horizontal games are offset so adjust by +0x20 */ + sx_base = visarea.width() - (sx_base + 8); /* visarea.x = 320 */ + sy_base = visarea.height() - (sy_base + 8); /* visarea.y = 240 */ + sy_base += ((visarea.max_y + 1) - visarea.height()) * 2; /* Horizontal games are offset so adjust by +0x20 */ } for (dim_y = 0; dim_y < sprite_sizey; dim_y += 8) diff --git a/src/mame/video/toaplan2.c b/src/mame/video/toaplan2.c index ebea3ab08d8..6cce3a9be37 100644 --- a/src/mame/video/toaplan2.c +++ b/src/mame/video/toaplan2.c @@ -446,10 +446,7 @@ SCREEN_UPDATE_IND16( batrider ) rectangle clip; const rectangle &visarea = screen.visible_area(); - clip.min_x = visarea.min_x; - clip.max_x = visarea.max_x; - clip.min_y = visarea.min_y; - clip.max_y = visarea.max_y; + clip = visarea; /* used for 'for use in' and '8ing' screen on bbakraid, raizing on batrider */ for (line = 0; line < 256;line++) diff --git a/src/mame/video/triplhnt.c b/src/mame/video/triplhnt.c index 18d5837c6eb..3a319bcf5b8 100644 --- a/src/mame/video/triplhnt.c +++ b/src/mame/video/triplhnt.c @@ -59,17 +59,11 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r if (state->m_sprite_zoom) { - rect.min_x = hpos - 16; - rect.min_y = 196 - vpos; - rect.max_x = rect.min_x + 63; - rect.max_y = rect.min_y + 63; + rect.set(hpos - 16, hpos - 16 + 63, 196 - vpos, 196 - vpos + 63); } else { - rect.min_x = hpos - 16; - rect.min_y = 224 - vpos; - rect.max_x = rect.min_x + 31; - rect.max_y = rect.min_y + 31; + rect.set(hpos - 16, hpos - 16 + 31, 224 - vpos, 224 - vpos + 31); } /* render sprite to auxiliary bitmap */ @@ -78,14 +72,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r 2 * code + state->m_sprite_bank, 0, code & 8, 0, rect.min_x, rect.min_y); - if (rect.min_x < cliprect.min_x) - rect.min_x = cliprect.min_x; - if (rect.min_y < cliprect.min_y) - rect.min_y = cliprect.min_y; - if (rect.max_x > cliprect.max_x) - rect.max_x = cliprect.max_x; - if (rect.max_y > cliprect.max_y) - rect.max_y = cliprect.max_y; + rect &= cliprect; /* check for collisions and copy sprite */ diff --git a/src/mame/video/vectrex.c b/src/mame/video/vectrex.c index b6de9b37fe7..56361166f47 100644 --- a/src/mame/video/vectrex.c +++ b/src/mame/video/vectrex.c @@ -284,8 +284,8 @@ VIDEO_START(vectrex) screen_device *screen = machine.first_screen(); const rectangle &visarea = screen->visible_area(); - state->m_x_center=((visarea.max_x - visarea.min_x) / 2) << 16; - state->m_y_center=((visarea.max_y - visarea.min_y) / 2) << 16; + state->m_x_center=(visarea.width() / 2) << 16; + state->m_y_center=(visarea.height() / 2) << 16; state->m_x_max = visarea.max_x << 16; state->m_y_max = visarea.max_y << 16; @@ -484,8 +484,8 @@ VIDEO_START(raaspec) screen_device *screen = machine.first_screen(); const rectangle &visarea = screen->visible_area(); - state->m_x_center=((visarea.max_x - visarea.min_x) / 2) << 16; - state->m_y_center=((visarea.max_y - visarea.min_y) / 2) << 16; + state->m_x_center=(visarea.width() / 2) << 16; + state->m_y_center=(visarea.height() / 2) << 16; state->m_x_max = visarea.max_x << 16; state->m_y_max = visarea.max_y << 16; diff --git a/src/mame/video/videopin.c b/src/mame/video/videopin.c index 6591478fcc5..c2d51a7655b 100644 --- a/src/mame/video/videopin.c +++ b/src/mame/video/videopin.c @@ -51,8 +51,6 @@ SCREEN_UPDATE_IND16( videopin ) if (state->m_video_ram[offset] & 0x80) /* ball bit found */ { - rectangle rect; - int x = 8 * col; int y = 8 * row; @@ -61,19 +59,8 @@ SCREEN_UPDATE_IND16( videopin ) x += 4; /* account for delayed loading of flip-flop C4 */ - rect.min_x = x; - rect.min_y = y; - rect.max_x = x + 15; - rect.max_y = y + 15; - - if (rect.min_x < cliprect.min_x) - rect.min_x = cliprect.min_x; - if (rect.min_y < cliprect.min_y) - rect.min_y = cliprect.min_y; - if (rect.max_x > cliprect.max_x) - rect.max_x = cliprect.max_x; - if (rect.max_y > cliprect.max_y) - rect.max_y = cliprect.max_y; + rectangle rect(x, x + 15, y, y + 15); + rect &= cliprect; x -= state->m_ball_x; y -= state->m_ball_y; diff --git a/src/mame/video/warpwarp.c b/src/mame/video/warpwarp.c index 11d6b277b48..4f10cbd3239 100644 --- a/src/mame/video/warpwarp.c +++ b/src/mame/video/warpwarp.c @@ -217,7 +217,7 @@ WRITE8_HANDLER( warpwarp_videoram_w ) INLINE void geebee_plot(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, pen_t pen) { - if (x >= cliprect.min_x && x <= cliprect.max_x && y >= cliprect.min_y && y <= cliprect.max_y) + if (cliprect.contains(x, y)) bitmap.pix16(y, x) = pen; } diff --git a/src/mame/video/wgp.c b/src/mame/video/wgp.c index 901cb23f892..602233a5aec 100644 --- a/src/mame/video/wgp.c +++ b/src/mame/video/wgp.c @@ -538,7 +538,7 @@ static void wgp_piv_layer_draw( running_machine &machine, bitmap_ind16 &bitmap, int flipscreen = 0; /* n/a */ int machine_flip = 0; /* for ROT 180 ? */ - UINT16 screen_width = cliprect.max_x - cliprect.min_x + 1; + UINT16 screen_width = cliprect.width(); UINT16 min_y = cliprect.min_y; UINT16 max_y = cliprect.max_y; diff --git a/src/mame/video/xmen.c b/src/mame/video/xmen.c index 67aa598a0ef..b0decf56b85 100644 --- a/src/mame/video/xmen.c +++ b/src/mame/video/xmen.c @@ -154,15 +154,9 @@ SCREEN_VBLANK( xmen6p ) int offset; // const rectangle *visarea = screen.machine().primary_screen->visible_area(); - // cliprect.min_x = visarea->min_x; - // cliprect.max_x = visarea->max_x; - // cliprect.min_y = visarea->min_y; - // cliprect.max_y = visarea->max_y; - - cliprect.min_x = 0; - cliprect.max_x = 64 * 8 - 1; - cliprect.min_y = 2 * 8; - cliprect.max_y = 30 * 8 - 1; + // cliprect = *visarea; + + cliprect.set(0, 64 * 8 - 1, 2 * 8, 30 * 8 - 1); if (screen.machine().primary_screen->frame_number() & 0x01) diff --git a/src/mame/video/ygv608.c b/src/mame/video/ygv608.c index 83f8d0227c4..e2ffc8a6d31 100644 --- a/src/mame/video/ygv608.c +++ b/src/mame/video/ygv608.c @@ -747,9 +747,7 @@ SCREEN_UPDATE_IND16( ygv608 ) const rectangle &visarea = screen.visible_area(); // clip to the current bitmap - finalclip.min_x = finalclip.min_y = 0; - finalclip.max_x = screen.width() - 1; - finalclip.max_y = screen.height() - 1; + finalclip.set(0, screen.width() - 1, 0, screen.height() - 1); finalclip &= cliprect; // punt if not initialized diff --git a/src/mame/video/zac2650.c b/src/mame/video/zac2650.c index 255f3184a60..90872a19a0f 100644 --- a/src/mame/video/zac2650.c +++ b/src/mame/video/zac2650.c @@ -79,15 +79,8 @@ static int SpriteCollision(running_machine &machine, int first,int second) { for (y = fy; y < fy + machine.gfx[expand]->height; y++) { - if ((x < visarea.min_x) || - (x > visarea.max_x) || - (y < visarea.min_y) || - (y > visarea.max_y)) - { - continue; - } - - Checksum += state->m_spritebitmap.pix16(y, x); + if (visarea.contains(x, y)) + Checksum += state->m_spritebitmap.pix16(y, x); } } @@ -105,15 +98,8 @@ static int SpriteCollision(running_machine &machine, int first,int second) { for (y = fy; y < fy + machine.gfx[expand]->height; y++) { - if ((x < visarea.min_x) || - (x > visarea.max_x) || - (y < visarea.min_y) || - (y > visarea.max_y)) - { - continue; - } - - Checksum -= state->m_spritebitmap.pix16(y, x); + if (visarea.contains(x, y)) + Checksum -= state->m_spritebitmap.pix16(y, x); } } @@ -194,19 +180,12 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r { for (y = by; y < by + machine.gfx[expand]->height; y++) { - if ((x < visarea.min_x) || - (x > visarea.max_x) || - (y < visarea.min_y) || - (y > visarea.max_y)) - { - continue; - } - - if (bitmap.pix16(y, x) != state->m_bitmap.pix16(y, x)) - { - state->m_CollisionBackground = 0x80; - break; - } + if (visarea.contains(x, y)) + if (bitmap.pix16(y, x) != state->m_bitmap.pix16(y, x)) + { + state->m_CollisionBackground = 0x80; + break; + } } } |