diff --git a/src/display.cpp b/src/display.cpp index 26ad59b2108..62bd1200075 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -642,7 +642,7 @@ const display::rect_of_hexes display::hexes_under_rect(const rect& r) const } // translate rect coordinates from screen-based to map_area-based - auto [x, y] = viewport_origin_ - map_area().pos() + r.pos(); + auto [x, y] = viewport_origin_ - map_area().origin() + r.origin(); // we use the "double" type to avoid important rounding error (size of an hex!) // we will also need to use std::floor to avoid bad rounding at border (negative values) double tile_width = hex_width(); diff --git a/src/sdl/rect.hpp b/src/sdl/rect.hpp index 803e2490060..a530cc8752c 100644 --- a/src/sdl/rect.hpp +++ b/src/sdl/rect.hpp @@ -61,7 +61,7 @@ public: {} // subcomponent access - constexpr point pos() const { return {x, y}; } + constexpr point origin() const { return {x, y}; } constexpr point size() const { return {w, h}; } // Comparisons diff --git a/src/video.cpp b/src/video.cpp index 1b3fd7d2095..8c6233149ba 100644 --- a/src/video.cpp +++ b/src/video.cpp @@ -315,12 +315,12 @@ bool update_framebuffer() rect active_area = to_output(draw_area()); if (active_area.size() != osize) { - LOG_DP << "render target offset: LT " << active_area.pos() << " RB " - << osize - active_area.size() - active_area.pos(); + LOG_DP << "render target offset: LT " << active_area.origin() << " RB " + << osize - active_area.size() - active_area.origin(); // Translate active_area into display coordinates as input_area_ input_area_ = { - (active_area.pos() * wsize) / osize, - (active_area.size() * wsize) / osize + (active_area.origin() * wsize) / osize, + (active_area.origin() * wsize) / osize }; LOG_DP << "input area: " << input_area_; } @@ -468,7 +468,7 @@ rect to_output(const rect& r) // Multiply r by integer scale, adding draw_offset to the position. point dsize = current_render_target_.draw_size(); point osize = current_render_target_.get_raw_size(); - point pos = (r.pos() * (osize / dsize)) + draw_offset(); + point pos = (r.origin() * (osize / dsize)) + draw_offset(); point size = r.size() * (osize / dsize); return {pos, size}; }