summaryrefslogtreecommitdiff
path: root/Applications/PaintBrush/BucketTool.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-06-16 06:34:29 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-06-16 06:34:29 +0200
commit264890bfc3645b044b09e5b908ec60bbd678992c (patch)
treea8ab1acaa239ee2d39df392b102bfa2ee27071a2 /Applications/PaintBrush/BucketTool.cpp
parent1f51c2b7daf5444467b83bb8b01805227494c125 (diff)
downloadserenity-264890bfc3645b044b09e5b908ec60bbd678992c.zip
PaintBrush: Flood filling with the same color is a no-op.
Diffstat (limited to 'Applications/PaintBrush/BucketTool.cpp')
-rw-r--r--Applications/PaintBrush/BucketTool.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/Applications/PaintBrush/BucketTool.cpp b/Applications/PaintBrush/BucketTool.cpp
index c2b6353418..70ae32dde1 100644
--- a/Applications/PaintBrush/BucketTool.cpp
+++ b/Applications/PaintBrush/BucketTool.cpp
@@ -18,6 +18,9 @@ static void flood_fill(GraphicsBitmap& bitmap, const Point& start_position, Colo
{
ASSERT(bitmap.format() == GraphicsBitmap::Format::RGB32);
+ if (target_color == fill_color)
+ return;
+
Queue<Point> queue;
queue.enqueue(Point(start_position));
while (!queue.is_empty()) {