mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 10:17:35 +00:00
Tidy up Painter::fill_rect() a bit.
This commit is contained in:
parent
61bba1b9dd
commit
f92e721ae8
1 changed files with 10 additions and 10 deletions
|
@ -35,18 +35,18 @@ Painter::~Painter()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Painter::fill_rect(const Rect& rect, Color color)
|
void Painter::fill_rect(const Rect& a_rect, Color color)
|
||||||
{
|
{
|
||||||
Rect r = rect;
|
auto rect = a_rect;
|
||||||
r.move_by(m_translation);
|
rect.move_by(m_translation);
|
||||||
|
rect.intersect(m_clip_rect);
|
||||||
|
|
||||||
int min_y = max(r.top(), m_clip_rect.top());
|
RGBA32* dst = m_target->scanline(rect.top()) + rect.left();
|
||||||
int max_y = min(r.bottom(), m_clip_rect.bottom());
|
const unsigned dst_skip = m_target->width();
|
||||||
int min_x = max(r.left(), m_clip_rect.left());
|
|
||||||
int max_x = min(r.right(), m_clip_rect.right());
|
for (int i = rect.height() - 1; i >= 0; --i) {
|
||||||
for (int y = min_y; y <= max_y; ++y) {
|
fast_dword_fill(dst, color.value(), rect.width());
|
||||||
RGBA32* bits = m_target->scanline(y);
|
dst += dst_skip;
|
||||||
fast_dword_fill(bits + min_x, color.value(), max_x - min_x + 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue