Don't use brush edges on tools with "one pixel" point shape (fix #1167)

This commit is contained in:
David Capello 2016-07-01 12:55:29 -03:00
parent b094f6e557
commit 9748894a26
3 changed files with 10 additions and 5 deletions

View File

@ -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) { }

View File

@ -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);
}

View File

@ -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);
}