| 366 | } |
| 367 | |
| 368 | void 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 | |
| 404 | void TextureManager::OnSwitchMapStyle(ref_ptr<dp::GraphicsContext> context) |
| 405 | { |
nothing calls this directly
no test coverage detected