Remove a lot of static_cast<>s involving UI structs.

Also starting to get religion on using unsigned integers only when I want their wrapping/modulus behavior.
This commit is contained in:
Jared Boone 2016-11-29 10:13:56 -08:00
parent 4c8550bb7d
commit 3f94591083
11 changed files with 28 additions and 76 deletions

View file

@ -36,28 +36,19 @@ void Channel::paint(Painter& painter) {
const range_t<int> x_max_range { 0, r.width() - 1 };
const auto x_max = x_max_range.clip((max_db_ - db_min) * r.width() / db_delta);
const Rect r0 {
static_cast<ui::Coord>(r.left()), r.top(),
static_cast<ui::Dim>(x_max), r.height()
};
const Rect r0 { r.left(), r.top(), x_max, r.height() };
painter.fill_rectangle(
r0,
Color::blue()
);
const Rect r1 {
static_cast<ui::Coord>(r.left() + x_max), r.top(),
1, r.height()
};
const Rect r1 { r.left() + x_max, r.top(), 1, r.height() };
painter.fill_rectangle(
r1,
Color::white()
);
const Rect r2 {
static_cast<ui::Coord>(r.left() + x_max + 1), r.top(),
static_cast<ui::Dim>(r.width() - (x_max + 1)), r.height()
};
const Rect r2 { r.left() + x_max + 1, r.top(), r.width() - (x_max + 1), r.height() };
painter.fill_rectangle(
r2,
Color::black()