Reduce the flipped area on the screen when the editor/brush preview is updated

This patch should increase the macOS performance significantly. The
updating process of the screen on macOS is the slowest one, being the
argb32_image_mark_rgb32() function the slowest function in the call
tree.)
This commit is contained in:
David Capello 2017-11-03 09:47:49 -03:00
parent 1531d1fadb
commit 559c040f63

View File

@ -831,8 +831,11 @@ void Editor::drawSpriteClipped(const gfx::Region& updateRegion)
GraphicsPtr editorGraphics = getGraphics(clientBounds());
for (const Rect& updateRect : updateRegion) {
Rect spriteRectOnScreen = editorToScreen(updateRect);
for (const Rect& screenRect : screenRegion) {
IntersectClip clip(&screenGraphics, screenRect);
IntersectClip clip(&screenGraphics,
screenRect & spriteRectOnScreen);
if (clip)
drawSpriteUnclippedRect(editorGraphics.get(), updateRect);
}