This is an automated email from the git hooks/post-receive script. thansen pushed a commit to branch master in repository aseprite.
commit 3ba3b48fd707224e88a76e0535abb71d8b8a7b1e Author: David Capello <[email protected]> Date: Thu Nov 13 11:23:45 2014 -0300 Fix crash using eyedropper above a (hidden) selection handle We need to be in a Selection ink to start moving pixels from transform handles. --- src/app/ui/editor/standby_state.cpp | 103 +++++++++++++++++++----------------- src/app/ui/editor/standby_state.h | 1 + 2 files changed, 56 insertions(+), 48 deletions(-) diff --git a/src/app/ui/editor/standby_state.cpp b/src/app/ui/editor/standby_state.cpp index 60fdedd..ce16984 100644 --- a/src/app/ui/editor/standby_state.cpp +++ b/src/app/ui/editor/standby_state.cpp @@ -195,50 +195,49 @@ bool StandbyState::onMouseDown(Editor* editor, MouseMessage* msg) return true; } - // Transform selected pixels - if (document->isMaskVisible() && - m_decorator->getTransformHandles(editor)) { - TransformHandles* transfHandles = m_decorator->getTransformHandles(editor); - - // Get the handle covered by the mouse. - HandleType handle = transfHandles->getHandleAtPoint(editor, - msg->position(), - document->getTransformation()); - - if (handle != NoHandle) { - int x, y, opacity; - Image* image = location.image(&x, &y, &opacity); - if (image) { - if (!layer->isWritable()) { - Alert::show(PACKAGE "<<The layer is locked.||&Close"); - return true; - } + // Call the eyedropper command + if (clickedInk->isEyedropper()) { + callEyedropper(editor); + return true; + } - // Change to MovingPixelsState - transformSelection(editor, msg, handle); + if (clickedInk->isSelection()) { + // Transform selected pixels + if (document->isMaskVisible() && m_decorator->getTransformHandles(editor)) { + TransformHandles* transfHandles = m_decorator->getTransformHandles(editor); + + // Get the handle covered by the mouse. + HandleType handle = transfHandles->getHandleAtPoint(editor, + msg->position(), + document->getTransformation()); + + if (handle != NoHandle) { + int x, y, opacity; + Image* image = location.image(&x, &y, &opacity); + if (image) { + if (!layer->isWritable()) { + Alert::show(PACKAGE "<<The layer is locked.||&Close"); + return true; + } + + // Change to MovingPixelsState + transformSelection(editor, msg, handle); + } + return true; } - return true; } - } - // Move selected pixels - if (editor->isInsideSelection() && - currentTool->getInk(0)->isSelection() && - msg->left()) { - if (!layer->isWritable()) { - Alert::show(PACKAGE "<<The layer is locked.||&Close"); + // Move selected pixels + if (editor->isInsideSelection() && msg->left()) { + if (!layer->isWritable()) { + Alert::show(PACKAGE "<<The layer is locked.||&Close"); + return true; + } + + // Change to MovingPixelsState + transformSelection(editor, msg, MoveHandle); return true; } - - // Change to MovingPixelsState - transformSelection(editor, msg, MoveHandle); - return true; - } - - // Call the eyedropper command - if (clickedInk->isEyedropper()) { - onMouseMove(editor, msg); - return true; } // Start the Tool-Loop @@ -263,16 +262,8 @@ bool StandbyState::onMouseMove(Editor* editor, MouseMessage* msg) // We control eyedropper tool from here. TODO move this to another place if (msg->left() || msg->right()) { tools::Ink* clickedInk = editor->getCurrentEditorInk(); - if (clickedInk->isEyedropper()) { - Command* eyedropper_cmd = - CommandsModule::instance()->getCommandByName(CommandId::Eyedropper); - bool fg = (static_cast<tools::PickInk*>(clickedInk)->target() == tools::PickInk::Fg); - - Params params; - params.set("target", fg ? "foreground": "background"); - - UIContext::instance()->executeCommand(eyedropper_cmd, ¶ms); - } + if (clickedInk->isEyedropper()) + callEyedropper(editor); } editor->moveDrawingCursor(); @@ -561,6 +552,22 @@ void StandbyState::transformSelection(Editor* editor, MouseMessage* msg, HandleT } } +void StandbyState::callEyedropper(Editor* editor) +{ + tools::Ink* clickedInk = editor->getCurrentEditorInk(); + if (!clickedInk->isEyedropper()) + return; + + Command* eyedropper_cmd = + CommandsModule::instance()->getCommandByName(CommandId::Eyedropper); + bool fg = (static_cast<tools::PickInk*>(clickedInk)->target() == tools::PickInk::Fg); + + Params params; + params.set("target", fg ? "foreground": "background"); + + UIContext::instance()->executeCommand(eyedropper_cmd, ¶ms); +} + ////////////////////////////////////////////////////////////////////// // Decorator diff --git a/src/app/ui/editor/standby_state.h b/src/app/ui/editor/standby_state.h index 1ad96e4..23bfaee 100644 --- a/src/app/ui/editor/standby_state.h +++ b/src/app/ui/editor/standby_state.h @@ -76,6 +76,7 @@ namespace app { private: void transformSelection(Editor* editor, ui::MouseMessage* msg, HandleType handle); + void callEyedropper(Editor* editor); Decorator* m_decorator; }; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git _______________________________________________ Pkg-games-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits

