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

Method InitStipplePen

libs/drape/texture_manager.cpp:368–402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

366}
367
368void TextureManager::InitStipplePen(Params const & params)
369{
370 // Initialize patterns (reserved ./data/patterns.txt lines count).
371 std::set<PenPatternT> patterns;
372 uint32_t rowsCount = 0;
373
374 impl::ParsePatternsList(params.m_patterns, [&](buffer_vector<double, 8> const & pattern)
375 {
376 PenPatternT toAdd;
377 for (double d : pattern)
378 toAdd.push_back(PatternFloat2Pixel(d * params.m_visualScale));
379
380 if (!patterns.insert(toAdd).second)
381 return;
382
383 if (IsTrianglePattern(toAdd))
384 {
385 rowsCount = rowsCount + toAdd[2] + toAdd[3];
386 }
387 else
388 {
389 ASSERT_EQUAL(toAdd.size(), 2, ());
390 ++rowsCount;
391 }
392 });
393
394 m_stipplePenTexture = make_unique_dp<StipplePenTexture>(StipplePenTextureSize(rowsCount, m_maxTextureSize),
395 make_ref(m_textureAllocator));
396
397 LOG(LDEBUG, ("Patterns texture size =", m_stipplePenTexture->GetWidth(), m_stipplePenTexture->GetHeight()));
398
399 ref_ptr<StipplePenTexture> stipplePenTex = make_ref(m_stipplePenTexture);
400 for (auto const & p : patterns)
401 stipplePenTex->ReservePattern(p);
402}
403
404void TextureManager::OnSwitchMapStyle(ref_ptr<dp::GraphicsContext> context)
405{

Callers

nothing calls this directly

Calls 11

ParsePatternsListFunction · 0.85
PatternFloat2PixelFunction · 0.85
IsTrianglePatternFunction · 0.85
StipplePenTextureSizeFunction · 0.85
make_refFunction · 0.85
ReservePatternMethod · 0.80
push_backMethod · 0.45
insertMethod · 0.45
sizeMethod · 0.45
GetWidthMethod · 0.45
GetHeightMethod · 0.45

Tested by

no test coverage detected