MCPcopy Create free account
hub / github.com/comaps/comaps / RecacheWidgets

Method RecacheWidgets

libs/drape_frontend/gui/layer_render.cpp:209–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

207} // namespace
208
209drape_ptr<LayerRenderer> LayerCacher::RecacheWidgets(ref_ptr<dp::GraphicsContext> context,
210 TWidgetsInitInfo const & initInfo,
211 ref_ptr<dp::TextureManager> textures)
212{
213 using TCacheShape = std::function<void(ref_ptr<dp::GraphicsContext>, Position anchor, ref_ptr<LayerRenderer> renderer,
214 ref_ptr<dp::TextureManager> textures)>;
215 static std::map<EWidget, TCacheShape> cacheFunctions{
216 {WIDGET_COMPASS, std::bind(&LayerCacher::CacheCompass, this, _1, _2, _3, _4)},
217 {WIDGET_RULER, std::bind(&LayerCacher::CacheRuler, this, _1, _2, _3, _4)},
218 {WIDGET_COPYRIGHT, std::bind(&LayerCacher::CacheCopyright, this, _1, _2, _3, _4)},
219 {WIDGET_SCALE_FPS_LABEL, std::bind(&LayerCacher::CacheScaleFpsLabel, this, _1, _2, _3, _4)},
220 };
221
222 drape_ptr<LayerRenderer> renderer = make_unique_dp<LayerRenderer>();
223 for (auto const & node : initInfo)
224 {
225 auto cacheFunction = cacheFunctions.find(node.first);
226 if (cacheFunction != cacheFunctions.end())
227 cacheFunction->second(context, node.second, make_ref(renderer), textures);
228 }
229
230 // Flush gui geometry.
231 context->Flush();
232
233 return renderer;
234}
235
236drape_ptr<LayerRenderer> LayerCacher::RecacheChoosePositionMark(ref_ptr<dp::GraphicsContext> context,
237 ref_ptr<dp::TextureManager> textures)

Callers 1

RecacheGuiMethod · 0.80

Calls 4

make_refFunction · 0.85
findMethod · 0.45
endMethod · 0.45
FlushMethod · 0.45

Tested by

no test coverage detected