Show modified regions correctly in ToolLoop on visible areas in non-active editors

Regression introduced in 6a88713213403179fb04938a99085e60bad7e873
This commit is contained in:
David Capello 2019-02-21 08:20:00 -03:00
parent 7af4365588
commit 6a1a21726e

View File

@ -40,6 +40,7 @@
#include "app/ui/main_window.h"
#include "app/ui/optional_alert.h"
#include "app/ui/status_bar.h"
#include "app/ui_context.h"
#include "app/util/expand_cel_canvas.h"
#include "doc/brush.h"
#include "doc/cel.h"
@ -261,7 +262,19 @@ public:
doc::Remap* getShadingRemap() override { return m_shadingRemap.get(); }
void limitDirtyAreaToViewport(gfx::Region& rgn) override {
rgn &= gfx::Region(m_editor->getVisibleSpriteBounds().inflate(1, 1));
// Visible region (on the screen) of the all editors showing the
// given document.
gfx::Region allVisibleRgn;
// TODO use the context given to the ToolLoopImpl ctor
for (auto e : UIContext::instance()->getAllEditorsIncludingPreview(m_document)) {
gfx::Region viewportRegion;
e->getDrawableRegion(viewportRegion, Widget::kCutTopWindows);
for (auto rc : viewportRegion)
allVisibleRgn |= gfx::Region(e->screenToEditor(rc).inflate(1, 1));
}
rgn &= allVisibleRgn;
}
void updateDirtyArea(const gfx::Region& dirtyArea) override {