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

Method Prepare

libs/drape_frontend/line_shape.cpp:457–510  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

455}
456
457void LineShape::Prepare(ref_ptr<dp::TextureManager> textures) const
458{
459 auto commonParamsBuilder = [this, textures](BaseBuilderParams & p)
460 {
461 dp::TextureManager::ColorRegion colorRegion;
462 textures->GetColorRegion(m_params.m_color, colorRegion);
463
464 p.m_cap = m_params.m_cap;
465 p.m_color = colorRegion;
466 p.m_depthTestEnabled = m_params.m_depthTestEnabled;
467 p.m_depth = m_params.m_depth;
468 p.m_depthLayer = m_params.m_depthLayer;
469 p.m_join = m_params.m_join;
470 p.m_pxHalfWidth = m_params.m_width / 2;
471 };
472
473 if (m_params.m_pattern.empty())
474 {
475 int lineWidth = 1;
476 m_isSimple = CanBeSimplified(lineWidth);
477 if (m_isSimple)
478 {
479 SimpleSolidLineBuilder::BuilderParams p;
480 commonParamsBuilder(p);
481
482 auto builder = std::make_unique<SimpleSolidLineBuilder>(p, m_spline->GetPath().size(), lineWidth);
483 Construct<SimpleSolidLineBuilder>(*builder);
484 m_lineShapeInfo = std::move(builder);
485 }
486 else
487 {
488 SolidLineBuilder::BuilderParams p;
489 commonParamsBuilder(p);
490
491 auto builder = std::make_unique<SolidLineBuilder>(p, m_spline->GetPath().size());
492 Construct<SolidLineBuilder>(*builder);
493 m_lineShapeInfo = std::move(builder);
494 }
495 }
496 else
497 {
498 dp::TextureManager::StippleRegion maskRegion;
499 textures->GetStippleRegion(m_params.m_pattern, maskRegion);
500
501 DashedLineBuilder::BuilderParams p;
502 commonParamsBuilder(p);
503 p.m_stipple = maskRegion;
504 p.m_baseGtoP = static_cast<float>(m_params.m_baseGtoPScale);
505
506 auto builder = std::make_unique<DashedLineBuilder>(p, m_spline->GetPath().size());
507 Construct<DashedLineBuilder>(*builder);
508 m_lineShapeInfo = std::move(builder);
509 }
510}
511
512void LineShape::Draw(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::Batcher> batcher,
513 ref_ptr<dp::TextureManager> textures) const

Callers 3

~RuleDrawerMethod · 0.45
operator()Method · 0.45
DrawTileNetMethod · 0.45

Calls 5

GetColorRegionMethod · 0.80
GetStippleRegionMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45
GetPathMethod · 0.45

Tested by

no test coverage detected