summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-06-15 10:48:20 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-06-15 10:48:20 +0200
commit150b3cf378780132deeb200839432e09638c602d (patch)
tree43d27d5d78875d487e676a203a800a16610b5a16
parenta8b2b96f3894284978691d529d555d0c554e46ce (diff)
downloadserenity-150b3cf378780132deeb200839432e09638c602d.zip
PaintBrush: Fix some silly logic typos in flood fill.
-rw-r--r--Applications/PaintBrush/BucketTool.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/Applications/PaintBrush/BucketTool.cpp b/Applications/PaintBrush/BucketTool.cpp
index c5aa4471d4..e3fdad5e16 100644
--- a/Applications/PaintBrush/BucketTool.cpp
+++ b/Applications/PaintBrush/BucketTool.cpp
@@ -21,23 +21,21 @@ static void flood_fill(GraphicsBitmap& bitmap, const Point& start_position, Colo
while (!queue.is_empty()) {
auto position = queue.dequeue();
- if (!bitmap.rect().contains(position))
- continue;
if (bitmap.get_pixel(position) != target_color)
continue;
bitmap.set_pixel(position, fill_color);
if (position.x() != 0)
- queue.enqueue(position.translated(0, -1));
+ queue.enqueue(position.translated(-1, 0));
if (position.x() != bitmap.width() - 1)
- queue.enqueue(position.translated(0, 1));
+ queue.enqueue(position.translated(1, 0));
if (position.y() != 0)
- queue.enqueue(position.translated(-1, 0));
+ queue.enqueue(position.translated(0, -1));
if (position.y() != bitmap.height() - 1)
- queue.enqueue(position.translated(1, 0));
+ queue.enqueue(position.translated(0, 1));
}
}