1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:17:34 +00:00

Hook up the PS2MouseDevice to the AbstractScreen+WindowManager.

Render the mouse cursor by xor'ing the pixels. I don't know anything about
hardware cursors yet and this way we don't need to recompose the window
hierarchy every time you move the mouse. :^)
This commit is contained in:
Andreas Kling 2019-01-11 03:52:09 +01:00
parent 31667b47a5
commit e5e295052f
10 changed files with 117 additions and 5 deletions

View file

@ -136,6 +136,14 @@ void Painter::drawPixel(const Point& p, Color color)
m_target->scanline(point.y())[point.x()] = color.value();
}
void Painter::set_pixel_with_draw_op(dword& pixel, const Color& color)
{
if (m_draw_op == DrawOp::Copy)
pixel = color.value();
else if (m_draw_op == DrawOp::Xor)
pixel ^= color.value();
}
void Painter::drawLine(const Point& p1, const Point& p2, Color color)
{
auto point1 = p1;
@ -152,7 +160,7 @@ void Painter::drawLine(const Point& p1, const Point& p2, Color color)
if (point1.y() > point2.y())
swap(point1, point2);
for (int y = max(point1.y(), m_clipRect.top()); y <= min(point2.y(), m_clipRect.bottom()); ++y)
m_target->scanline(y)[x] = color.value();
set_pixel_with_draw_op(m_target->scanline(y)[x], color);
return;
}
@ -168,7 +176,7 @@ void Painter::drawLine(const Point& p1, const Point& p2, Color color)
swap(point1, point2);
auto* pixels = m_target->scanline(point1.y());
for (int x = max(point1.x(), m_clipRect.left()); x <= min(point2.x(), m_clipRect.right()); ++x)
pixels[x] = color.value();
set_pixel_with_draw_op(pixels[x], color);
return;
}