Previous 15994 Revisions Next

r14065 Monday 16th January, 2012 at 18:13:22 UTC by Aaron Giles
Leverage rectangle methods to make code simpler and clearer.
[src/mess/drivers]gp32.c m20.c multi16.c multi8.c mz2500.c next.c pc6001.c pc8801.c pc88va.c smc777.c supracan.c x1.c
[src/mess/machine]amstrad.c orion.c sms.c vector06.c
[src/mess/video]911_vdt.c apple2gs.c crtc_ega.c fm7.c fmtowns.c gamecom.c gb.c hd66421.c odyssey2.c pcw.c pcw16.c spectrum.c vdc8563.c vic4567.c vtvideo.c wswan.c x68k.c zx.c

src/mess/machine/vector06.c
r14064r14065
4141
4242void vector06_state::vector06_set_video_mode(int width)
4343{
44   rectangle visarea;
45
46   visarea.min_x = 0;
47   visarea.min_y = 0;
48   visarea.max_x = width+64-1;
49   visarea.max_y = 256+64-1;
44   rectangle visarea(0, width+64-1, 0, 256+64-1);
5045   machine().primary_screen->configure(width+64, 256+64, visarea, machine().primary_screen->frame_period().attoseconds);
5146}
5247
src/mess/machine/orion.c
r14064r14065
8585
8686static void orion_set_video_mode(running_machine &machine, int width)
8787{
88      rectangle visarea;
89
90      visarea.min_x = 0;
91      visarea.min_y = 0;
92      visarea.max_x = width-1;
93      visarea.max_y = 255;
88      rectangle visarea(0, width-1, 0, 255);
9489      machine.primary_screen->configure(width, 256, visarea, machine.primary_screen->frame_period().attoseconds);
9590}
9691
src/mess/machine/amstrad.c
r14064r14065
28942894   if ( input_port_read( machine, "solder_links" ) & 0x10 )
28952895   {
28962896      /* PAL */
2897      visarea.min_x = 0;
2898      visarea.max_x = 64 + 640 + 64 - 1;
2899      visarea.min_y = 34;
2900      visarea.max_y = 34 + 15 + 242 + 15 - 1;
2897      visarea.set(0, 64 + 640 + 64 - 1, 34, 34 + 15 + 242 + 15 - 1);
29012898      height = 312;
29022899   }
29032900   else
29042901   {
29052902      /* NTSC */
2906      visarea.min_x = 0;
2907      visarea.max_x = 64 + 640 + 64 - 1;
2908      visarea.min_y = 16;
2909      visarea.max_y = 16 + 15 + 200 + 15 - 1;
2903      visarea.set(0, 64 + 640 + 64 - 1, 16, 16 + 15 + 200 + 15 - 1);
29102904      height = 262;
29112905   }
29122906   refresh = HZ_TO_ATTOSECONDS( XTAL_16MHz ) * 1024 * height;
src/mess/machine/sms.c
r14064r14065
441441static UINT16 screen_hpos_nonscaled( screen_device &screen, int scaled_hpos )
442442{
443443   const rectangle &visarea = screen.visible_area();
444   int offset_x = (scaled_hpos * (visarea.max_x - visarea.min_x)) / 255;
444   int offset_x = (scaled_hpos * visarea.width()) / 255;
445445   return visarea.min_x + offset_x;
446446}
447447
src/mess/video/wswan.c
r14064r14065
3737   }
3838
3939   if ( state->m_vdp.display_vertical ) {
40      rectangle rec2;
41      rec2.min_y = 28*8 - 1 - rec->max_x;
42      rec2.max_y = 28*8 - 1 - rec->min_x;
43      rec2.min_x = rec->min_y;
44      rec2.max_x = rec->max_y;
40      rectangle rec2(rec->min_y, rec->max_y, 28*8 - 1 - rec->max_x, 28*8 - 1 - rec->min_x);
4541      state->m_bitmap.fill(pen, rec2 );
4642   } else {
4743      state->m_bitmap.fill(pen, *rec );
r14064r14065
545541void wswan_refresh_scanline( running_machine &machine )
546542{
547543   wswan_state *state = machine.driver_data<wswan_state>();
548   rectangle rec;
549544
550545   wswan_setup_palettes(state);
551546
552   rec.min_x = 0;
553   rec.max_x = WSWAN_X_PIXELS;
554   rec.min_y = rec.max_y = state->m_vdp.current_line;
547   rectangle rec(0, WSWAN_X_PIXELS, state->m_vdp.current_line, state->m_vdp.current_line);
555548   if ( state->m_ws_portram[0x14] ) {
556549      /* Not sure if these background color checks and settings are correct */
557550      if ( state->m_vdp.color_mode && state->m_vdp.colors_16 ) {
src/mess/video/zx.c
r14064r14065
5454      {
5555         if (y == new_y)
5656         {
57            r.min_x = m_old_x;
58            r.max_x = new_x;
59            r.min_y = r.max_y = y;
57            r.set(m_old_x, new_x, y, y);
6058            bitmap.fill(color, r);
6159            break;
6260         }
6361         else
6462         {
65            r.min_x = m_old_x;
66            r.max_x = visarea.max_x;
67            r.min_y = r.max_y = y;
63            r.set(m_old_x, visarea.max_x, y, y);
6864            bitmap.fill(color, r);
6965            m_old_x = 0;
7066         }
r14064r14065
10197   rectangle r;
10298
10399   bitmap_ind16 &bitmap = state->m_bitmap;
104   r.min_x = r1.min_x;
105   r.max_x = r1.max_x;
106   r.min_y = r.max_y = state->m_ula_scanline_count;
100   r.set(r1.min_x, r1.max_x, state->m_ula_scanline_count, state->m_ula_scanline_count);
107101   bitmap.fill(1, r);
108102//  logerror("ULA %3d[%d] NMI, R:$%02X, $%04x\n", machine.primary_screen->vpos(), ula_scancode_count, (unsigned) cpu_get_reg(machine.device("maincpu"), Z80_R), (unsigned) cpu_get_reg(machine.device("maincpu"), Z80_PC));
109103   cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE);
src/mess/video/apple2gs.c
r14064r14065
116116      /* call legacy Apple II video rendering at scanline 0 to draw into the off-screen buffer */
117117      if (beamy == 0)
118118      {
119         rectangle new_cliprect;
120119         apple2_state *a2state = screen.machine().driver_data<apple2_state>();
121120
122121         // check if DHR should be monochrome 560x192
r14064r14065
129128            a2state->m_monochrome_dhr = false;
130129         }
131130
132         new_cliprect.min_x = 0;
133         new_cliprect.min_y = 0;
134         new_cliprect.max_x = 559;
135         new_cliprect.max_y = 191;
131         rectangle new_cliprect(0, 559, 0, 191);
136132         SCREEN_UPDATE_NAME(apple2)(NULL, screen, *state->m_legacy_gfx, new_cliprect);
137133      }
138134
src/mess/video/911_vdt.c
r14064r14065
510510
511511   if (! vdt->display_enable)
512512   {
513      rectangle my_rect;
513      rectangle my_rect(x, x + 80*7 - 1, y, y + height*10 - 1);
514514
515      my_rect.min_x = x;
516      my_rect.max_x = x + 80*7 - 1;
517
518      my_rect.min_y = y;
519      my_rect.max_y = y + height*10 - 1;
520
521515      bitmap.fill(0, my_rect);
522516   }
523517   else
src/mess/video/gb.c
r14064r14065
348348         /* Draw empty pixels when the background is disabled */
349349         if ( ! ( LCDCONT & 0x01 ) )
350350         {
351            rectangle r;
352            r.min_y = r.max_y = state->m_lcd.current_line;
353            r.min_x = state->m_lcd.start_x;
354            r.max_x = state->m_lcd.end_x - 1;
351            rectangle r(state->m_lcd.start_x, state->m_lcd.end_x - 1, state->m_lcd.current_line, state->m_lcd.current_line);
355352            bitmap.fill(state->m_lcd.gb_bpal[0], r );
356353         }
357354         while ( l < 2 )
r14064r14065
426423            if ( state->m_lcd.current_line < 144 )
427424            {
428425               screen_device *screen = machine.first_screen();
429               rectangle r1;
430426               const rectangle &r = screen->visible_area();
431               r1.min_y = r1.max_y = state->m_lcd.current_line;
432               r1.min_x = r.min_x;
433               r1.max_x = r.max_x;
427               rectangle r1(r.min_x, r.max_x, state->m_lcd.current_line, state->m_lcd.current_line);
434428               bitmap.fill(0, r1 );
435429            }
436430            state->m_lcd.previous_line = state->m_lcd.current_line;
r14064r14065
679673            return;
680674         case 2: /* Blank screen (black) */
681675            {
682               rectangle r;
683               r.min_x = SGB_XOFFSET;
684               r.max_x = SGB_XOFFSET + 160-1;
685               r.min_y = SGB_YOFFSET;
686               r.max_y = SGB_YOFFSET + 144 - 1;
676               rectangle r(SGB_XOFFSET, SGB_XOFFSET + 160-1, SGB_YOFFSET, SGB_YOFFSET + 144 - 1);
687677               bitmap.fill(0, r );
688678            } return;
689679         case 3: /* Blank screen (white - or should it be color 0?) */
690680            {
691               rectangle r;
692               r.min_x = SGB_XOFFSET;
693               r.max_x = SGB_XOFFSET + 160 - 1;
694               r.min_y = SGB_YOFFSET;
695               r.max_y = SGB_YOFFSET + 144 - 1;
681               rectangle r(SGB_XOFFSET, SGB_XOFFSET + 160 - 1, SGB_YOFFSET, SGB_YOFFSET + 144 - 1);
696682               bitmap.fill(32767, r );
697683            } return;
698684         }
r14064r14065
710696         /* if background or screen disabled clear line */
711697         if ( ! ( LCDCONT & 0x01 ) )
712698         {
713            rectangle r;
714            r.min_x = SGB_XOFFSET;
715            r.max_x = SGB_XOFFSET + 160 - 1;
716            r.min_y = r.max_y = state->m_lcd.current_line + SGB_YOFFSET;
699            rectangle r(SGB_XOFFSET, SGB_XOFFSET + 160 - 1, state->m_lcd.current_line + SGB_YOFFSET, state->m_lcd.current_line + SGB_YOFFSET);
717700            bitmap.fill(0, r );
718701         }
719702         while( l < 2 )
r14064r14065
792775            /* Also refresh border here??? */
793776            if ( state->m_lcd.current_line < 144 )
794777            {
795               rectangle r;
796               r.min_x = SGB_XOFFSET;
797               r.max_x = SGB_XOFFSET + 160 - 1;
798               r.min_y = r.max_y = state->m_lcd.current_line + SGB_YOFFSET;
778               rectangle r(SGB_XOFFSET, SGB_XOFFSET + 160 - 1, state->m_lcd.current_line + SGB_YOFFSET, state->m_lcd.current_line + SGB_YOFFSET);
799779               bitmap.fill(0, r);
800780            }
801781            state->m_lcd.previous_line = state->m_lcd.current_line;
r14064r14065
982962         /* Draw empty line when the background is disabled */
983963         if ( ! ( LCDCONT & 0x01 ) )
984964         {
985            rectangle r;
986            r.min_y = r.max_y = state->m_lcd.current_line;
987            r.min_x = state->m_lcd.start_x;
988            r.max_x = state->m_lcd.end_x - 1;
965            rectangle r(state->m_lcd.start_x, state->m_lcd.end_x - 1, state->m_lcd.current_line, state->m_lcd.current_line);
989966            bitmap.fill(( ! state->m_lcd.gbc_mode ) ? 0 : 32767 , r);
990967         }
991968         while ( l < 2 )
r14064r14065
11001077            if ( state->m_lcd.current_line < 144 )
11011078            {
11021079               screen_device *screen = machine.first_screen();
1103               rectangle r;
11041080               const rectangle &r1 = screen->visible_area();
1105               r.min_x = r1.min_x;
1106               r.max_x = r1.max_x;
1107               r.min_y = r.max_y = state->m_lcd.current_line;
1081               rectangle r(r1.min_x, r1.max_x, state->m_lcd.current_line, state->m_lcd.current_line);
11081082               bitmap.fill(( ! state->m_lcd.gbc_mode ) ? 0 : 32767 , r);
11091083            }
11101084            state->m_lcd.previous_line = state->m_lcd.current_line;
src/mess/video/pcw16.c
r14064r14065
180180   if ((state->m_video_control & (1<<6))==0)
181181   {
182182      /* blank */
183      rectangle rect;
184
185      rect.min_x = 0;
186      rect.min_y = 0;
187      rect.max_x = PCW16_SCREEN_WIDTH;
188      rect.max_y = PCW16_SCREEN_HEIGHT;
189
183      rectangle rect(0, PCW16_SCREEN_WIDTH, 0, PCW16_SCREEN_HEIGHT);
190184      bitmap.fill(border_colour, rect);
191185   }
192186   else
193187   {
194188      /* no blank */
195189
196      rectangle rect;
197190
198191      /* render top border */
199      rect.min_x = 0;
200      rect.min_y = 0;
201      rect.max_x = PCW16_SCREEN_WIDTH;
202      rect.max_y = PCW16_BORDER_HEIGHT;
192      rectangle rect(0, PCW16_SCREEN_WIDTH, 0, PCW16_BORDER_HEIGHT);
203193      bitmap.fill(border_colour, rect);
204194
205195      /* render bottom border */
206      rect.min_x = 0;
207      rect.min_y = PCW16_BORDER_HEIGHT + PCW16_DISPLAY_HEIGHT;
208      rect.max_x = PCW16_SCREEN_WIDTH;
209      rect.max_y = rect.min_y + PCW16_BORDER_HEIGHT;
196      rect.set(0, PCW16_SCREEN_WIDTH, PCW16_BORDER_HEIGHT + PCW16_DISPLAY_HEIGHT, PCW16_BORDER_HEIGHT + PCW16_DISPLAY_HEIGHT + PCW16_BORDER_HEIGHT);
210197      bitmap.fill(border_colour, rect);
211198
212199      /* render border on either side of display */
src/mess/video/gamecom.c
r14064r14065
1313
1414   if ( ~state->m_p_ram[SM8521_LCDC] & 0x80 )
1515   {
16      rectangle rec;
17      rec.min_x = 0;
18      rec.max_x = Y_PIXELS - 1;
19      rec.min_y = rec.max_y = state->m_scanline;
16      rectangle rec(0, Y_PIXELS - 1, state->m_scanline, state->m_scanline);
2017      state->m_bitmap.fill(0, rec );
2118      return;
2219   }
src/mess/video/x68k.c
r14064r14065
132132   state->m_crtc.hsync_end = (state->m_crtc.reg[1]) * 8;
133133   state->m_crtc.vsync_end = (state->m_crtc.reg[5]) / state->m_crtc.vmultiple;
134134   state->m_crtc.hsyncadjust = state->m_crtc.reg[8];
135   scr.min_x = scr.min_y = 0;
136   scr.max_x = state->m_crtc.htotal - 8;
137   scr.max_y = state->m_crtc.vtotal;
135   scr.set(0, state->m_crtc.htotal - 8, 0, state->m_crtc.vtotal);
138136   if(scr.max_y <= state->m_crtc.vend)
139137      scr.max_y = state->m_crtc.vend + 2;
140138   if(scr.max_x <= state->m_crtc.hend)
141139      scr.max_x = state->m_crtc.hend + 2;
142   visiblescr.min_x = state->m_crtc.hbegin;
143   visiblescr.max_x = state->m_crtc.hend;
144   visiblescr.min_y = state->m_crtc.vbegin;
145   visiblescr.max_y = state->m_crtc.vend;
140   visiblescr.set(state->m_crtc.hbegin, state->m_crtc.hend, state->m_crtc.vbegin, state->m_crtc.vend);
146141
147142   // expand visible area to the size indicated by CRTC reg 20
148143   length = state->m_crtc.hend - state->m_crtc.hbegin;
src/mess/video/spectrum.c
r14064r14065
281281                or after the last visible border line however the whole
282282                border would be redrawn in the correct colour during the
283283                next frame anyway! */
284      r.min_x = 0;
285      r.max_x = TotalScreenWidth-1;
286      r.min_y = 0;
287      r.max_y = TopBorderLines-1;
284      r.set(0, TotalScreenWidth-1, 0, TopBorderLines-1);
288285      bitmap.fill(machine.pens[state->m_CurrBorderColor], r);
289286
290      r.min_x = 0;
291      r.max_x = LeftBorderPixels-1;
292      r.min_y = TopBorderLines;
293      r.max_y = TopBorderLines+ScreenLines-1;
287      r.set(0, LeftBorderPixels-1, TopBorderLines, TopBorderLines+ScreenLines-1);
294288      bitmap.fill(machine.pens[state->m_CurrBorderColor], r);
295289
296      r.min_x = LeftBorderPixels+ScreenPixels;
297      r.max_x = TotalScreenWidth-1;
290      r.setx(LeftBorderPixels+ScreenPixels, TotalScreenWidth-1);
298291      bitmap.fill(machine.pens[state->m_CurrBorderColor], r);
299292
300      r.min_x = 0;
301      r.max_x = TotalScreenWidth-1;
302      r.min_y = TopBorderLines+ScreenLines;
303      r.max_y = TotalScreenHeight-1;
293      r.set(0, TotalScreenWidth-1, TopBorderLines+ScreenLines, TotalScreenHeight-1);
304294      bitmap.fill(machine.pens[state->m_CurrBorderColor], r);
305295
306296//          logerror ("Setting border colour to %d (Last = %d, Full Refresh = %d)\n", state->m_CurrBorderColor, state->m_LastDisplayedBorderColor, full_refresh);
r14064r14065
345335            while ((CurrItem < NumItems) && (pItem[CurrItem].Event_Time < (CyclesSoFar+DisplayCyclesPerLine)))
346336            {
347337               NextScrX = (int)(pItem[CurrItem].Event_Time - CyclesSoFar) * (float)TotalScreenWidth / (float)DisplayCyclesPerLine;
348               r.min_x = ScrX;
349               r.max_x = NextScrX-1;
338               r.setx(ScrX, NextScrX-1);
350339               bitmap.fill(machine.pens[state->m_CurrBorderColor], r);
351340               ScrX = NextScrX;
352341               state->m_CurrBorderColor = pItem[CurrItem].Event_Data;
r14064r14065
354343                  CurrItem++;
355344               } while ((CurrItem < NumItems) && (pItem[CurrItem].Event_ID != EventID));
356345            }
357            r.min_x = ScrX;
358            r.max_x = TotalScreenWidth-1;
346            r.setx(ScrX, TotalScreenWidth-1);
359347            bitmap.fill(machine.pens[state->m_CurrBorderColor], r);
360348         }
361349
r14064r14065
397385            while ((CurrItem < NumItems) && (pItem[CurrItem].Event_Time < (CyclesSoFar+LeftBorderCycles)))
398386            {
399387               NextScrX = (int)(pItem[CurrItem].Event_Time - CyclesSoFar) * (float)LeftBorderPixels / (float)LeftBorderCycles;
400               r.min_x = ScrX;
401               r.max_x = NextScrX-1;
388               r.setx(ScrX, NextScrX-1);
402389               bitmap.fill(machine.pens[state->m_CurrBorderColor], r);
403390               ScrX = NextScrX;
404391               state->m_CurrBorderColor = pItem[CurrItem].Event_Data;
r14064r14065
406393                  CurrItem++;
407394               } while ((CurrItem < NumItems) && (pItem[CurrItem].Event_ID != EventID));
408395            }
409            r.min_x = ScrX;
410            r.max_x = LeftBorderPixels-1;
396            r.setx(ScrX, LeftBorderPixels-1);
411397            bitmap.fill(machine.pens[state->m_CurrBorderColor], r);
412398         }
413399
r14064r14065
442428            while ((CurrItem < NumItems) && (pItem[CurrItem].Event_Time < (CyclesSoFar+DisplayCyclesPerLine)))
443429            {
444430               NextScrX = LeftBorderPixels + ScreenPixels + (int)(pItem[CurrItem].Event_Time - CyclesSoFar) * (float)RightBorderPixels / (float)RightBorderCycles;
445               r.min_x = ScrX;
446               r.max_x = NextScrX-1;
431               r.setx(ScrX, NextScrX-1);
447432               bitmap.fill(machine.pens[state->m_CurrBorderColor], r);
448433               ScrX = NextScrX;
449434               state->m_CurrBorderColor = pItem[CurrItem].Event_Data;
r14064r14065
451436                  CurrItem++;
452437               } while ((CurrItem < NumItems) && (pItem[CurrItem].Event_ID != EventID));
453438            }
454            r.min_x = ScrX;
455            r.max_x = TotalScreenWidth-1;
439            r.setx(ScrX, TotalScreenWidth-1);
456440            bitmap.fill(machine.pens[state->m_CurrBorderColor], r);
457441         }
458442
r14064r14065
492476            while ((CurrItem < NumItems) && (pItem[CurrItem].Event_Time < (CyclesSoFar+DisplayCyclesPerLine)))
493477            {
494478               NextScrX = (int)(pItem[CurrItem].Event_Time - CyclesSoFar) * (float)TotalScreenWidth / (float)DisplayCyclesPerLine;
495               r.min_x = ScrX;
496               r.max_x = NextScrX-1;
479               r.setx(ScrX, NextScrX-1);
497480               bitmap.fill(machine.pens[state->m_CurrBorderColor], r);
498481               ScrX = NextScrX;
499482               state->m_CurrBorderColor = pItem[CurrItem].Event_Data;
r14064r14065
501484                  CurrItem++;
502485               } while ((CurrItem < NumItems) && (pItem[CurrItem].Event_ID != EventID));
503486            }
504            r.min_x = ScrX;
505            r.max_x = TotalScreenWidth-1;
487            r.setx(ScrX, TotalScreenWidth-1);
506488            bitmap.fill(machine.pens[state->m_CurrBorderColor], r);
507489         }
508490
src/mess/video/crtc_ega.c
r14064r14065
276276            (hsync_on_pos <= horiz_pix_total) && (vsync_on_pos <= vert_pix_total) &&
277277            (hsync_on_pos != hsync_off_pos))
278278         {
279            rectangle visarea;
280
281279            attoseconds_t refresh = HZ_TO_ATTOSECONDS(crtc_ega->clock) * (crtc_ega->horiz_char_total + 1) * vert_pix_total;
282280
283            visarea.min_x = 0;
284            visarea.min_y = 0;
285            visarea.max_x = max_visible_x;
286            visarea.max_y = max_visible_y;
281            rectangle visarea(0, max_visible_x, 0, max_visible_y);
287282
288283            if (LOG) logerror("CRTC_EGA config screen: HTOTAL: 0x%x  VTOTAL: 0x%x  MAX_X: 0x%x  MAX_Y: 0x%x  HSYNC: 0x%x-0x%x  VSYNC: 0x%x-0x%x  Freq: %ffps\n",
289284                          horiz_pix_total, vert_pix_total, max_visible_x, max_visible_y, hsync_on_pos, hsync_off_pos - 1, vsync_on_pos, vsync_off_pos - 1, 1 / ATTOSECONDS_TO_DOUBLE(refresh));
src/mess/video/pcw.c
r14064r14065
2222VIDEO_START( pcw )
2323{
2424   pcw_state *state = machine.driver_data<pcw_state>();
25   rectangle rect;
26   rect.min_x = rect.min_y = 0;
27   rect.max_x = PCW_PRINTER_WIDTH - 1;
28   rect.max_y = PCW_PRINTER_HEIGHT - 1;
25   rectangle rect(0, PCW_PRINTER_WIDTH - 1, 0, PCW_PRINTER_HEIGHT - 1);
2926
3027   state->m_prn_output = auto_bitmap_ind16_alloc(machine,PCW_PRINTER_WIDTH,PCW_PRINTER_HEIGHT);
3128   state->m_prn_output->fill(1, rect);
r14064r14065
7875   /* video enable? */
7976   if ((state->m_vdu_video_control_register & (1<<6))!=0)
8077   {
81      rectangle rect;
82
8378      /* render top border */
84      rect.min_x = 0;
85      rect.min_y = 0;
86      rect.max_x = PCW_SCREEN_WIDTH;
87      rect.max_y = PCW_BORDER_HEIGHT;
79      rectangle rect(0, PCW_SCREEN_WIDTH, 0, PCW_BORDER_HEIGHT);
8880      bitmap.fill(pen0, rect);
8981
9082      /* render bottom border */
91      rect.min_x = 0;
92      rect.min_y = PCW_BORDER_HEIGHT + PCW_DISPLAY_HEIGHT;
93      rect.max_x = PCW_SCREEN_WIDTH;
94      rect.max_y = rect.min_y + PCW_BORDER_HEIGHT;
83      rect.set(0, PCW_SCREEN_WIDTH, PCW_BORDER_HEIGHT + PCW_DISPLAY_HEIGHT, PCW_BORDER_HEIGHT + PCW_DISPLAY_HEIGHT + PCW_BORDER_HEIGHT);
9584      bitmap.fill(pen0, rect);
9685
9786      /* offset to start in table */
r14064r14065
172161   else
173162   {
174163      /* not video - render whole lot in pen 0 */
175      rectangle rect;
176
177      /* render top border */
178      rect.min_x = 0;
179      rect.min_y = 0;
180      rect.max_x = PCW_SCREEN_WIDTH;
181      rect.max_y = PCW_SCREEN_HEIGHT;
182
164      rectangle rect(0, PCW_SCREEN_WIDTH, 0, PCW_SCREEN_HEIGHT);
183165      bitmap.fill(pen0, rect);
184166   }
185167   return 0;
r14064r14065
190172   pcw_state *state = screen.machine().driver_data<pcw_state>();
191173
192174   // printer output
193   rectangle rect;
194175   INT32 feed;
195   rect.min_x = rect.min_y = 0;
196   rect.max_x = PCW_PRINTER_WIDTH - 1;
197   rect.max_y = PCW_PRINTER_HEIGHT - 1;
176   rectangle rect(0, PCW_PRINTER_WIDTH - 1, 0, PCW_PRINTER_HEIGHT - 1);
198177   feed = -(state->m_paper_feed / 2);
199178   copyscrollbitmap(bitmap,*state->m_prn_output,0,NULL,1,&feed,rect);
200179   bitmap.pix16(PCW_PRINTER_HEIGHT-1, state->m_printer_headpos) = 0;
src/mess/video/vic4567.c
r14064r14065
18021802
18031803   if (XPOS > 0)
18041804   {
1805      vis.min_x = 0;
1806      vis.max_x = XPOS - 1;
1807      vis.min_y = 0;
1808      vis.max_y = visarea.max_y;
1805      vis.set(0, XPOS - 1, 0, visarea.max_y);
18091806      vic3->bitmap->fill(FRAMECOLOR, vis);
18101807   }
18111808
18121809   if (XPOS + VIC3_BITPLANES_WIDTH < visarea.max_x)
18131810   {
1814      vis.min_x = XPOS + VIC3_BITPLANES_WIDTH;
1815      vis.max_x = visarea.max_x;
1816      vis.min_y = 0;
1817      vis.max_y = visarea.max_y;
1811      vis.set(XPOS + VIC3_BITPLANES_WIDTH, visarea.max_x, 0, visarea.max_y);
18181812      vic3->bitmap->fill(FRAMECOLOR, vis);
18191813   }
18201814
18211815   if (YPOS > 0)
18221816   {
1823      vis.min_y = 0;
1824      vis.max_y = YPOS - 1;
1825      vis.min_x = 0;
1826      vis.max_x = visarea.max_x;
1817      vis.set(0, visarea.max_x, 0, YPOS - 1);
18271818      vic3->bitmap->fill(FRAMECOLOR, vis);
18281819   }
18291820
18301821   if (YPOS + VIC3_LINES < visarea.max_y)
18311822   {
1832      vis.min_y = YPOS + VIC3_LINES;
1833      vis.max_y = visarea.max_y;
1834      vis.min_x = 0;
1835      vis.max_x = visarea.max_x;
1823      vis.set(0, visarea.max_x, YPOS + VIC3_LINES, visarea.max_y);
18361824      vic3->bitmap->fill(FRAMECOLOR, vis);
18371825   }
18381826}
src/mess/video/vtvideo.c
r14064r14065
8383   horiz_pix_total = vt->columns * 10;
8484   vert_pix_total  = 25 * 10;
8585
86   visarea.min_x = 0;
87   visarea.min_y = 0;
88   visarea.max_x = horiz_pix_total - 1;
89   visarea.max_y = vert_pix_total - 1;
86   visarea.set(0, horiz_pix_total - 1, 0, vert_pix_total - 1);
9087
9188   vt->screen->configure(horiz_pix_total, vert_pix_total, visarea,
9289            vt->screen->frame_period().attoseconds);
src/mess/video/fmtowns.c
r14064r14065
9999static void towns_crtc_refresh_mode(running_machine &machine)
100100{
101101   towns_state* state = machine.driver_data<towns_state>();
102   rectangle scr;
103102   unsigned int width,height;
104103
105   scr.min_x = scr.min_y = 0;
106   scr.max_x = state->m_video.towns_crtc_reg[4];
107   scr.max_y = state->m_video.towns_crtc_reg[8] / 2;
104   rectangle scr(0, state->m_video.towns_crtc_reg[4], 0, state->m_video.towns_crtc_reg[8] / 2);
108105
109106   // layer 0
110107   width = state->m_video.towns_crtc_reg[10] - state->m_video.towns_crtc_reg[9];
111108   height = (state->m_video.towns_crtc_reg[14] - state->m_video.towns_crtc_reg[13]) / 2;
112   state->m_video.towns_crtc_layerscr[0].min_x = (scr.max_x / 2) - (width / 2);
113   state->m_video.towns_crtc_layerscr[0].min_y = (scr.max_y / 2) - (height / 2);
114   state->m_video.towns_crtc_layerscr[0].max_x = (scr.max_x / 2) + (width / 2);
115   state->m_video.towns_crtc_layerscr[0].max_y = (scr.max_y / 2) + (height / 2);
109   state->m_video.towns_crtc_layerscr[0].min_x = scr.xcenter() - (width / 2);
110   state->m_video.towns_crtc_layerscr[0].min_y = scr.ycenter() - (height / 2);
111   state->m_video.towns_crtc_layerscr[0].max_x = scr.xcenter() + (width / 2);
112   state->m_video.towns_crtc_layerscr[0].max_y = scr.ycenter() + (height / 2);
116113
117114   // layer 1
118115   width = state->m_video.towns_crtc_reg[12] - state->m_video.towns_crtc_reg[11];
119116   height = (state->m_video.towns_crtc_reg[16] - state->m_video.towns_crtc_reg[15]) / 2;
120   state->m_video.towns_crtc_layerscr[1].min_x = (scr.max_x / 2) - (width / 2);
121   state->m_video.towns_crtc_layerscr[1].min_y = (scr.max_y / 2) - (height / 2);
122   state->m_video.towns_crtc_layerscr[1].max_x = (scr.max_x / 2) + (width / 2);
123   state->m_video.towns_crtc_layerscr[1].max_y = (scr.max_y / 2) + (height / 2);
117   state->m_video.towns_crtc_layerscr[1].min_x = scr.xcenter() - (width / 2);
118   state->m_video.towns_crtc_layerscr[1].min_y = scr.ycenter() - (height / 2);
119   state->m_video.towns_crtc_layerscr[1].max_x = scr.xcenter() + (width / 2);
120   state->m_video.towns_crtc_layerscr[1].max_y = scr.ycenter() + (height / 2);
124121
125122   // sanity checks
126123   if(scr.max_x == 0 || scr.max_y == 0)
src/mess/video/vdc8563.c
r14064r14065
403403   int h = CRTC6845_CHAR_LINES;
404404   int height = CRTC6845_CHAR_HEIGHT;
405405
406   rect.min_x = vdc8563->screen->visible_area().min_x;
407   rect.max_x = vdc8563->screen->visible_area().max_x;
406   rect.setx(vdc8563->screen->visible_area().min_x, vdc8563->screen->visible_area().max_x);
408407
409408   if (full_refresh)
410409      memset(vdc8563->dirty + vdc8563->videoram_start, 1, vdc8563->videoram_size);
r14064r14065
446445   int h = CRTC6845_CHAR_LINES;
447446   int height = CRTC6845_CHAR_HEIGHT;
448447
449   rect.min_x = vdc8563->screen->visible_area().min_x;
450   rect.max_x = vdc8563->screen->visible_area().max_x;
448   rect.setx(vdc8563->screen->visible_area().min_x, vdc8563->screen->visible_area().max_x);
451449
452450   if (full_refresh)
453451      memset(vdc8563->dirty + vdc8563->videoram_start, 1, vdc8563->videoram_size);
r14064r14065
510508   int h = CRTC6845_CHAR_LINES;
511509   int height = CRTC6845_CHAR_HEIGHT;
512510
513   rect.min_x = vdc8563->screen->visible_area().min_x;
514   rect.max_x = vdc8563->screen->visible_area().max_x;
511   rect.setx(vdc8563->screen->visible_area().min_x, vdc8563->screen->visible_area().max_x);
515512
516513   if (full_refresh)
517514      memset(vdc8563->dirty, 1, vdc8563->mask + 1);
src/mess/video/odyssey2.c
r14064r14065
277277      state->m_control_status &= ~ 0x01;
278278
279279      /* Draw a line */
280      rect.min_y = rect.max_y = vpos;
281      rect.min_x = I824X_START_ACTIVE_SCAN;
282      rect.max_x = I824X_END_ACTIVE_SCAN - 1;
280      rect.set(I824X_START_ACTIVE_SCAN, I824X_END_ACTIVE_SCAN - 1, vpos, vpos);
283281      state->m_tmp_bitmap.fill(( (state->m_o2_vdc.s.color >> 3) & 0x7 ) | ( ( state->m_lum << 3 ) ^ 0x08 ), rect );
284282
285283      /* Clear collision map */
src/mess/video/hd66421.c
r14064r14065
248248   }
249249   else
250250   {
251      rectangle rect;
252      rect.min_x = 0;
253      rect.max_x = HD66421_WIDTH - 1;
254      rect.min_y = 0;
255      rect.max_y = HD66421_HEIGHT - 1;
251      rectangle rect(0, HD66421_WIDTH - 1, 0, HD66421_HEIGHT - 1);
256252      bitmap.fill(get_white_pen(machine()), rect);
257253   }
258254}
src/mess/video/fm7.c
r14064r14065
11501150WRITE8_HANDLER( fm77av_sub_modestatus_w )
11511151{
11521152   fm7_state *state = space->machine().driver_data<fm7_state>();
1153   rectangle rect;
11541153   state->m_video.modestatus = data & 0x40;
11551154   if(data & 0x40)
11561155   {
1157      rect.min_x = rect.min_y = 0;
1158      rect.max_x = 320-1;
1159      rect.max_y = 200-1;
1156      rectangle rect(0, 320-1, 0, 200-1);
11601157      space->machine().primary_screen->configure(320,200,rect,HZ_TO_ATTOSECONDS(60));
11611158   }
11621159   else
11631160   {
1164      rect.min_x = rect.min_y = 0;
1165      rect.max_x = 640-1;
1166      rect.max_y = 200-1;
1161      rectangle rect(0, 640-1, 0, 200-1);
11671162      space->machine().primary_screen->configure(640,200,rect,HZ_TO_ATTOSECONDS(60));
11681163   }
11691164}
src/mess/drivers/multi16.c
r14064r14065
7171         {
7272            int dot = (BITSWAP16(state->m_p_vram[count],7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8) >> (15-xi)) & 0x1;
7373
74            if(y < screen.machine().primary_screen->visible_area().max_y && x*16+xi < screen.machine().primary_screen->visible_area().max_x) /* TODO: safety check */
74            if(screen.visible_area().contains(x*16+xi, y))
7575               bitmap.pix16(y, x*16+xi) = screen.machine().pens[dot];
7676         }
7777
src/mess/drivers/pc88va.c
r14064r14065
348348               res_x = x*8+xi;
349349               res_y = y*16+yi;
350350
351               if((res_x)>machine.primary_screen->visible_area().max_x || (res_y)>machine.primary_screen->visible_area().max_y)
351               if(!cliprect.contains(res_x, res_y))
352352                  continue;
353353
354354               pen = kanji[((yi*2)+lr_half_gfx)+tile_num] >> (7-xi) & 1;
r14064r14065
662662   x_vis_area = state->m_buf_ram[4] * 4;
663663   y_vis_area = (state->m_buf_ram[0xa])|((state->m_buf_ram[0xb] & 0x40)<<2);
664664
665   visarea.min_x = 0;
666   visarea.min_y = 0;
667   visarea.max_x = x_vis_area - 1;
668   visarea.max_y = y_vis_area - 1;
665   visarea.set(0, x_vis_area - 1, 0, y_vis_area - 1);
669666
670667   //if(y_vis_area == 400)
671668   //  refresh = HZ_TO_ATTOSECONDS(24800) * x_vis_area * y_vis_area; //24.8 KHz
src/mess/drivers/pc6001.c
r14064r14065
464464               color |= ((pen[1] & 1) << 1);
465465               color |= ((pen[1] & 2) << 2);
466466
467               if (((x+i)*2+0) <= screen.visible_area().max_x && (y) <= screen.visible_area().max_y)
467               if (cliprect.contains((x+i)*2+0, y))
468468                  bitmap.pix16(y, (x+i)*2+0) = screen.machine().pens[color];
469               if (((x+i)*2+1) <= screen.visible_area().max_x && (y) <= screen.visible_area().max_y)
469               if (cliprect.contains((x+i)*2+1, y))
470470                  bitmap.pix16(y, (x+i)*2+1) = screen.machine().pens[color];
471471            }
472472
r14064r14065
512512                  color |= ((state->m_bgcol_bank & 2) << 2);
513513               }
514514
515               if ((x+i) <= screen.visible_area().max_x && (y) <= screen.visible_area().max_y)
515               if (cliprect.contains(x+i, y))
516516                  bitmap.pix16(y, (x+i)) = screen.machine().pens[color];
517517            }
518518
r14064r14065
552552
553553                  color = pen ? fgcol : bgcol;
554554
555                  if ((x*8+xi) <= screen.visible_area().max_x && (y*12+yi) <= screen.visible_area().max_y)
555                  if (cliprect.contains(x*8+xi, y*12+yi))
556556                     bitmap.pix16(((y*12+yi)), (x*8+xi)) = screen.machine().pens[color];
557557               }
558558            }
r14064r14065
597597
598598                  color = pen ? fgcol : bgcol;
599599
600                  if ((x*8+xi) <= screen.visible_area().max_x && (y*12+yi) <= screen.visible_area().max_y)
600                  if (cliprect.contains(x*8+xi, y*12+yi))
601601                     bitmap.pix16(((y*12+yi)), (x*8+xi)) = screen.machine().pens[color];
602602               }
603603            }
r14064r14065
616616         {
617617            color = state->m_video_ram[count] & 0x0f;
618618
619            if ((x+0) <= screen.visible_area().max_x && (y+0) <= screen.visible_area().max_y)
619            if (cliprect.contains(x+0, y+0))
620620               bitmap.pix16((y+0), (x+0)) = screen.machine().pens[color+0x10];
621621
622622            color = (state->m_video_ram[count] & 0xf0) >> 4;
623623
624            if ((x+1) <= screen.visible_area().max_x && (y+0) <= screen.visible_area().max_y)
624            if (cliprect.contains(x+1, y+0))
625625               bitmap.pix16((y+0), (x+1)) = screen.machine().pens[color+0x10];
626626
627627            color = state->m_video_ram[count+1] & 0x0f;
628628
629            if ((x+2) <= screen.visible_area().max_x && (y+0) <= screen.visible_area().max_y)
629            if (cliprect.contains(x+2, y+0))
630630               bitmap.pix16((y+0), (x+2)) = screen.machine().pens[color+0x10];
631631
632632            color = (state->m_video_ram[count+1] & 0xf0) >> 4;
633633
634            if ((x+3) <= screen.visible_area().max_x && (y+0) <= screen.visible_area().max_y)
634            if (cliprect.contains(x+3, y+0))
635635               bitmap.pix16((y+0), (x+3)) = screen.machine().pens[color+0x10];
636636
637637            color = state->m_video_ram[count+2] & 0x0f;
638638
639            if ((x+0) <= screen.visible_area().max_x && (y+1) <= screen.visible_area().max_y)
639            if (cliprect.contains(x+0, y+1))
640640               bitmap.pix16((y+1), (x+0)) = screen.machine().pens[color+0x10];
641641
642642            color = (state->m_video_ram[count+2] & 0xf0) >> 4;
643643
644            if ((x+1) <= screen.visible_area().max_x && (y+1) <= screen.visible_area().max_y)
644            if (cliprect.contains(x+1, y+1))
645645               bitmap.pix16((y+1), (x+1)) = screen.machine().pens[color+0x10];
646646
647647            color = state->m_video_ram[count+3] & 0x0f;
648648
649            if ((x+2) <= screen.visible_area().max_x && (y+1) <= screen.visible_area().max_y)
649            if (cliprect.contains(x+2, y+1))
650650               bitmap.pix16((y+1), (x+2)) = screen.machine().pens[color+0x10];
651651
652652            color = (state->m_video_ram[count+3] & 0xf0) >> 4;
653653
654            if ((x+3) <= screen.visible_area().max_x && (y+1) <= screen.visible_area().max_y)
654            if (cliprect.contains(x+3, y+1))
655655               bitmap.pix16((y+1), (x+3)) = screen.machine().pens[color+0x10];
656656
657657
r14064r14065
12141214
12151215         y_height = (state->m_exgfx_bitmap_mode || state->m_exgfx_2bpp_mode) ? 200 : 240;
12161216
1217         visarea.min_x = visarea.min_y = 0;
1218         visarea.max_y = (y_height) - 1;
1219         visarea.max_x = (320) - 1;
1217         visarea.set(0, (320) - 1, 0, (y_height) - 1);
12201218
12211219         space->machine().primary_screen->configure(320, 240, visarea, space->machine().primary_screen->frame_period().attoseconds);
12221220      }
src/mess/drivers/x1.c
r14064r14065
254254
255255static void x1_draw_pixel(running_machine &machine, bitmap_rgb32 &bitmap,int y,int x,UINT16   pen,UINT8 width,UINT8 height)
256256{
257   if((x)>machine.primary_screen->visible_area().max_x || (y)>machine.primary_screen->visible_area().max_y)
257   if(!machine.primary_screen->visible_area().contains(x, y))
258258      return;
259259
260260   if(width && height)
src/mess/drivers/smc777.c
r14064r14065
544544
545545         x_width = (data & 0x80) ? 320 : 640;
546546
547         visarea.min_x = visarea.min_y = 0;
548         visarea.max_y = (200+(CRTC_MIN_Y*2)) - 1;
549         visarea.max_x = (x_width+(CRTC_MIN_X*2)) - 1;
547         visarea.set(0, (x_width+(CRTC_MIN_X*2)) - 1, 0, (200+(CRTC_MIN_Y*2)) - 1);
550548
551549         space->machine().primary_screen->configure(660, 220, visarea, space->machine().primary_screen->frame_period().attoseconds);
552550      }
src/mess/drivers/m20.c
r14064r14065
7878         {
7979            pen = (state->m_p_videoram[count]) >> (15 - i) & 1;
8080
81            if ((x + i) <= screen.visible_area().max_x && (y + 0) < screen.visible_area().max_y)
81            if (screen.visible_area().contains(x + i, y))
8282               bitmap.pix32(y, x + i) = screen.machine().pens[pen];
8383         }
8484
src/mess/drivers/mz2500.c
r14064r14065
609609   else
610610      state->m_scr_y_size = 200 * ((state->m_text_font_reg) ? 1 : 2);
611611
612   visarea.min_x = 0;
613   visarea.min_y = 0;
614   visarea.max_x = state->m_scr_x_size - 1;
615   visarea.max_y = state->m_scr_y_size - 1;
612   visarea.set(0, state->m_scr_x_size - 1, 0, state->m_scr_y_size - 1);
616613
617614   //popmessage("%d %d %d %d %02x",vs,ve,hs,he,state->m_cg_reg[0x0e]);
618615
src/mess/drivers/multi8.c
r14064r14065
9898
9999static void multi8_draw_pixel(running_machine &machine, bitmap_ind16 &bitmap,int y,int x,UINT8 pen,UINT8 width)
100100{
101   if((x)>machine.primary_screen->visible_area().max_x || (y)>machine.primary_screen->visible_area().max_y)
101   if(!machine.primary_screen->visible_area().contains(x, y))
102102      return;
103103
104104   if(width)
src/mess/drivers/next.c
r14064r14065
3838
3939            pen ^= 3;
4040
41            if((x+xi)>screen.machine().primary_screen->visible_area().max_x || (y)>screen.machine().primary_screen->visible_area().max_y)
42               continue;
43
44            bitmap.pix16(y, x+xi) = screen.machine().pens[pen];
41            if(cliprect.contains(x+xi, y))
42               bitmap.pix16(y, x+xi) = screen.machine().pens[pen];
4543         }
4644
4745         count++;
src/mess/drivers/pc8801.c
r14064r14065
452452                  color = char_data ? pal : -1;
453453            }
454454
455            if((res_x)>machine.primary_screen->visible_area().max_x && (res_y)>machine.primary_screen->visible_area().max_y)
455            if(!machine.primary_screen->visible_area().contains(res_x, res_y))
456456               continue;
457457
458458            if(color != -1)
r14064r14065
460460
461461            if(width)
462462            {
463               if((res_x+1)>machine.primary_screen->visible_area().max_x && (res_y)>machine.primary_screen->visible_area().max_y)
463               if(!machine.primary_screen->visible_area().contains(res_x+1, res_y))
464464                  continue;
465465
466466               if(color != -1)
r14064r14065
468468            }
469469            if(height)
470470            {
471               if((res_x)>machine.primary_screen->visible_area().max_x && (res_y+1)>machine.primary_screen->visible_area().max_y)
471               if(!machine.primary_screen->visible_area().contains(res_x, res_y+1))
472472                  continue;
473473
474474               if(color != -1)
475475                  bitmap.pix16(res_y+1, res_x) = machine.pens[color];
476476
477               if((res_x+1)>machine.primary_screen->visible_area().max_x && (res_y+1)>machine.primary_screen->visible_area().max_y)
477               if(!machine.primary_screen->visible_area().contains(res_x+1, res_y+1))
478478                  continue;
479479
480480               if(color != -1)
r14064r14065
976976   pc8801_state *state = machine.driver_data<pc8801_state>();
977977   rectangle visarea;
978978
979   visarea.min_x = 0;
980   visarea.min_y = 0;
981   visarea.max_x = 640 - 1;
982   visarea.max_y = ((monitor_24KHz) ? 400 : 200) - 1;
979   visarea.set(0, 640 - 1, 0, ((monitor_24KHz) ? 400 : 200) - 1);
983980
984981   machine.primary_screen->configure(640, 480, visarea, machine.primary_screen->frame_period().attoseconds);
985982}
src/mess/drivers/gp32.c
r14064r14065
343343   verboselog( machine, 3, "LCD - vclk %f\n", vclk);
344344   framerate = vclk / (((vspw + 1) + (vbpd + 1) + (lineval + 1) + (vfpd + 1)) * ((hspw + 1) + (hbpd + 1) + (hfpd + 1) + (hozval + 1)));
345345   verboselog( machine, 3, "LCD - framerate %f\n", framerate);
346   visarea.min_x = 0;
347   visarea.min_y = 0;
348   visarea.max_x = hozval;
349   visarea.max_y = lineval;
346   visarea.set(0, hozval, 0, lineval);
350347   verboselog( machine, 3, "LCD - visarea min_x %d min_y %d max_x %d max_y %d\n", visarea.min_x, visarea.min_y, visarea.max_x, visarea.max_y);
351348   screen->configure(hozval + 1, lineval + 1, visarea, HZ_TO_ATTOSECONDS( framerate));
352349}
src/mess/drivers/supracan.c
r14064r14065
930930                     // NOT accurate, causes issues when the attract mode loops and the logo is shown the 2nd time in some games - investigate
931931                     for (int y=cliprect.min_y;y<=cliprect.max_y;y++)
932932                     {
933                        rectangle clip;
934                        clip.min_x = cliprect.min_x;
935                        clip.max_x = cliprect.max_x;
933                        rectangle clip(cliprect.min_x, cliprect.max_x, y, y);
936934
937                        clip.min_y = clip.max_y = y;
938
939935                        scrollx = (state->m_roz_scrollx);
940936                        scrolly = (state->m_roz_scrolly);
941937                        incxx = (state->m_roz_coeffa);
r14064r14065
16391635
16401636            rectangle visarea = machine().primary_screen->visible_area();
16411637
1642            visarea.min_x = 0;
1643            visarea.min_y = 8;
1644            visarea.max_y = 232 - 1;
1645            visarea.max_x = ((m_video_flags & 0x100) ? 320 : 256) - 1;
1638            visarea.set(0, ((m_video_flags & 0x100) ? 320 : 256) - 1, 8, 232 - 1);
16461639            machine().primary_screen->configure(348, 256, visarea, machine().primary_screen->frame_period().attoseconds);
16471640         }
16481641         break;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team