From 3fe2640c8c51283cb8c89a948d7221fd79699f3d Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 14 Feb 2020 23:02:47 +0100 Subject: LibGfx: Add forward declaration header This patch adds with forward declarations for Gfx. --- Libraries/LibGfx/Painter.cpp | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'Libraries/LibGfx/Painter.cpp') diff --git a/Libraries/LibGfx/Painter.cpp b/Libraries/LibGfx/Painter.cpp index c6b0091bc5..2e85a5184f 100644 --- a/Libraries/LibGfx/Painter.cpp +++ b/Libraries/LibGfx/Painter.cpp @@ -51,14 +51,14 @@ namespace Gfx { -template +template static ALWAYS_INLINE Color get_pixel(const Gfx::Bitmap& bitmap, int x, int y) { - if constexpr (format == Bitmap::Format::Indexed8) + if constexpr (format == BitmapFormat::Indexed8) return bitmap.palette_color(bitmap.bits(y)[x]); - if constexpr (format == Bitmap::Format::RGB32) + if constexpr (format == BitmapFormat::RGB32) return Color::from_rgb(bitmap.scanline(y)[x]); - if constexpr (format == Bitmap::Format::RGBA32) + if constexpr (format == BitmapFormat::RGBA32) return Color::from_rgba(bitmap.scanline(y)[x]); return bitmap.get_pixel(x, y); } @@ -399,7 +399,7 @@ void Painter::draw_tiled_bitmap(const Rect& a_dst_rect, const Gfx::Bitmap& sourc RGBA32* dst = m_target->scanline(clipped_rect.y()) + clipped_rect.x(); const size_t dst_skip = m_target->pitch() / sizeof(RGBA32); - if (source.format() == Bitmap::Format::RGB32 || source.format() == Bitmap::Format::RGBA32) { + if (source.format() == BitmapFormat::RGB32 || source.format() == BitmapFormat::RGBA32) { int x_start = first_column + a_dst_rect.left(); for (int row = first_row; row <= last_row; ++row) { const RGBA32* sl = source.scanline((row + a_dst_rect.top()) @@ -430,7 +430,7 @@ void Painter::blit_offset(const Point& position, RGBA32* dst = m_target->scanline(clipped_rect.y()) + clipped_rect.x(); const size_t dst_skip = m_target->pitch() / sizeof(RGBA32); - if (source.format() == Bitmap::Format::RGB32 || source.format() == Bitmap::Format::RGBA32) { + if (source.format() == BitmapFormat::RGB32 || source.format() == BitmapFormat::RGBA32) { int x_start = first_column + src_rect.left(); for (int row = first_row; row <= last_row; ++row) { int sr = row - offset.y() + src_rect.top(); @@ -502,7 +502,7 @@ void Painter::blit(const Point& position, const Gfx::Bitmap& source, const Rect& RGBA32* dst = m_target->scanline(clipped_rect.y()) + clipped_rect.x(); const size_t dst_skip = m_target->pitch() / sizeof(RGBA32); - if (source.format() == Bitmap::Format::RGB32 || source.format() == Bitmap::Format::RGBA32) { + if (source.format() == BitmapFormat::RGB32 || source.format() == BitmapFormat::RGBA32) { const RGBA32* src = source.scanline(src_rect.top() + first_row) + src_rect.left() + first_column; const size_t src_skip = source.pitch() / sizeof(RGBA32); for (int row = first_row; row <= last_row; ++row) { @@ -513,7 +513,7 @@ void Painter::blit(const Point& position, const Gfx::Bitmap& source, const Rect& return; } - if (source.format() == Bitmap::Format::Indexed8) { + if (source.format() == BitmapFormat::Indexed8) { const u8* src = source.bits(src_rect.top() + first_row) + src_rect.left() + first_column; const size_t src_skip = source.pitch(); for (int row = first_row; row <= last_row; ++row) { @@ -597,32 +597,32 @@ void Painter::draw_scaled_bitmap(const Rect& a_dst_rect, const Gfx::Bitmap& sour if (source.has_alpha_channel()) { switch (source.format()) { - case Bitmap::Format::RGB32: - do_draw_scaled_bitmap(*m_target, dst_rect, clipped_rect, source, src_rect, hscale, vscale, get_pixel); + case BitmapFormat::RGB32: + do_draw_scaled_bitmap(*m_target, dst_rect, clipped_rect, source, src_rect, hscale, vscale, get_pixel); break; - case Bitmap::Format::RGBA32: - do_draw_scaled_bitmap(*m_target, dst_rect, clipped_rect, source, src_rect, hscale, vscale, get_pixel); + case BitmapFormat::RGBA32: + do_draw_scaled_bitmap(*m_target, dst_rect, clipped_rect, source, src_rect, hscale, vscale, get_pixel); break; - case Bitmap::Format::Indexed8: - do_draw_scaled_bitmap(*m_target, dst_rect, clipped_rect, source, src_rect, hscale, vscale, get_pixel); + case BitmapFormat::Indexed8: + do_draw_scaled_bitmap(*m_target, dst_rect, clipped_rect, source, src_rect, hscale, vscale, get_pixel); break; default: - do_draw_scaled_bitmap(*m_target, dst_rect, clipped_rect, source, src_rect, hscale, vscale, get_pixel); + do_draw_scaled_bitmap(*m_target, dst_rect, clipped_rect, source, src_rect, hscale, vscale, get_pixel); break; } } else { switch (source.format()) { - case Bitmap::Format::RGB32: - do_draw_scaled_bitmap(*m_target, dst_rect, clipped_rect, source, src_rect, hscale, vscale, get_pixel); + case BitmapFormat::RGB32: + do_draw_scaled_bitmap(*m_target, dst_rect, clipped_rect, source, src_rect, hscale, vscale, get_pixel); break; - case Bitmap::Format::RGBA32: - do_draw_scaled_bitmap(*m_target, dst_rect, clipped_rect, source, src_rect, hscale, vscale, get_pixel); + case BitmapFormat::RGBA32: + do_draw_scaled_bitmap(*m_target, dst_rect, clipped_rect, source, src_rect, hscale, vscale, get_pixel); break; - case Bitmap::Format::Indexed8: - do_draw_scaled_bitmap(*m_target, dst_rect, clipped_rect, source, src_rect, hscale, vscale, get_pixel); + case BitmapFormat::Indexed8: + do_draw_scaled_bitmap(*m_target, dst_rect, clipped_rect, source, src_rect, hscale, vscale, get_pixel); break; default: - do_draw_scaled_bitmap(*m_target, dst_rect, clipped_rect, source, src_rect, hscale, vscale, get_pixel); + do_draw_scaled_bitmap(*m_target, dst_rect, clipped_rect, source, src_rect, hscale, vscale, get_pixel); break; } } -- cgit v1.2.3