| 226 | } |
| 227 | |
| 228 | static HTextLayout GetOrCreateCachedTextLayout(HRenderProfile render_profile, dmRender::HFontMap font_map, const char* text, const dmRender::DrawTextParams& params) |
| 229 | { |
| 230 | const char* safe_text = text ? text : ""; |
| 231 | uint64_t text_hash = dmHashBufferNoReverse64(safe_text, (uint32_t)strlen(safe_text)); |
| 232 | |
| 233 | HTextLayout* cached_layout = render_profile->m_LabelTextLayouts.Get(text_hash); |
| 234 | if (cached_layout) |
| 235 | return *cached_layout; |
| 236 | |
| 237 | HTextLayout layout = 0; |
| 238 | if (!CreateProfilerTextLayout(render_profile, font_map, safe_text, params, &layout)) |
| 239 | return 0; |
| 240 | |
| 241 | if (render_profile->m_LabelTextLayouts.Full()) |
| 242 | render_profile->m_LabelTextLayouts.OffsetCapacity(64); |
| 243 | render_profile->m_LabelTextLayouts.Put(text_hash, layout); |
| 244 | return layout; |
| 245 | } |
| 246 | |
| 247 | static void DrawProfilerTextCached(HRenderProfile render_profile, dmRender::HRenderContext render_context, dmRender::HFontMap font_map, uint64_t batch_key, const dmRender::DrawTextParams& params, const char* text) |
| 248 | { |
no test coverage detected