[aseprite] 60/128: Redraw editor only when selection handles must be redrawn
Tobias Hansen
thansen at moszumanska.debian.org
Mon May 9 21:24:23 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 fc0cebc0dd1e37c44e74dcdd796ca9b4e3bb5fe4
Author: David Capello <davidcapello at gmail.com>
Date: Mon Apr 25 15:26:46 2016 -0300
Redraw editor only when selection handles must be redrawn
---
src/app/ui/editor/standby_state.cpp | 14 ++++++++++----
src/app/ui/editor/standby_state.h | 1 +
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/app/ui/editor/standby_state.cpp b/src/app/ui/editor/standby_state.cpp
index cbaf5a8..3ae205a 100644
--- a/src/app/ui/editor/standby_state.cpp
+++ b/src/app/ui/editor/standby_state.cpp
@@ -90,6 +90,7 @@ static CursorType rotated_rotate_cursors[] = {
StandbyState::StandbyState()
: m_decorator(new Decorator(this))
+ , m_transformSelectionHandlesAreVisible(false)
{
}
@@ -116,9 +117,11 @@ void StandbyState::onActiveToolChange(Editor* editor, tools::Tool* tool)
{
// If the user change from a selection tool to a non-selection tool,
// or viceversa, we've to show or hide the transformation handles.
- // TODO Compare the ink (isSelection()) of the previous tool with
- // the new one.
- editor->invalidate();
+ bool needDecorators = (tool && tool->getInk(0)->isSelection());
+ if (m_transformSelectionHandlesAreVisible != needDecorators) {
+ m_transformSelectionHandlesAreVisible = false;
+ editor->invalidate();
+ }
}
bool StandbyState::checkForScroll(Editor* editor, MouseMessage* msg)
@@ -693,9 +696,12 @@ void StandbyState::Decorator::postRenderDecorator(EditorPostRender* render)
// And draw only when the user has a selection tool as active tool.
tools::Ink* ink = editor->getCurrentEditorInk();
- if (ink->isSelection())
+ if (ink->isSelection()) {
getTransformHandles(editor)->drawHandles(editor,
m_standbyState->getTransformation(editor));
+
+ m_standbyState->m_transformSelectionHandlesAreVisible = true;
+ }
}
// 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 d3da603..73eef69 100644
--- a/src/app/ui/editor/standby_state.h
+++ b/src/app/ui/editor/standby_state.h
@@ -79,6 +79,7 @@ namespace app {
Decorator* m_decorator;
base::ScopedConnection m_pivotVisConn;
base::ScopedConnection m_pivotPosConn;
+ bool m_transformSelectionHandlesAreVisible;
};
} // namespace app
--
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