mirror of
https://github.com/aseprite/aseprite.git
synced 2024-12-27 21:19:18 +00:00
Add EditorDecorator::getInvalidDecoratoredRegion() needed in #873
This commit is contained in:
parent
df6e97d98d
commit
562106c6f0
@ -362,10 +362,20 @@ void Editor::setEditorScroll(const gfx::Point& scroll, bool blitValidRegion)
|
||||
View* view = View::getView(this);
|
||||
Point oldScroll;
|
||||
Region region;
|
||||
Region invalidRegion;
|
||||
|
||||
if (blitValidRegion) {
|
||||
getDrawableRegion(region, kCutTopWindows);
|
||||
oldScroll = view->viewScroll();
|
||||
|
||||
// Remove decorated region that cannot be just moved because it
|
||||
// must be redrawn in another position when the Editor's scroll
|
||||
// changes (e.g. symmetry handles).
|
||||
if ((m_flags & kShowDecorators) && m_decorator) {
|
||||
m_decorator->getInvalidDecoratoredRegion(this, invalidRegion);
|
||||
if (!invalidRegion.isEmpty())
|
||||
region.createSubtraction(region, invalidRegion);
|
||||
}
|
||||
}
|
||||
|
||||
view->setViewScroll(scroll);
|
||||
|
@ -12,6 +12,10 @@
|
||||
#include "gfx/color.h"
|
||||
#include "gfx/rect.h"
|
||||
|
||||
namespace gfx {
|
||||
class Region;
|
||||
}
|
||||
|
||||
namespace doc {
|
||||
class Image;
|
||||
}
|
||||
@ -49,6 +53,7 @@ namespace app {
|
||||
virtual ~EditorDecorator() { }
|
||||
virtual void preRenderDecorator(EditorPreRender* render) = 0;
|
||||
virtual void postRenderDecorator(EditorPostRender* render) = 0;
|
||||
virtual void getInvalidDecoratoredRegion(Editor* editor, gfx::Region& region) = 0;
|
||||
};
|
||||
|
||||
} // namespace app
|
||||
|
@ -321,6 +321,11 @@ void SelectBoxState::postRenderDecorator(EditorPostRender* render)
|
||||
}
|
||||
}
|
||||
|
||||
void SelectBoxState::getInvalidDecoratoredRegion(Editor* editor, gfx::Region& region)
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
void SelectBoxState::updateContextBar()
|
||||
{
|
||||
ContextBar* contextBar = App::instance()->getMainWindow()->getContextBar();
|
||||
|
@ -86,6 +86,7 @@ namespace app {
|
||||
// EditorDecorator overrides
|
||||
virtual void preRenderDecorator(EditorPreRender* render) override;
|
||||
virtual void postRenderDecorator(EditorPostRender* render) override;
|
||||
virtual void getInvalidDecoratoredRegion(Editor* editor, gfx::Region& region) override;
|
||||
|
||||
private:
|
||||
typedef std::vector<Ruler> Rulers;
|
||||
|
@ -671,6 +671,15 @@ void StandbyState::Decorator::postRenderDecorator(EditorPostRender* render)
|
||||
}
|
||||
}
|
||||
|
||||
void StandbyState::Decorator::getInvalidDecoratoredRegion(Editor* editor, gfx::Region& region)
|
||||
{
|
||||
gfx::Rect box1, box2;
|
||||
if (getSymmetryHandles(editor, box1, box2)) {
|
||||
region.createUnion(region, gfx::Region(box1));
|
||||
region.createUnion(region, gfx::Region(box2));
|
||||
}
|
||||
}
|
||||
|
||||
bool StandbyState::Decorator::getSymmetryHandles(Editor* editor, gfx::Rect& box1, gfx::Rect& box2)
|
||||
{
|
||||
// Draw transformation handles (if the mask is visible and isn't frozen).
|
||||
|
@ -65,6 +65,7 @@ namespace app {
|
||||
// EditorDecorator overrides
|
||||
void preRenderDecorator(EditorPreRender* render) override;
|
||||
void postRenderDecorator(EditorPostRender* render) override;
|
||||
void getInvalidDecoratoredRegion(Editor* editor, gfx::Region& region) override;
|
||||
|
||||
private:
|
||||
TransformHandles* m_transfHandles;
|
||||
|
Loading…
Reference in New Issue
Block a user