mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 12:05:08 +00:00
SharedGraphics: Make Painter::fill_rect() respect the current DrawOp.
This commit is contained in:
parent
95c3442d59
commit
b7967d1292
2 changed files with 25 additions and 0 deletions
|
@ -56,8 +56,32 @@ Painter::~Painter()
|
|||
#endif
|
||||
}
|
||||
|
||||
void Painter::fill_rect_with_draw_op(const Rect& a_rect, Color color)
|
||||
{
|
||||
auto rect = a_rect;
|
||||
rect.move_by(m_translation);
|
||||
rect.intersect(m_clip_rect);
|
||||
|
||||
if (rect.is_empty())
|
||||
return;
|
||||
|
||||
RGBA32* dst = m_target->scanline(rect.top()) + rect.left();
|
||||
const unsigned dst_skip = m_target->width();
|
||||
|
||||
for (int i = rect.height() - 1; i >= 0; --i) {
|
||||
for (int j = 0; j < rect.width(); ++j)
|
||||
set_pixel_with_draw_op(dst[j], color.value());
|
||||
dst += dst_skip;
|
||||
}
|
||||
}
|
||||
|
||||
void Painter::fill_rect(const Rect& a_rect, Color color)
|
||||
{
|
||||
if (m_draw_op != DrawOp::Copy) {
|
||||
fill_rect_with_draw_op(a_rect, color);
|
||||
return;
|
||||
}
|
||||
|
||||
auto rect = a_rect;
|
||||
rect.move_by(m_translation);
|
||||
rect.intersect(m_clip_rect);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue