diff options
author | 2022-04-03 22:31:54 +0200 | |
---|---|---|
committer | 2022-04-03 22:31:54 +0200 | |
commit | 07a357463b7ba57dc45226a7596a7113849c0a3d (patch) | |
tree | 143d7d6e1e6b77a5e401b7a19d506142860f9407 | |
parent | 67f95f7f75304d3422fa2f0971b39bd416b59f8b (diff) |
screen: draw until current hpos (not inclusive) when doing an update_now
-rw-r--r-- | src/emu/screen.cpp | 77 | ||||
-rw-r--r-- | src/emu/video.cpp | 2 |
2 files changed, 41 insertions, 38 deletions
diff --git a/src/emu/screen.cpp b/src/emu/screen.cpp index e721ba80b03..77ae6fbea02 100644 --- a/src/emu/screen.cpp +++ b/src/emu/screen.cpp @@ -555,7 +555,7 @@ screen_device::screen_device(const machine_config &mconfig, const char *tag, dev , m_curtexture(0) , m_changed(true) , m_last_partial_scan(0) - , m_partial_scan_hpos(-1) + , m_partial_scan_hpos(0) , m_color(rgb_t(0xff, 0xff, 0xff, 0xff)) , m_brightness(0xff) , m_frame_period(DEFAULT_FRAME_PERIOD.as_attoseconds()) @@ -1245,7 +1245,7 @@ bool screen_device::update_partial(int scanline) // remember where we left off m_last_partial_scan = scanline + 1; - m_partial_scan_hpos = -1; + m_partial_scan_hpos = 0; return true; } @@ -1299,10 +1299,10 @@ void screen_device::update_now() if (current_vpos > m_last_partial_scan) { // if the line before us was incomplete, we must do it in two pieces - if (m_partial_scan_hpos >= 0) + if (m_partial_scan_hpos > 0) { // now finish the previous partial scanline - clip.set((std::max)(clip.left(), m_partial_scan_hpos + 1), + clip.set((std::max)(clip.left(), m_partial_scan_hpos), clip.right(), (std::max)(clip.top(), m_last_partial_scan), (std::min)(clip.bottom(), m_last_partial_scan)); @@ -1341,7 +1341,7 @@ void screen_device::update_now() m_changed |= ~flags & UPDATE_HAS_NOT_CHANGED; } - m_partial_scan_hpos = -1; + m_partial_scan_hpos = 0; m_last_partial_scan++; } if (current_vpos > m_last_partial_scan) @@ -1351,47 +1351,50 @@ void screen_device::update_now() } // now draw this partial scanline - clip = m_visarea; - - clip.set((std::max)(clip.left(), m_partial_scan_hpos + 1), - (std::min)(clip.right(), current_hpos), - (std::max)(clip.top(), current_vpos), - (std::min)(clip.bottom(), current_vpos)); - - // and if there's something to draw, do it - if (!clip.empty()) + if (current_hpos > 0) { - g_profiler.start(PROFILER_VIDEO); + clip = m_visarea; - LOG_PARTIAL_UPDATES(("doing scanline partial draw: Y %d X %d-%d\n", clip.bottom(), clip.left(), clip.right())); + clip.set((std::max)(clip.left(), m_partial_scan_hpos), + (std::min)(clip.right(), current_hpos - 1), + (std::max)(clip.top(), current_vpos), + (std::min)(clip.bottom(), current_vpos)); - u32 flags = 0; - screen_bitmap &curbitmap = m_bitmap[m_curbitmap]; - if (m_video_attributes & VIDEO_VARIABLE_WIDTH) + // and if there's something to draw, do it + if (!clip.empty()) { - pre_update_scanline(current_vpos); - switch (curbitmap.format()) + g_profiler.start(PROFILER_VIDEO); + + LOG_PARTIAL_UPDATES(("doing scanline partial draw: Y %d X %d-%d\n", clip.bottom(), clip.left(), clip.right())); + + u32 flags = 0; + screen_bitmap &curbitmap = m_bitmap[m_curbitmap]; + if (m_video_attributes & VIDEO_VARIABLE_WIDTH) { - default: - case BITMAP_FORMAT_IND16: flags = m_screen_update_ind16(*this, *(bitmap_ind16 *)m_scan_bitmaps[m_curbitmap][current_vpos], clip); break; - case BITMAP_FORMAT_RGB32: flags = m_screen_update_rgb32(*this, *(bitmap_rgb32 *)m_scan_bitmaps[m_curbitmap][current_vpos], clip); break; + pre_update_scanline(current_vpos); + switch (curbitmap.format()) + { + default: + case BITMAP_FORMAT_IND16: flags = m_screen_update_ind16(*this, *(bitmap_ind16 *)m_scan_bitmaps[m_curbitmap][current_vpos], clip); break; + case BITMAP_FORMAT_RGB32: flags = m_screen_update_rgb32(*this, *(bitmap_rgb32 *)m_scan_bitmaps[m_curbitmap][current_vpos], clip); break; + } } - } - else - { - switch (curbitmap.format()) + else { - default: - case BITMAP_FORMAT_IND16: flags = m_screen_update_ind16(*this, curbitmap.as_ind16(), clip); break; - case BITMAP_FORMAT_RGB32: flags = m_screen_update_rgb32(*this, curbitmap.as_rgb32(), clip); break; + switch (curbitmap.format()) + { + default: + case BITMAP_FORMAT_IND16: flags = m_screen_update_ind16(*this, curbitmap.as_ind16(), clip); break; + case BITMAP_FORMAT_RGB32: flags = m_screen_update_rgb32(*this, curbitmap.as_rgb32(), clip); break; + } } - } - m_partial_updates_this_frame++; - g_profiler.stop(); + m_partial_updates_this_frame++; + g_profiler.stop(); - // if we modified the bitmap, we have to commit - m_changed |= ~flags & UPDATE_HAS_NOT_CHANGED; + // if we modified the bitmap, we have to commit + m_changed |= ~flags & UPDATE_HAS_NOT_CHANGED; + } } // remember where we left off @@ -1408,7 +1411,7 @@ void screen_device::update_now() void screen_device::reset_partial_updates() { m_last_partial_scan = 0; - m_partial_scan_hpos = -1; + m_partial_scan_hpos = 0; m_partial_updates_this_frame = 0; m_scanline0_timer->adjust(time_until_pos(0)); } diff --git a/src/emu/video.cpp b/src/emu/video.cpp index 6a6c75477aa..f50d33d224a 100644 --- a/src/emu/video.cpp +++ b/src/emu/video.cpp @@ -597,7 +597,7 @@ bool video_manager::finish_screen_updates() bool has_live_screen = false; for (screen_device &screen : iter) { - if (screen.partial_scan_hpos() >= 0) // previous update ended mid-scanline + if (screen.partial_scan_hpos() > 0) // previous update ended mid-scanline screen.update_now(); screen.update_partial(screen.visible_area().max_y); |