mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-16 18:17:04 +00:00
Rename rect::pos() to origin()
This commit is contained in:
parent
5ab73a51fd
commit
ec7679d07f
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user