[aseprite] 63/308: Add EditorDecorator::getInvalidDecoratoredRegion() needed in #873
Tobias Hansen
thansen at moszumanska.debian.org
Tue Mar 8 02:44:52 UTC 2016
This is an automated email from the git hooks/post-receive script.
thansen pushed a commit to branch master
in repository aseprite.
commit 562106c6f0263468d6a427a7b2a614145c61cb2b
Author: David Capello <davidcapello at gmail.com>
Date: Mon Dec 7 15:25:10 2015 -0300
Add EditorDecorator::getInvalidDecoratoredRegion() needed in #873
---
src/app/ui/editor/editor.cpp | 10 ++++++++++
src/app/ui/editor/editor_decorator.h | 5 +++++
src/app/ui/editor/select_box_state.cpp | 5 +++++
src/app/ui/editor/select_box_state.h | 1 +
src/app/ui/editor/standby_state.cpp | 9 +++++++++
src/app/ui/editor/standby_state.h | 1 +
6 files changed, 31 insertions(+)
diff --git a/src/app/ui/editor/editor.cpp b/src/app/ui/editor/editor.cpp
index 1b10cb2..2bfffed 100644
--- a/src/app/ui/editor/editor.cpp
+++ b/src/app/ui/editor/editor.cpp
@@ -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);
diff --git a/src/app/ui/editor/editor_decorator.h b/src/app/ui/editor/editor_decorator.h
index a8b6b61..20b1785 100644
--- a/src/app/ui/editor/editor_decorator.h
+++ b/src/app/ui/editor/editor_decorator.h
@@ -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
diff --git a/src/app/ui/editor/select_box_state.cpp b/src/app/ui/editor/select_box_state.cpp
index 025f0fa..1f42c35 100644
--- a/src/app/ui/editor/select_box_state.cpp
+++ b/src/app/ui/editor/select_box_state.cpp
@@ -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();
diff --git a/src/app/ui/editor/select_box_state.h b/src/app/ui/editor/select_box_state.h
index 15bb0f4..4355c5a 100644
--- a/src/app/ui/editor/select_box_state.h
+++ b/src/app/ui/editor/select_box_state.h
@@ -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;
diff --git a/src/app/ui/editor/standby_state.cpp b/src/app/ui/editor/standby_state.cpp
index b7f3226..f3cf671 100644
--- a/src/app/ui/editor/standby_state.cpp
+++ b/src/app/ui/editor/standby_state.cpp
@@ -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).
diff --git a/src/app/ui/editor/standby_state.h b/src/app/ui/editor/standby_state.h
index f957342..edbfc90 100644
--- a/src/app/ui/editor/standby_state.h
+++ b/src/app/ui/editor/standby_state.h
@@ -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;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git
More information about the Pkg-games-commits
mailing list