LibGfx: Move Gfx::color_for_format() to header

This commit is contained in:
MacDue 2024-01-05 23:32:29 +00:00 committed by Andreas Kling
parent a1bafafd78
commit 65b87bace9
Notes: sideshowbarker 2024-07-17 05:58:46 +09:00
2 changed files with 13 additions and 13 deletions

View file

@ -43,19 +43,6 @@
namespace Gfx {
ALWAYS_INLINE static Color color_for_format(BitmapFormat format, ARGB32 value)
{
switch (format) {
case BitmapFormat::BGRA8888:
return Color::from_argb(value);
case BitmapFormat::BGRx8888:
return Color::from_rgb(value);
// FIXME: Handle other formats
default:
VERIFY_NOT_REACHED();
}
}
template<BitmapFormat format = BitmapFormat::Invalid>
ALWAYS_INLINE Color get_pixel(Gfx::Bitmap const& bitmap, int x, int y)
{

View file

@ -27,6 +27,19 @@
namespace Gfx {
ALWAYS_INLINE static Color color_for_format(BitmapFormat format, ARGB32 value)
{
switch (format) {
case BitmapFormat::BGRA8888:
return Color::from_argb(value);
case BitmapFormat::BGRx8888:
return Color::from_rgb(value);
// FIXME: Handle other formats
default:
VERIFY_NOT_REACHED();
}
}
class Painter {
public:
static constexpr int LINE_SPACING = 4;