From 9748894a2675204072190691453053b04454c086 Mon Sep 17 00:00:00 2001 From: David Capello Date: Fri, 1 Jul 2016 12:55:29 -0300 Subject: [PATCH] Don't use brush edges on tools with "one pixel" point shape (fix #1167) --- src/app/tools/point_shape.h | 3 ++- src/app/tools/point_shapes.h | 2 ++ src/app/ui/editor/brush_preview.cpp | 10 ++++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/app/tools/point_shape.h b/src/app/tools/point_shape.h index 6f2034cc4..052a02072 100644 --- a/src/app/tools/point_shape.h +++ b/src/app/tools/point_shape.h @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2001-2015 David Capello +// Copyright (C) 2001-2016 David Capello // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -19,6 +19,7 @@ namespace app { class PointShape { public: virtual ~PointShape() { } + virtual bool isPixel() { return false; } virtual bool isFloodFill() { return false; } virtual bool isSpray() { return false; } virtual void preparePointShape(ToolLoop* loop) { } diff --git a/src/app/tools/point_shapes.h b/src/app/tools/point_shapes.h index 6398cec8d..f340b8321 100644 --- a/src/app/tools/point_shapes.h +++ b/src/app/tools/point_shapes.h @@ -21,6 +21,8 @@ public: class PixelPointShape : public PointShape { public: + bool isPixel() override { return true; } + void transformPoint(ToolLoop* loop, int x, int y) override { doInkHline(x, y, x, loop); } diff --git a/src/app/ui/editor/brush_preview.cpp b/src/app/ui/editor/brush_preview.cpp index 02b695550..598fe1dad 100644 --- a/src/app/ui/editor/brush_preview.cpp +++ b/src/app/ui/editor/brush_preview.cpp @@ -305,17 +305,19 @@ void BrushPreview::generateBoundaries() m_brushGen == brush->gen()) return; - bool isFloodfill = m_editor->getCurrentEditorTool()->getPointShape(0)->isFloodFill(); + bool isOnePixel = + (m_editor->getCurrentEditorTool()->getPointShape(0)->isPixel() || + m_editor->getCurrentEditorTool()->getPointShape(0)->isFloodFill()); Image* brushImage = brush->image(); - int w = (isFloodfill ? 1: brushImage->width()); - int h = (isFloodfill ? 1: brushImage->height()); + int w = (isOnePixel ? 1: brushImage->width()); + int h = (isOnePixel ? 1: brushImage->height()); m_brushGen = brush->gen(); m_brushWidth = w; m_brushHeight = h; ImageRef mask; - if (isFloodfill) { + if (isOnePixel) { mask.reset(Image::create(IMAGE_BITMAP, w, w)); mask->putPixel(0, 0, (color_t)1); }