void UpdateDirtyScreen(VirtScreen vs)
{
// Do nothing for unused virtual screens
if (vs.Height == 0)
return;
int i;
int w = 8;
int start = 0;
for (i = 0; i < Gdi.NumStrips; i++)
{
if (vs.BDirty[i] != 0)
{
int top = vs.TDirty[i];
int bottom = vs.BDirty[i];
vs.TDirty[i] = vs.Height;
vs.BDirty[i] = 0;
if (i != (Gdi.NumStrips - 1) && vs.BDirty[i + 1] == bottom && vs.TDirty[i + 1] == top)
{
// Simple optimizations: if two or more neighboring strips
// form one bigger rectangle, coalesce them.
w += 8;
continue;
}
DrawStripToScreen(vs, start * 8, w, top, bottom);
w = 8;
}
start = i + 1;
}
}