mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
LibGfx: Move Gfx::color_for_format() to header
This commit is contained in:
parent
a1bafafd78
commit
65b87bace9
Notes:
sideshowbarker
2024-07-17 05:58:46 +09:00
Author: https://github.com/MacDue Commit: https://github.com/SerenityOS/serenity/commit/65b87bace9 Pull-request: https://github.com/SerenityOS/serenity/pull/22634 Reviewed-by: https://github.com/nico
2 changed files with 13 additions and 13 deletions
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue