Skip to content

Commit

Permalink
Make Widgets/ build inside the kernel.
Browse files Browse the repository at this point in the history
  • Loading branch information
awesomekling committed Jan 10, 2019
1 parent e180e25 commit 8626e95
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Kernel/kstdio.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#pragma once

#include "kprintf.h"

#define printf dbgprintf
8 changes: 5 additions & 3 deletions Widgets/Painter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,22 +150,22 @@ 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()) {
const int y = point1.y();
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();
Expand All @@ -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);
Expand All @@ -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)
Expand Down

0 comments on commit 8626e95

Please sign in to comment.