[aseprite] 42/128: Use the real current tool preferences to draw and in the brush preview

Tobias Hansen thansen at moszumanska.debian.org
Mon May 9 21:24:21 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 c5f7e9618be3272ed6854d5920b1cb43126cab6d
Author: David Capello <davidcapello at gmail.com>
Date:   Thu Apr 21 01:20:59 2016 -0300

    Use the real current tool preferences to draw and in the brush preview
    
    The "real" current tool is the one in the editor returned by
    getCurrentEditorTool() (which depends on quicktool modifiers
    and right-click configuration).
---
 src/app/ui/context_bar.cpp           |  3 ++-
 src/app/ui/editor/brush_preview.cpp  | 12 +++++++-----
 src/app/ui/editor/brush_preview.h    |  4 ++--
 src/app/ui/editor/tool_loop_impl.cpp |  2 +-
 4 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/app/ui/context_bar.cpp b/src/app/ui/context_bar.cpp
index 4b0672b..5b1f49b 100644
--- a/src/app/ui/context_bar.cpp
+++ b/src/app/ui/context_bar.cpp
@@ -1724,7 +1724,8 @@ void ContextBar::setActiveBrush(const doc::BrushRef& brush)
 
 doc::BrushRef ContextBar::activeBrush(tools::Tool* tool) const
 {
-  if (!tool ||
+  if ((!tool) ||
+      (tool == App::instance()->activeTool()) ||
       (tool->getInk(0)->isPaint() &&
        m_activeBrush->type() == kImageBrushType)) {
     m_activeBrush->setPattern(Preferences::instance().brush.pattern());
diff --git a/src/app/ui/editor/brush_preview.cpp b/src/app/ui/editor/brush_preview.cpp
index 10d6eb3..c4a1546 100644
--- a/src/app/ui/editor/brush_preview.cpp
+++ b/src/app/ui/editor/brush_preview.cpp
@@ -53,10 +53,12 @@ BrushPreview::~BrushPreview()
 {
 }
 
-// static
-Brush* BrushPreview::getCurrentBrush()
+BrushRef BrushPreview::getCurrentBrush()
 {
-  return App::instance()->getMainWindow()->getContextBar()->activeBrush().get();
+  return App::instance()
+    ->getMainWindow()
+    ->getContextBar()
+    ->activeBrush(m_editor->getCurrentEditorTool());
 }
 
 // static
@@ -114,7 +116,7 @@ void BrushPreview::show(const gfx::Point& screenPos)
 
   // Setup the cursor type depending on several factors (current tool,
   // foreground color, layer transparency, brush size, etc.).
-  Brush* brush = getCurrentBrush();
+  BrushRef brush = getCurrentBrush();
   color_t brush_color = getBrushColor(sprite, layer);
   color_t mask_index = sprite->transparentColor();
 
@@ -297,7 +299,7 @@ void BrushPreview::invalidateRegion(const gfx::Region& region)
 
 void BrushPreview::generateBoundaries()
 {
-  Brush* brush = getCurrentBrush();
+  BrushRef brush = getCurrentBrush();
 
   if (m_brushBoundaries &&
       m_brushGen == brush->gen())
diff --git a/src/app/ui/editor/brush_preview.h b/src/app/ui/editor/brush_preview.h
index 701be81..60a2053 100644
--- a/src/app/ui/editor/brush_preview.h
+++ b/src/app/ui/editor/brush_preview.h
@@ -11,6 +11,7 @@
 
 #include "app/extra_cel.h"
 #include "base/shared_ptr.h"
+#include "doc/brush.h"
 #include "doc/color.h"
 #include "doc/frame.h"
 #include "doc/mask_boundaries.h"
@@ -22,7 +23,6 @@
 #include <vector>
 
 namespace doc {
-  class Brush;
   class Layer;
   class Sprite;
 }
@@ -58,7 +58,7 @@ namespace app {
   private:
     typedef void (BrushPreview::*PixelDelegate)(ui::Graphics*, const gfx::Point&, gfx::Color);
 
-    static doc::Brush* getCurrentBrush();
+    doc::BrushRef getCurrentBrush();
     static doc::color_t getBrushColor(doc::Sprite* sprite, doc::Layer* layer);
 
     void generateBoundaries();
diff --git a/src/app/ui/editor/tool_loop_impl.cpp b/src/app/ui/editor/tool_loop_impl.cpp
index 59be097..0f8d547 100644
--- a/src/app/ui/editor/tool_loop_impl.cpp
+++ b/src/app/ui/editor/tool_loop_impl.cpp
@@ -97,7 +97,7 @@ public:
                const app::Color& bgColor)
     : m_editor(editor)
     , m_tool(tool)
-    , m_brush(App::instance()->getMainWindow()->getContextBar()->activeBrush())
+    , m_brush(App::instance()->getMainWindow()->getContextBar()->activeBrush(m_tool))
     , m_document(document)
     , m_sprite(editor->sprite())
     , m_layer(editor->layer())

-- 
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