mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-01-11 15:29:28 -05:00
RegistersWidget: Fix type warnings.
This commit is contained in:
parent
74ecff13ad
commit
2033967dc6
@ -173,9 +173,9 @@ void RegistersWidget::paint(Painter& painter) {
|
||||
void RegistersWidget::draw_legend(const Coord left, Painter& painter) {
|
||||
const auto pos = screen_pos();
|
||||
|
||||
for(int i=0; i<config.registers_count; i+=config.registers_per_row()) {
|
||||
for(size_t i=0; i<config.registers_count; i+=config.registers_per_row()) {
|
||||
const Point offset {
|
||||
left, (i / config.registers_per_row()) * row_height
|
||||
left, static_cast<int>((i / config.registers_per_row()) * row_height)
|
||||
};
|
||||
|
||||
const auto text = to_string_hex(i, config.legend_length());
|
||||
@ -193,10 +193,10 @@ void RegistersWidget::draw_values(
|
||||
) {
|
||||
const auto pos = screen_pos();
|
||||
|
||||
for(int i=0; i<config.registers_count; i++) {
|
||||
for(size_t i=0; i<config.registers_count; i++) {
|
||||
const Point offset = {
|
||||
left + config.legend_width() + 8 + (i % config.registers_per_row()) * (config.value_width() + 8),
|
||||
(i / config.registers_per_row()) * row_height
|
||||
static_cast<int>(left + config.legend_width() + 8 + (i % config.registers_per_row()) * (config.value_width() + 8)),
|
||||
static_cast<int>((i / config.registers_per_row()) * row_height)
|
||||
};
|
||||
|
||||
const auto value = reader(i);
|
||||
|
@ -130,42 +130,42 @@ private:
|
||||
};
|
||||
|
||||
struct RegistersWidgetConfig {
|
||||
int registers_count;
|
||||
int register_bits;
|
||||
size_t registers_count;
|
||||
size_t register_bits;
|
||||
|
||||
constexpr int legend_length() const {
|
||||
constexpr size_t legend_length() const {
|
||||
return (registers_count >= 0x10) ? 2 : 1;
|
||||
}
|
||||
|
||||
constexpr int legend_width() const {
|
||||
constexpr size_t legend_width() const {
|
||||
return legend_length() * 8;
|
||||
}
|
||||
|
||||
constexpr int value_length() const {
|
||||
constexpr size_t value_length() const {
|
||||
return (register_bits + 3) / 4;
|
||||
}
|
||||
|
||||
constexpr int value_width() const {
|
||||
constexpr size_t value_width() const {
|
||||
return value_length() * 8;
|
||||
}
|
||||
|
||||
constexpr int registers_per_row() const {
|
||||
constexpr size_t registers_per_row() const {
|
||||
return (value_length() >= 3) ? 4 : 8;
|
||||
}
|
||||
|
||||
constexpr int registers_row_length() const {
|
||||
constexpr size_t registers_row_length() const {
|
||||
return (registers_per_row() * (value_length() + 1)) - 1;
|
||||
}
|
||||
|
||||
constexpr int registers_row_width() const {
|
||||
constexpr size_t registers_row_width() const {
|
||||
return registers_row_length() * 8;
|
||||
}
|
||||
|
||||
constexpr int row_width() const {
|
||||
constexpr size_t row_width() const {
|
||||
return legend_width() + 8 + registers_row_width();
|
||||
}
|
||||
|
||||
constexpr int rows() const {
|
||||
constexpr size_t rows() const {
|
||||
return registers_count / registers_per_row();
|
||||
}
|
||||
};
|
||||
@ -185,7 +185,7 @@ private:
|
||||
const RegistersWidgetConfig config;
|
||||
const std::function<uint32_t(const size_t register_number)> reader;
|
||||
|
||||
static constexpr int row_height = 16;
|
||||
static constexpr size_t row_height = 16;
|
||||
|
||||
void draw_legend(const Coord left, Painter& painter);
|
||||
void draw_values(const Coord left, Painter& painter);
|
||||
|
Loading…
Reference in New Issue
Block a user