screen.c: remove redundant checks from update_partial() (nw)

This commit is contained in:
Alex W. Jackson 2014-05-20 08:24:36 +00:00
parent b7680d9e46
commit 9c6c6278e6

View File

@ -566,42 +566,31 @@ bool screen_device::update_partial(int scanline)
} }
// skip if we already rendered this line // skip if we already rendered this line
if (scanline == m_last_partial_scan - 1) if (scanline < m_last_partial_scan)
{ {
LOG_PARTIAL_UPDATES(("skipped because line was already rendered\n")); LOG_PARTIAL_UPDATES(("skipped because line was already rendered\n"));
return false; return false;
} }
// skip if outside of visible area // set the range of scanlines to render
if (scanline < visible_area().min_y || scanline > visible_area().max_y)
{
LOG_PARTIAL_UPDATES(("skipped because outside of visible area\n"));
return false;
}
// skip if less than the lowest so far
if (scanline < m_last_partial_scan)
{
LOG_PARTIAL_UPDATES(("skipped because less than previous\n"));
return false;
}
// set the start/end scanlines
rectangle clip = m_visarea; rectangle clip = m_visarea;
if (m_last_partial_scan > clip.min_y) if (m_last_partial_scan > clip.min_y)
clip.min_y = m_last_partial_scan; clip.min_y = m_last_partial_scan;
if (scanline < clip.max_y) if (scanline < clip.max_y)
clip.max_y = scanline; clip.max_y = scanline;
// render if necessary // skip if entirely outside of visible area
bool result = false; if (clip.min_y > clip.max_y)
if (clip.min_y <= clip.max_y)
{ {
UINT32 flags = UPDATE_HAS_NOT_CHANGED; LOG_PARTIAL_UPDATES(("skipped because outside of visible area\n"));
return false;
}
g_profiler.start(PROFILER_VIDEO); // otherwise, render
LOG_PARTIAL_UPDATES(("updating %d-%d\n", clip.min_y, clip.max_y)); LOG_PARTIAL_UPDATES(("updating %d-%d\n", clip.min_y, clip.max_y));
g_profiler.start(PROFILER_VIDEO);
UINT32 flags = UPDATE_HAS_NOT_CHANGED;
screen_bitmap &curbitmap = m_bitmap[m_curbitmap]; screen_bitmap &curbitmap = m_bitmap[m_curbitmap];
switch (curbitmap.format()) switch (curbitmap.format())
{ {
@ -615,12 +604,10 @@ bool screen_device::update_partial(int scanline)
// if we modified the bitmap, we have to commit // if we modified the bitmap, we have to commit
m_changed |= ~flags & UPDATE_HAS_NOT_CHANGED; m_changed |= ~flags & UPDATE_HAS_NOT_CHANGED;
result = true;
}
// remember where we left off // remember where we left off
m_last_partial_scan = scanline + 1; m_last_partial_scan = scanline + 1;
return result; return true;
} }