Add possibility to use paint bucket in any tile

Anyway the floodfill algorithm needs some work to fully support tiled
modes (e.g. don't stop at edges).

Related to #1369
This commit is contained in:
David Capello 2017-11-08 09:23:43 -03:00
parent fb2ee91c92
commit 7dbff3daa6

View File

@ -87,12 +87,31 @@ public:
bool isFloodFill() override { return true; }
void transformPoint(ToolLoop* loop, int x, int y) override {
const doc::Image* srcImage = loop->getFloodFillSrcImage();
filters::TiledMode tiledMode = loop->getTiledMode();
const bool xTiled = ((int(tiledMode) & int(filters::TiledMode::X_AXIS)) ? true: false);
const bool yTiled = ((int(tiledMode) & int(filters::TiledMode::Y_AXIS)) ? true: false);
const int w = srcImage->width();
const int h = srcImage->height();
if (xTiled) {
if (x < 0)
x = (w - (-x % w));
x %= w;
}
if (yTiled) {
if (y < 0)
y = (h - (-y % h));
y %= h;
}
doc::algorithm::floodfill(
loop->getFloodFillSrcImage(),
srcImage,
(loop->useMask() ? loop->getMask(): nullptr),
x, y,
floodfillBounds(loop, x, y),
get_pixel(loop->getFloodFillSrcImage(), x, y),
get_pixel(srcImage, x, y),
loop->getTolerance(),
loop->getContiguous(),
loop, (AlgoHLine)doInkHline);