mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:38:11 +00:00
LibGfx: Move Gfx::color_for_format() to header
This commit is contained in:
parent
a1bafafd78
commit
65b87bace9
2 changed files with 13 additions and 13 deletions
|
@ -43,19 +43,6 @@
|
||||||
|
|
||||||
namespace Gfx {
|
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>
|
template<BitmapFormat format = BitmapFormat::Invalid>
|
||||||
ALWAYS_INLINE Color get_pixel(Gfx::Bitmap const& bitmap, int x, int y)
|
ALWAYS_INLINE Color get_pixel(Gfx::Bitmap const& bitmap, int x, int y)
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,6 +27,19 @@
|
||||||
|
|
||||||
namespace Gfx {
|
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 {
|
class Painter {
|
||||||
public:
|
public:
|
||||||
static constexpr int LINE_SPACING = 4;
|
static constexpr int LINE_SPACING = 4;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue