dirty rect
This commit is contained in:
parent
285e8c9182
commit
6df6355ba7
2 changed files with 32 additions and 24 deletions
|
|
@ -111,15 +111,10 @@ void Window::AddDirtyRect(ScaleData scale) {
|
|||
return;
|
||||
}
|
||||
|
||||
for (ClipRect& existingRect : dirtyRects) {
|
||||
if (rect.left <= existingRect.right && rect.right >= existingRect.left && rect.top <= existingRect.bottom && rect.bottom >= existingRect.top) {
|
||||
existingRect.left = std::min(existingRect.left, rect.left);
|
||||
existingRect.right = std::max(existingRect.right, rect.right);
|
||||
existingRect.top = std::min(existingRect.top, rect.top);
|
||||
existingRect.bottom = std::max(existingRect.bottom, rect.bottom);
|
||||
return;
|
||||
}
|
||||
}
|
||||
//merging logic should work so that no pixel is drawn twice, and that no pixel not marked dirty is drawn.
|
||||
//so lets say there is already an existing horizontal bar and the new rect is a vertical bar making a cross shape, the center of the cross will currently be drawn twice
|
||||
//so we need to turn it into 3 rects, the top part of the vertical bar, the horizontal bar, and the bottom part of the vertical bar
|
||||
//in this way no pixel is drawn twice and no area not marked dirty is included
|
||||
|
||||
dirtyRects.push_back(rect);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue