diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-02-24 10:54:58 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-02-24 11:00:57 +0100 |
commit | 321b394c397f826dbbda6e617aece10e732daadc (patch) | |
tree | 224da7e085ced9773ab86128b9249a01c7186623 /main/draw.cpp | |
parent | e9311fe8a12d7834b0d910edd65eacc5e732a0ff (diff) |
fix (?) wrong global_coords unsigned offset
Diffstat (limited to 'main/draw.cpp')
-rw-r--r-- | main/draw.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/main/draw.cpp b/main/draw.cpp index 1cb9b396..81dd7172 100644 --- a/main/draw.cpp +++ b/main/draw.cpp @@ -52,11 +52,16 @@ auto main_impl::get_draw_bounds() const noexcept -> draw_bounds using limits = std::numeric_limits<std::int16_t>; auto x0 = limits::max(), x1 = limits::min(), y0 = limits::max(), y1 = limits::min(); - for (const auto win = Vector2d(framebufferSize()); - auto p : {pixel_to_tile(Vector2d{0, 0}).chunk(), - pixel_to_tile(Vector2d{win[0]-1, 0}).chunk(), - pixel_to_tile(Vector2d{0, win[1]-1}).chunk(), - pixel_to_tile(Vector2d{win[0]-1, win[1]-1}).chunk()}) + const auto win = Vector2d(framebufferSize()); + + chunk_coords list[] = { + pixel_to_tile(Vector2d{0, 0}).chunk(), + pixel_to_tile(Vector2d{win[0]-1, 0}).chunk(), + pixel_to_tile(Vector2d{0, win[1]-1}).chunk(), + pixel_to_tile(Vector2d{win[0]-1, win[1]-1}).chunk(), + }; + + for (auto p : list) { x0 = std::min(x0, p.x); x1 = std::max(x1, p.x); |