| 298 | } |
| 299 | |
| 300 | void TextShape::DrawSubStringPlain(ref_ptr<dp::GraphicsContext> context, StraightTextLayout const & layout, |
| 301 | dp::FontDecl const & font, ref_ptr<dp::Batcher> batcher, |
| 302 | ref_ptr<dp::TextureManager> textures, bool isPrimary, bool isOptional) const |
| 303 | { |
| 304 | gpu::TTextStaticVertexBuffer staticBuffer; |
| 305 | gpu::TTextDynamicVertexBuffer dynamicBuffer; |
| 306 | |
| 307 | dp::TextureManager::ColorRegion color, outline; |
| 308 | textures->GetColorRegion(font.m_color, color); |
| 309 | textures->GetColorRegion(font.m_outlineColor, outline); |
| 310 | |
| 311 | auto const finalOffset = layout.GetTextOffset(m_symbolSizes.front(), m_params.m_titleDecl.m_anchor, m_symbolAnchor); |
| 312 | layout.CacheDynamicGeometry(finalOffset, dynamicBuffer); |
| 313 | |
| 314 | layout.CacheStaticGeometry(color, staticBuffer); |
| 315 | |
| 316 | auto state = CreateRenderState(gpu::Program::Text, m_params.m_depthLayer); |
| 317 | state.SetProgram3d(gpu::Program::TextBillboard); |
| 318 | state.SetDepthTestEnabled(m_params.m_depthTestEnabled); |
| 319 | |
| 320 | ASSERT(color.GetTexture() == outline.GetTexture(), ()); |
| 321 | state.SetColorTexture(color.GetTexture()); |
| 322 | state.SetMaskTexture(layout.GetMaskTexture()); |
| 323 | |
| 324 | gpu::TTextDynamicVertexBuffer initialDynBuffer(dynamicBuffer.size()); |
| 325 | |
| 326 | m2::PointF const & pixelSize = layout.GetPixelSize(); |
| 327 | |
| 328 | dp::OverlayID overlayId(m_params.m_featureId, m_params.m_markId, m_tileCoords, m_textIndex); |
| 329 | drape_ptr<StraightTextHandle> handle = make_unique_dp<StraightTextHandle>( |
| 330 | overlayId, layout.GetGlyphs(), m_params.m_titleDecl.m_anchor, glsl::ToVec2(m_basePoint), |
| 331 | glsl::vec2(pixelSize.x, pixelSize.y), finalOffset, GetOverlayPriority(), textures, isOptional, |
| 332 | std::move(dynamicBuffer), m_params.m_minVisibleScale, true); |
| 333 | if (m_symbolSizes.size() > 1) |
| 334 | handle->SetDynamicSymbolSizes(layout, m_symbolSizes, m_symbolAnchor); |
| 335 | handle->SetPivotZ(m_params.m_posZ); |
| 336 | |
| 337 | ASSERT_LESS(m_params.m_startOverlayRank + 1, dp::OverlayRanksCount, ()); |
| 338 | handle->SetOverlayRank(isPrimary ? m_params.m_startOverlayRank : m_params.m_startOverlayRank + 1); |
| 339 | |
| 340 | handle->SetExtendingSize(m_params.m_extendingSize); |
| 341 | if (m_params.m_specialDisplacement == SpecialDisplacement::UserMark || |
| 342 | m_params.m_specialDisplacement == SpecialDisplacement::SpecialModeUserMark) |
| 343 | { |
| 344 | handle->SetSpecialLayerOverlay(true); |
| 345 | } |
| 346 | |
| 347 | dp::AttributeProvider provider(2, static_cast<uint32_t>(staticBuffer.size())); |
| 348 | provider.InitStream(0, gpu::TextStaticVertex::GetBindingInfo(), make_ref(staticBuffer.data())); |
| 349 | provider.InitStream(1, gpu::TextDynamicVertex::GetBindingInfo(), make_ref(initialDynBuffer.data())); |
| 350 | batcher->InsertListOfStrip(context, state, make_ref(&provider), std::move(handle), 4); |
| 351 | } |
| 352 | |
| 353 | void TextShape::DrawSubStringOutlined(ref_ptr<dp::GraphicsContext> context, StraightTextLayout const & layout, |
| 354 | dp::FontDecl const & font, ref_ptr<dp::Batcher> batcher, |
nothing calls this directly
no test coverage detected