mirror of
https://github.com/HarbourMasters/Shipwright
synced 2026-08-27 08:47:30 -04:00
22426a8127
Reaching the Fast3d GUI is spelled out in full at every call site:
std::dynamic_pointer_cast<Fast::Fast3dGui>(
Ship::Context::GetRawInstance()->GetWindow()->GetGui())->GetTextureByName(name)
Each one locks the Context weak_ptr, copies a shared_ptr for the window
and one for the GUI, then runs a dynamic_cast, only to drop all three
again. InputViewer::DrawElement does that 43 times per frame, and the
item tracker and save editor repeat it once per icon drawn.
Binding it to a local once per scope leaves the behaviour identical and
reads better. The local goes in the innermost block that covers the call
sites, so it stays behind the guards that were already there: DrawElement
still resolves nothing when the input viewer is off.
RenderButton keeps its inline casts. Its two call sites are in exclusive
branches, so a local would add a cast on the path that takes neither.