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

@ -38,37 +38,25 @@ void Audio::paint(Painter& painter) {
const range_t<int> x_max_range { x_rms + 1, r.width() };
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_rms), r.height()
};
const Rect r0 { r.left(), r.top(), x_rms, r.height() };
painter.fill_rectangle(
r0,
Color::green()
);
const Rect r1 {
static_cast<ui::Coord>(r.left() + x_rms), r.top(),
1, r.height()
};
const Rect r1 { r.left() + x_rms, r.top(), 1, r.height() };
painter.fill_rectangle(
r1,
Color::black()
);
const Rect r2 {
static_cast<ui::Coord>(r.left() + x_rms + 1), r.top(),
static_cast<ui::Dim>(x_max - (x_rms + 1)), r.height()
};
const Rect r2 { r.left() + x_rms + 1, r.top(), x_max - (x_rms + 1), r.height() };
painter.fill_rectangle(
r2,
Color::red()
);
const Rect r3 {
static_cast<ui::Coord>(r.left() + x_max), r.top(),
static_cast<ui::Dim>(r.width() - x_max), r.height()
};
const Rect r3 { r.left() + x_max, r.top(), r.width() - x_max, r.height() };
painter.fill_rectangle(
r3,
Color::black()