1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:18:12 +00:00

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.
This commit is contained in:
Andreas Kling 2019-10-19 11:05:21 +02:00
parent 762f20944c
commit 96f10c8de2
3 changed files with 6 additions and 6 deletions

View file

@ -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()];