From 3526bd42e330573c0c91ab62b59a0abe0502d27e Mon Sep 17 00:00:00 2001 From: Charles Dang Date: Thu, 25 May 2023 00:24:55 -0400 Subject: [PATCH] Cleaned up some cases of unnecessary manual scaling The passed react already compensates for zoom (its dimensions are the modified hex sizes). We don't need to manually scale to zoom. --- src/arrow.cpp | 5 ++--- src/editor/editor_display.cpp | 4 ++-- src/whiteboard/attack.cpp | 15 ++++++--------- src/whiteboard/suppose_dead.cpp | 8 +++----- 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/arrow.cpp b/src/arrow.cpp index 5b8e408e15d..7c04f294807 100644 --- a/src/arrow.cpp +++ b/src/arrow.cpp @@ -140,9 +140,8 @@ bool arrow::path_contains(const map_location& hex) const void arrow::draw_hex(const map_location& hex) { if(path_contains(hex)) { - display* disp = display::get_singleton(); - disp->drawing_buffer_add(layer_, hex, [disp, tex = image::get_texture(symbols_map_[hex])](const rect& dest) { - draw::blit(tex, disp->scaled_to_zoom({dest.x, dest.y, tex.w(), tex.h()})); + display::get_singleton()->drawing_buffer_add(layer_, hex, [tex = image::get_texture(symbols_map_[hex])](const rect& dest) { + draw::blit(tex, dest); }); } } diff --git a/src/editor/editor_display.cpp b/src/editor/editor_display.cpp index ab927c1d249..67451c19413 100644 --- a/src/editor/editor_display.cpp +++ b/src/editor/editor_display.cpp @@ -82,14 +82,14 @@ void editor_display::draw_hex(const map_location& loc) if(map().in_selection(loc)) { drawing_buffer_add(LAYER_FOG_SHROUD, loc, [tex = image::get_texture("editor/selection-overlay.png", image::TOD_COLORED)](const rect& d) { - draw::blit(tex, scaled_to_zoom({d.x, d.y, tex.w(), tex.h()})); + draw::blit(tex, d); }); } if(brush_locations_.find(loc) != brush_locations_.end()) { static const image::locator brush(game_config::images::editor_brush); drawing_buffer_add(LAYER_SELECTED_HEX, loc, [tex = image::get_texture(brush, image::HEXED)](const rect& d) { - draw::blit(tex, scaled_to_zoom({d.x, d.y, tex.w(), tex.h()})); + draw::blit(tex, d); }); } diff --git a/src/whiteboard/attack.cpp b/src/whiteboard/attack.cpp index c5f7a2e7286..af7f65ea7ae 100644 --- a/src/whiteboard/attack.cpp +++ b/src/whiteboard/attack.cpp @@ -213,20 +213,17 @@ void attack::draw_hex(const map_location& hex) if (hex == get_dest_hex()) //add symbol to attacker hex { - auto disp = display::get_singleton(); - disp->drawing_buffer_add(layer, get_dest_hex(), - [=, tex = image::get_texture("whiteboard/attack-indicator-src-" + direction_text + ".png", image::HEXED)](const rect& d) { - draw::blit(tex, disp->scaled_to_zoom({d.x, d.y, tex.w(), tex.h()})); + display::get_singleton()->drawing_buffer_add(layer, get_dest_hex(), + [tex = image::get_texture("whiteboard/attack-indicator-src-" + direction_text + ".png", image::HEXED)](const rect& d) { + draw::blit(tex, d); }); } else if (hex == target_hex_) //add symbol to defender hex { - auto disp = display::get_singleton(); - - disp->drawing_buffer_add(layer, target_hex_, - [=, tex = image::get_texture("whiteboard/attack-indicator-dst-" + direction_text + ".png", image::HEXED)](const rect& d) { - draw::blit(tex, disp->scaled_to_zoom({d.x, d.y, tex.w(), tex.h()})); + display::get_singleton()->drawing_buffer_add(layer, target_hex_, + [tex = image::get_texture("whiteboard/attack-indicator-dst-" + direction_text + ".png", image::HEXED)](const rect& d) { + draw::blit(tex, d); }); } } diff --git a/src/whiteboard/suppose_dead.cpp b/src/whiteboard/suppose_dead.cpp index 25e86b65d00..c9a1369a5c0 100644 --- a/src/whiteboard/suppose_dead.cpp +++ b/src/whiteboard/suppose_dead.cpp @@ -144,11 +144,9 @@ void suppose_dead::draw_hex(const map_location& hex) //@todo: Possibly use a different layer const display::drawing_layer layer = display::LAYER_ARROWS; - auto disp = display::get_singleton(); - - disp->drawing_buffer_add( - layer, loc_, [=, tex = image::get_texture("whiteboard/suppose_dead.png", image::HEXED)](const rect& d) { - draw::blit(tex, disp->scaled_to_zoom({d.x, d.y, tex.w(), tex.h()})); + display::get_singleton()->drawing_buffer_add( + layer, loc_, [tex = image::get_texture("whiteboard/suppose_dead.png", image::HEXED)](const rect& d) { + draw::blit(tex, d); }); }