summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-03-16 12:00:43 +0100
committerAndreas Kling <kling@serenityos.org>2021-03-16 12:00:43 +0100
commit50233317268eaa6eb45b53820a30d4ece7847ae2 (patch)
tree75cbdb45cf7caafa386f53b9a288984e567d5f50 /Userland
parente0f32626bcae634528327e43bcfa59c810c5a3ef (diff)
downloadserenity-50233317268eaa6eb45b53820a30d4ece7847ae2.zip
LibGfx: Rename 32-bit bitmap StorageFormats to BGRA8888 and BGRx8888
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Applications/PixelPaint/BucketTool.cpp4
-rw-r--r--Userland/Applications/PixelPaint/SprayTool.cpp2
-rw-r--r--Userland/Libraries/LibGfx/Bitmap.cpp4
-rw-r--r--Userland/Libraries/LibGfx/Bitmap.h32
4 files changed, 21 insertions, 21 deletions
diff --git a/Userland/Applications/PixelPaint/BucketTool.cpp b/Userland/Applications/PixelPaint/BucketTool.cpp
index da788f3c8c..011c853166 100644
--- a/Userland/Applications/PixelPaint/BucketTool.cpp
+++ b/Userland/Applications/PixelPaint/BucketTool.cpp
@@ -70,11 +70,11 @@ static void flood_fill(Gfx::Bitmap& bitmap, const Gfx::IntPoint& start_position,
while (!queue.is_empty()) {
auto position = queue.dequeue();
- auto pixel_color = bitmap.get_pixel<Gfx::StorageFormat::RGBA32>(position.x(), position.y());
+ auto pixel_color = bitmap.get_pixel<Gfx::StorageFormat::BGRA8888>(position.x(), position.y());
if (color_distance_squared(pixel_color, target_color) > threshold_normalized_squared)
continue;
- bitmap.set_pixel<Gfx::StorageFormat::RGBA32>(position.x(), position.y(), fill_color);
+ bitmap.set_pixel<Gfx::StorageFormat::BGRA8888>(position.x(), position.y(), fill_color);
if (position.x() != 0)
queue.enqueue(position.translated(-1, 0));
diff --git a/Userland/Applications/PixelPaint/SprayTool.cpp b/Userland/Applications/PixelPaint/SprayTool.cpp
index a5d0a176d8..51d5a7e83b 100644
--- a/Userland/Applications/PixelPaint/SprayTool.cpp
+++ b/Userland/Applications/PixelPaint/SprayTool.cpp
@@ -79,7 +79,7 @@ void SprayTool::paint_it()
continue;
if (ypos < 0 || ypos >= bitmap.height())
continue;
- bitmap.set_pixel<Gfx::StorageFormat::RGBA32>(xpos, ypos, m_color);
+ bitmap.set_pixel<Gfx::StorageFormat::BGRA8888>(xpos, ypos, m_color);
}
layer->did_modify_bitmap(*m_editor->image());
diff --git a/Userland/Libraries/LibGfx/Bitmap.cpp b/Userland/Libraries/LibGfx/Bitmap.cpp
index 09e1505de5..5612fae972 100644
--- a/Userland/Libraries/LibGfx/Bitmap.cpp
+++ b/Userland/Libraries/LibGfx/Bitmap.cpp
@@ -64,8 +64,8 @@ size_t Bitmap::minimum_pitch(size_t physical_width, BitmapFormat format)
case StorageFormat::Indexed8:
element_size = 1;
break;
- case StorageFormat::RGB32:
- case StorageFormat::RGBA32:
+ case StorageFormat::BGRx8888:
+ case StorageFormat::BGRA8888:
element_size = 4;
break;
default:
diff --git a/Userland/Libraries/LibGfx/Bitmap.h b/Userland/Libraries/LibGfx/Bitmap.h
index 69204b405e..bb8c8e78cc 100644
--- a/Userland/Libraries/LibGfx/Bitmap.h
+++ b/Userland/Libraries/LibGfx/Bitmap.h
@@ -73,17 +73,17 @@ inline bool is_valid_bitmap_format(unsigned format)
enum class StorageFormat {
Indexed8,
- RGB32,
- RGBA32,
+ BGRx8888,
+ BGRA8888,
};
static StorageFormat determine_storage_format(BitmapFormat format)
{
switch (format) {
case BitmapFormat::BGRx8888:
- return StorageFormat::RGB32;
+ return StorageFormat::BGRx8888;
case BitmapFormat::BGRA8888:
- return StorageFormat::RGBA32;
+ return StorageFormat::BGRA8888;
case BitmapFormat::Indexed1:
case BitmapFormat::Indexed2:
case BitmapFormat::Indexed4:
@@ -295,14 +295,14 @@ inline const RGBA32* Bitmap::scanline(int y) const
}
template<>
-inline Color Bitmap::get_pixel<StorageFormat::RGB32>(int x, int y) const
+inline Color Bitmap::get_pixel<StorageFormat::BGRx8888>(int x, int y) const
{
VERIFY(x >= 0 && x < physical_width());
return Color::from_rgb(scanline(y)[x]);
}
template<>
-inline Color Bitmap::get_pixel<StorageFormat::RGBA32>(int x, int y) const
+inline Color Bitmap::get_pixel<StorageFormat::BGRA8888>(int x, int y) const
{
VERIFY(x >= 0 && x < physical_width());
return Color::from_rgba(scanline(y)[x]);
@@ -318,10 +318,10 @@ inline Color Bitmap::get_pixel<StorageFormat::Indexed8>(int x, int y) const
inline Color Bitmap::get_pixel(int x, int y) const
{
switch (determine_storage_format(m_format)) {
- case StorageFormat::RGB32:
- return get_pixel<StorageFormat::RGB32>(x, y);
- case StorageFormat::RGBA32:
- return get_pixel<StorageFormat::RGBA32>(x, y);
+ case StorageFormat::BGRx8888:
+ return get_pixel<StorageFormat::BGRx8888>(x, y);
+ case StorageFormat::BGRA8888:
+ return get_pixel<StorageFormat::BGRA8888>(x, y);
case StorageFormat::Indexed8:
return get_pixel<StorageFormat::Indexed8>(x, y);
default:
@@ -330,13 +330,13 @@ inline Color Bitmap::get_pixel(int x, int y) const
}
template<>
-inline void Bitmap::set_pixel<StorageFormat::RGB32>(int x, int y, Color color)
+inline void Bitmap::set_pixel<StorageFormat::BGRx8888>(int x, int y, Color color)
{
VERIFY(x >= 0 && x < physical_width());
scanline(y)[x] = color.value();
}
template<>
-inline void Bitmap::set_pixel<StorageFormat::RGBA32>(int x, int y, Color color)
+inline void Bitmap::set_pixel<StorageFormat::BGRA8888>(int x, int y, Color color)
{
VERIFY(x >= 0 && x < physical_width());
scanline(y)[x] = color.value(); // drop alpha
@@ -344,11 +344,11 @@ inline void Bitmap::set_pixel<StorageFormat::RGBA32>(int x, int y, Color color)
inline void Bitmap::set_pixel(int x, int y, Color color)
{
switch (determine_storage_format(m_format)) {
- case StorageFormat::RGB32:
- set_pixel<StorageFormat::RGB32>(x, y, color);
+ case StorageFormat::BGRx8888:
+ set_pixel<StorageFormat::BGRx8888>(x, y, color);
break;
- case StorageFormat::RGBA32:
- set_pixel<StorageFormat::RGBA32>(x, y, color);
+ case StorageFormat::BGRA8888:
+ set_pixel<StorageFormat::BGRA8888>(x, y, color);
break;
case StorageFormat::Indexed8:
VERIFY_NOT_REACHED();