Hide ui::Point implementation.

This commit is contained in:
Jared Boone
2016-11-28 10:39:10 -08:00
parent 606c1cebac
commit aac2d31548
11 changed files with 78 additions and 57 deletions

View File

@@ -155,7 +155,7 @@ public:
const auto is_selected_key = (selected_key == entry.key());
const auto item_style = (has_focus() && is_selected_key) ? s.invert() : s;
draw(entry, target_rect, painter, item_style);
target_rect.pos.y += target_rect.height();
target_rect += { 0, target_rect.height() };
}
painter.fill_rectangle(

View File

@@ -128,12 +128,12 @@ struct Calibration {
const std::array<DigitizerPoint, 3>& s,
const std::array<ui::Point, 3>& d
) : k { (s[0].x - s[2].x) * (s[1].y - s[2].y) - (s[1].x - s[2].x) * (s[0].y - s[2].y) },
a { (d[0].x - d[2].x) * (s[1].y - s[2].y) - (d[1].x - d[2].x) * (s[0].y - s[2].y) },
b { (s[0].x - s[2].x) * (d[1].x - d[2].x) - (d[0].x - d[2].x) * (s[1].x - s[2].x) },
c { s[0].y * (s[2].x * d[1].x - s[1].x * d[2].x) + s[1].y * (s[0].x * d[2].x - s[2].x * d[0].x) + s[2].y * (s[1].x * d[0].x - s[0].x * d[1].x) },
d { (d[0].y - d[2].y) * (s[1].y - s[2].y) - (d[1].y - d[2].y) * (s[0].y - s[2].y) },
e { (s[0].x - s[2].x) * (d[1].y - d[2].y) - (d[0].y - d[2].y) * (s[1].x - s[2].x) },
f { s[0].y * (s[2].x * d[1].y - s[1].x * d[2].y) + s[1].y * (s[0].x * d[2].y - s[2].x * d[0].y) + s[2].y * (s[1].x * d[0].y - s[0].x * d[1].y) }
a { (d[0].x() - d[2].x()) * (s[1].y - s[2].y) - (d[1].x() - d[2].x()) * (s[0].y - s[2].y) },
b { (s[0].x - s[2].x) * (d[1].x() - d[2].x()) - (d[0].x() - d[2].x()) * (s[1].x - s[2].x) },
c { s[0].y * (s[2].x * d[1].x() - s[1].x * d[2].x()) + s[1].y * (s[0].x * d[2].x() - s[2].x * d[0].x()) + s[2].y * (s[1].x * d[0].x() - s[0].x * d[1].x()) },
d { (d[0].y() - d[2].y()) * (s[1].y - s[2].y) - (d[1].y() - d[2].y()) * (s[0].y - s[2].y) },
e { (s[0].x - s[2].x) * (d[1].y() - d[2].y()) - (d[0].y() - d[2].y()) * (s[1].x - s[2].x) },
f { s[0].y * (s[2].x * d[1].y() - s[1].x * d[2].y()) + s[1].y * (s[0].x * d[2].y() - s[2].x * d[0].y()) + s[2].y * (s[1].x * d[0].y() - s[0].x * d[1].y()) }
{
}

View File

@@ -45,15 +45,15 @@ void Console::write(const std::string& message) {
} else {
const auto glyph = font.glyph(c);
const auto advance = glyph.advance();
if( (pos.x + advance.x) > rect.width() ) {
if( (pos.x() + advance.x()) > rect.width() ) {
crlf();
}
const Point pos_glyph {
rect.pos.x + pos.x,
display.scroll_area_y(pos.y)
rect.pos.x() + pos.x(),
display.scroll_area_y(pos.y())
};
display.draw_glyph(pos_glyph, glyph, s.foreground, s.background);
pos.x += advance.x;
pos += { advance.x(), 0 };
}
}
}
@@ -86,14 +86,13 @@ void Console::crlf() {
const Style& s = style();
const auto sr = screen_rect();
const auto line_height = s.font.line_height();
pos.x = 0;
pos.y += line_height;
const int32_t y_excess = pos.y + line_height - sr.height();
pos = { 0, pos.y() + line_height };
const int32_t y_excess = pos.y() + line_height - sr.height();
if( y_excess > 0 ) {
display.scroll(-y_excess);
pos.y -= y_excess;
pos = { pos.x(), pos.y() - y_excess };
const Rect dirty { sr.left(), display.scroll_area_y(pos.y), sr.width(), line_height };
const Rect dirty { sr.left(), display.scroll_area_y(pos.y()), sr.width(), line_height };
display.fill_rectangle(dirty, s.background);
}
}

View File

@@ -54,7 +54,7 @@ void MenuItemView::paint(Painter& painter) {
);
painter.draw_string(
{ r.pos.x + 8, r.pos.y + (r.size.h - font_height) / 2 },
{ r.pos.x() + 8, r.pos.y() + (r.size.h - font_height) / 2 },
paint_style,
item.text
);

View File

@@ -92,8 +92,8 @@ void TouchCalibrationView::set_phase(const Phase value) {
uint32_t TouchCalibrationView::distance_squared(const Point& touch_point, const Image& target) {
const auto target_point = target.screen_rect().center();
const int32_t dx = target_point.x - touch_point.x;
const int32_t dy = target_point.y - touch_point.y;
const int32_t dx = target_point.x() - touch_point.x();
const int32_t dy = target_point.y() - touch_point.y();
const uint32_t dx2 = dx * dx;
const uint32_t dy2 = dy * dy;
return dx2 + dy2;