Move dirty area from ToolLoop impl to ToolLoopManager

This commit is contained in:
David Capello 2019-02-20 11:17:09 -03:00
parent 3e7bfbb296
commit e960a79a87
4 changed files with 8 additions and 15 deletions

View File

@ -1,4 +1,5 @@
// Aseprite
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
@ -221,12 +222,8 @@ namespace app {
// Returns true if the loop was canceled by the user
virtual bool isCanceled() = 0;
// This region is modified by the ToolLoopManager so then you know
// what must be updated in updateDirtyArea().
virtual gfx::Region& getDirtyArea() = 0;
// Redraws the dirty area.
virtual void updateDirtyArea() = 0;
virtual void updateDirtyArea(const gfx::Region& dirtyArea) = 0;
virtual void updateStatusBar(const char* text) = 0;
virtual gfx::Point statusBarPositionOffset() = 0;

View File

@ -1,4 +1,5 @@
// Aseprite
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -35,7 +36,6 @@ using namespace filters;
ToolLoopManager::ToolLoopManager(ToolLoop* toolLoop)
: m_toolLoop(toolLoop)
, m_dirtyArea(toolLoop->getDirtyArea())
{
}
@ -206,7 +206,7 @@ void ToolLoopManager::doLoopStep(bool last_step)
}
if (!m_dirtyArea.isEmpty())
m_toolLoop->updateDirtyArea();
m_toolLoop->updateDirtyArea(m_dirtyArea);
}
// Applies the grid settings to the specified sprite point.

View File

@ -1,4 +1,5 @@
// Aseprite
// Copyright (C) 2019 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
@ -78,7 +79,7 @@ private:
Stroke m_stroke;
Pointer m_lastPointer;
gfx::Point m_oldPoint;
gfx::Region& m_dirtyArea;
gfx::Region m_dirtyArea;
gfx::Region m_nextDirtyArea;
};

View File

@ -95,7 +95,6 @@ protected:
doc::color_t m_bgColor;
doc::color_t m_primaryColor;
doc::color_t m_secondaryColor;
gfx::Region m_dirtyArea;
public:
ToolLoopBase(Editor* editor,
@ -261,11 +260,7 @@ public:
tools::Symmetry* getSymmetry() override { return m_symmetry.get(); }
doc::Remap* getShadingRemap() override { return m_shadingRemap.get(); }
gfx::Region& getDirtyArea() override {
return m_dirtyArea;
}
void updateDirtyArea() override {
void updateDirtyArea(const gfx::Region& dirtyArea) override {
// This is necessary here so the "on sprite crosshair" is hidden,
// we update screen pixels with the new sprite, and then we show
// the crosshair saving the updated pixels. It fixes problems with
@ -274,7 +269,7 @@ public:
HideBrushPreview hide(m_editor->brushPreview());
m_document->notifySpritePixelsModified(
m_sprite, m_dirtyArea, m_frame);
m_sprite, dirtyArea, m_frame);
}
void updateStatusBar(const char* text) override {