summaryrefslogtreecommitdiff
path: root/Applications
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>2020-09-06 23:59:20 +0200
committerAndreas Kling <kling@serenityos.org>2020-09-12 00:13:29 +0200
commit9c3a33762be4ba4ee361b537516179c3c469d61a (patch)
tree10a0d45ccaf20b7862789e919e7bbec95700e8d6 /Applications
parentd6673b384efe02b0d8aa3f0abd58c51afb278485 (diff)
downloadserenity-9c3a33762be4ba4ee361b537516179c3c469d61a.zip
LibGfx: Saner memory usage of indexed bitmaps
Indexed bitmaps used to allocate four times the required amount of memory. Also, we should acknowledge that the underlying data is not always RGBA32, and instead cast it only when the true type is known.
Diffstat (limited to 'Applications')
-rw-r--r--Applications/PixelPaint/BucketTool.cpp4
-rw-r--r--Applications/PixelPaint/SprayTool.cpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/Applications/PixelPaint/BucketTool.cpp b/Applications/PixelPaint/BucketTool.cpp
index 92f3ab2aa8..978df6a5ef 100644
--- a/Applications/PixelPaint/BucketTool.cpp
+++ b/Applications/PixelPaint/BucketTool.cpp
@@ -58,10 +58,10 @@ static void flood_fill(Gfx::Bitmap& bitmap, const Gfx::IntPoint& start_position,
while (!queue.is_empty()) {
auto position = queue.dequeue();
- if (bitmap.get_pixel<Gfx::BitmapFormat::RGBA32>(position.x(), position.y()) != target_color)
+ if (bitmap.get_pixel<Gfx::StorageFormat::RGBA32>(position.x(), position.y()) != target_color)
continue;
- bitmap.set_pixel<Gfx::BitmapFormat::RGBA32>(position.x(), position.y(), fill_color);
+ bitmap.set_pixel<Gfx::StorageFormat::RGBA32>(position.x(), position.y(), fill_color);
if (position.x() != 0)
queue.enqueue(position.translated(-1, 0));
diff --git a/Applications/PixelPaint/SprayTool.cpp b/Applications/PixelPaint/SprayTool.cpp
index 85a6200f97..f1f73c29aa 100644
--- a/Applications/PixelPaint/SprayTool.cpp
+++ b/Applications/PixelPaint/SprayTool.cpp
@@ -77,7 +77,7 @@ void SprayTool::paint_it()
continue;
if (ypos < 0 || ypos >= bitmap.height())
continue;
- bitmap.set_pixel<Gfx::BitmapFormat::RGB32>(xpos, ypos, m_color);
+ bitmap.set_pixel<Gfx::StorageFormat::RGBA32>(xpos, ypos, m_color);
}
layer->did_modify_bitmap(*m_editor->image());