Files
Shipwright/soh
David Racine 22426a8127 Resolve the Fast3dGui cast once per scope instead of per call (#7095)
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.
2026-08-20 17:56:41 +00:00
..
2024-02-01 23:11:31 -06:00
2025-02-04 10:48:41 +01:00
2024-10-31 07:42:27 -07:00
2022-07-14 20:47:48 -04:00
2022-07-25 21:11:53 -04:00
2025-04-01 22:33:38 -04:00