summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-10-19 11:05:21 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-10-19 11:05:21 +0200
commit96f10c8de2a519db92e087fd660f27c1aaa5563f (patch)
tree6cd85dba232fa8cfe0eb36ce34c69216974004bb
parent762f20944c1340c182ec8930f95ccb000385b918 (diff)
downloadserenity-96f10c8de2a519db92e087fd660f27c1aaa5563f.zip
LibDraw: Rename Painter::blit_tiled() => draw_tiled_bitmap()
Also change the API to take a destination rect instead of a source rect since internally it was basically creating a destination rect from the source rect anyway. It was a little confusing.
-rw-r--r--Libraries/LibDraw/Painter.cpp8
-rw-r--r--Libraries/LibDraw/Painter.h2
-rw-r--r--Servers/WindowServer/WSCompositor.cpp2
3 files changed, 6 insertions, 6 deletions
diff --git a/Libraries/LibDraw/Painter.cpp b/Libraries/LibDraw/Painter.cpp
index b3b0043b0e..b55cccc2f9 100644
--- a/Libraries/LibDraw/Painter.cpp
+++ b/Libraries/LibDraw/Painter.cpp
@@ -305,9 +305,9 @@ void Painter::blit_dimmed(const Point& position, const GraphicsBitmap& source, c
}
}
-void Painter::blit_tiled(const Point& position, const GraphicsBitmap& source, const Rect& src_rect)
+void Painter::draw_tiled_bitmap(const Rect& a_dst_rect, const GraphicsBitmap& source)
{
- auto dst_rect = Rect(position, src_rect.size()).translated(translation());
+ auto dst_rect = a_dst_rect.translated(translation());
auto clipped_rect = dst_rect.intersected(clip_rect());
if (clipped_rect.is_empty())
return;
@@ -318,9 +318,9 @@ void Painter::blit_tiled(const Point& position, const GraphicsBitmap& source, co
const size_t dst_skip = m_target->pitch() / sizeof(RGBA32);
if (source.format() == GraphicsBitmap::Format::RGB32 || source.format() == GraphicsBitmap::Format::RGBA32) {
- int x_start = first_column + src_rect.left();
+ int x_start = first_column + a_dst_rect.left();
for (int row = first_row; row <= last_row; ++row) {
- const RGBA32* sl = source.scanline((row + src_rect.top())
+ const RGBA32* sl = source.scanline((row + a_dst_rect.top())
% source.size().height());
for (int x = x_start; x < clipped_rect.width() + x_start; ++x) {
dst[x - x_start] = sl[x % source.size().width()];
diff --git a/Libraries/LibDraw/Painter.h b/Libraries/LibDraw/Painter.h
index e6eb8a83ed..a5d765d305 100644
--- a/Libraries/LibDraw/Painter.h
+++ b/Libraries/LibDraw/Painter.h
@@ -29,7 +29,7 @@ public:
void draw_scaled_bitmap(const Rect& dst_rect, const GraphicsBitmap&, const Rect& src_rect);
void blit(const Point&, const GraphicsBitmap&, const Rect& src_rect, float opacity = 1.0f);
void blit_dimmed(const Point&, const GraphicsBitmap&, const Rect& src_rect);
- void blit_tiled(const Point&, const GraphicsBitmap&, const Rect& src_rect);
+ void draw_tiled_bitmap(const Rect& dst_rect, const GraphicsBitmap&);
void blit_offset(const Point&, const GraphicsBitmap&, const Rect& src_rect, const Point&);
void blit_scaled(const Rect&, const GraphicsBitmap&, const Rect&, float, float);
void draw_text(const Rect&, const StringView&, const Font&, TextAlignment = TextAlignment::TopLeft, Color = Color::Black, TextElision = TextElision::None);
diff --git a/Servers/WindowServer/WSCompositor.cpp b/Servers/WindowServer/WSCompositor.cpp
index 31b59ad412..1ccc4acf5a 100644
--- a/Servers/WindowServer/WSCompositor.cpp
+++ b/Servers/WindowServer/WSCompositor.cpp
@@ -120,7 +120,7 @@ void WSCompositor::compose()
m_back_painter->blit_offset(dirty_rect.location(), *m_wallpaper,
dirty_rect, offset);
} else if (m_wallpaper_mode == WallpaperMode::Tile) {
- m_back_painter->blit_tiled(dirty_rect.location(), *m_wallpaper, dirty_rect);
+ m_back_painter->draw_tiled_bitmap(dirty_rect, *m_wallpaper);
} else {
float hscale = (float)m_wallpaper->size().width() / (float)ws.size().width();
float vscale = (float)m_wallpaper->size().height() / (float)ws.size().height();