mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:47:35 +00:00
Make Widgets/ build inside the kernel.
This commit is contained in:
parent
e180e2553a
commit
8626e95509
2 changed files with 7 additions and 3 deletions
|
@ -1,3 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "kprintf.h"
|
#include "kprintf.h"
|
||||||
|
|
||||||
|
#define printf dbgprintf
|
||||||
|
|
|
@ -150,14 +150,14 @@ void Painter::drawLine(const Point& p1, const Point& p2, Color color)
|
||||||
if (x < m_clipRect.left() || x >= m_clipRect.right())
|
if (x < m_clipRect.left() || x >= m_clipRect.right())
|
||||||
return;
|
return;
|
||||||
if (point1.y() > point2.y())
|
if (point1.y() > point2.y())
|
||||||
std::swap(point1, point2);
|
swap(point1, point2);
|
||||||
for (int y = max(point1.y(), m_clipRect.top()); y <= min(point2.y(), m_clipRect.bottom()); ++y)
|
for (int y = max(point1.y(), m_clipRect.top()); y <= min(point2.y(), m_clipRect.bottom()); ++y)
|
||||||
m_target->scanline(y)[x] = color.value();
|
m_target->scanline(y)[x] = color.value();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (point1.x() > point2.x())
|
if (point1.x() > point2.x())
|
||||||
std::swap(point1, point2);
|
swap(point1, point2);
|
||||||
|
|
||||||
// Special case: horizontal line.
|
// Special case: horizontal line.
|
||||||
if (point1.y() == point2.y()) {
|
if (point1.y() == point2.y()) {
|
||||||
|
@ -165,7 +165,7 @@ void Painter::drawLine(const Point& p1, const Point& p2, Color color)
|
||||||
if (y < m_clipRect.top() || y >= m_clipRect.bottom())
|
if (y < m_clipRect.top() || y >= m_clipRect.bottom())
|
||||||
return;
|
return;
|
||||||
if (point1.x() > point2.x())
|
if (point1.x() > point2.x())
|
||||||
std::swap(point1, point2);
|
swap(point1, point2);
|
||||||
auto* pixels = m_target->scanline(point1.y());
|
auto* pixels = m_target->scanline(point1.y());
|
||||||
for (int x = max(point1.x(), m_clipRect.left()); x <= min(point2.x(), m_clipRect.right()); ++x)
|
for (int x = max(point1.x(), m_clipRect.left()); x <= min(point2.x(), m_clipRect.right()); ++x)
|
||||||
pixels[x] = color.value();
|
pixels[x] = color.value();
|
||||||
|
@ -175,6 +175,7 @@ void Painter::drawLine(const Point& p1, const Point& p2, Color color)
|
||||||
// FIXME: Implement clipping below.
|
// FIXME: Implement clipping below.
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
|
|
||||||
|
#if 0
|
||||||
const double dx = point2.x() - point1.x();
|
const double dx = point2.x() - point1.x();
|
||||||
const double dy = point2.y() - point1.y();
|
const double dy = point2.y() - point1.y();
|
||||||
const double deltaError = fabs(dy / dx);
|
const double deltaError = fabs(dy / dx);
|
||||||
|
@ -190,6 +191,7 @@ void Painter::drawLine(const Point& p1, const Point& p2, Color color)
|
||||||
error -= 1.0;
|
error -= 1.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Painter::drawFocusRect(const Rect& rect)
|
void Painter::drawFocusRect(const Rect& rect)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue