mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-06 12:39:57 +00:00
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).
This commit is contained in:
parent
4198003446
commit
c5f7e9618b
@ -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());
|
||||
|
@ -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())
|
||||
|
@ -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();
|
||||
|
@ -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())
|
||||
|
Loading…
x
Reference in New Issue
Block a user