Skip to content

Commit

Permalink
issue-1864: Fix fill misbehaving when drawing was partly outside border
Browse files Browse the repository at this point in the history
  • Loading branch information
MrStevns committed Jul 23, 2024
1 parent eba8d6d commit 4c78d3f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions core_lib/src/graphics/bitmap/bitmapimage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -880,8 +880,7 @@ bool* BitmapImage::floodFillPoints(const BitmapImage* targetImage,
{
QRgb oldColor = targetImage->constScanLine(point.x(), point.y());
oldColor = qRgba(qRed(oldColor), qGreen(oldColor), qBlue(oldColor), qAlpha(oldColor));
QRect borderBounds = searchBounds.intersected(maxBounds);
searchBounds = searchBounds.adjusted(-1, -1, 1, 1).intersected(maxBounds);
searchBounds = searchBounds.adjusted(-1, -1, 1, 1).united(maxBounds);

// Preparations
QList<QPoint> queue; // queue all the pixels of the filled area (as they are found)
Expand Down Expand Up @@ -921,7 +920,7 @@ bool* BitmapImage::floodFillPoints(const BitmapImage* targetImage,
int yCoord = point.y() - maxBounds.top();

// In case we fill outside the searchBounds, expand the search area to the max.
if (!borderBounds.contains(point)) {
if (!searchBounds.contains(point)) {
checkOutside = true;
}

Expand Down

0 comments on commit 4c78d3f

Please sign in to comment.