From 8626e95509c5984c331b23585bd530571239129d Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 10 Jan 2019 22:52:14 +0100 Subject: [PATCH] Make Widgets/ build inside the kernel. --- Kernel/kstdio.h | 2 ++ Widgets/Painter.cpp | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Kernel/kstdio.h b/Kernel/kstdio.h index 4a6dbfb3f5..95f2b29948 100644 --- a/Kernel/kstdio.h +++ b/Kernel/kstdio.h @@ -1,3 +1,5 @@ #pragma once #include "kprintf.h" + +#define printf dbgprintf diff --git a/Widgets/Painter.cpp b/Widgets/Painter.cpp index 9f6ba92992..a495dd9088 100644 --- a/Widgets/Painter.cpp +++ b/Widgets/Painter.cpp @@ -150,14 +150,14 @@ void Painter::drawLine(const Point& p1, const Point& p2, Color color) if (x < m_clipRect.left() || x >= m_clipRect.right()) return; 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) m_target->scanline(y)[x] = color.value(); return; } if (point1.x() > point2.x()) - std::swap(point1, point2); + swap(point1, point2); // Special case: horizontal line. 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()) return; if (point1.x() > point2.x()) - std::swap(point1, point2); + 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(); @@ -175,6 +175,7 @@ void Painter::drawLine(const Point& p1, const Point& p2, Color color) // FIXME: Implement clipping below. ASSERT_NOT_REACHED(); +#if 0 const double dx = point2.x() - point1.x(); const double dy = point2.y() - point1.y(); const double deltaError = fabs(dy / dx); @@ -190,6 +191,7 @@ void Painter::drawLine(const Point& p1, const Point& p2, Color color) error -= 1.0; } } +#endif } void Painter::drawFocusRect(const Rect& rect)