| 250 | } |
| 251 | |
| 252 | void GenerateTextShapes(ref_ptr<dp::GraphicsContext> context, ref_ptr<dp::TextureManager> textures, |
| 253 | UserMarkRenderParams const & renderInfo, TileKey const & tileKey, m2::PointD const & tileCenter, |
| 254 | m2::PointF const & symbolOffset, m2::PointF const & symbolSize, dp::Batcher & batcher) |
| 255 | { |
| 256 | if (renderInfo.m_minTitleZoom > tileKey.m_zoomLevel) |
| 257 | return; |
| 258 | |
| 259 | auto const vs = static_cast<float>(df::VisualParams::Instance().GetVisualScale()); |
| 260 | |
| 261 | for (auto const & titleDecl : *renderInfo.m_titleDecl) |
| 262 | { |
| 263 | if (titleDecl.m_primaryText.empty()) |
| 264 | continue; |
| 265 | |
| 266 | TextViewParams params; |
| 267 | params.m_featureId = renderInfo.m_featureId; |
| 268 | params.m_markId = renderInfo.m_markId; |
| 269 | params.m_tileCenter = tileCenter; |
| 270 | params.m_titleDecl = titleDecl; |
| 271 | |
| 272 | // Here we use visual scale to adapt texts sizes and offsets |
| 273 | // to different screen resolutions and DPI. |
| 274 | params.m_titleDecl.m_primaryTextFont.m_size *= vs; |
| 275 | params.m_titleDecl.m_secondaryTextFont.m_size *= vs; |
| 276 | params.m_titleDecl.m_primaryOffset *= vs; |
| 277 | params.m_titleDecl.m_secondaryOffset *= vs; |
| 278 | |
| 279 | params.m_depthTestEnabled = renderInfo.m_depthTestEnabled; |
| 280 | params.m_depth = renderInfo.m_depth; |
| 281 | params.m_depthLayer = renderInfo.m_depthLayer; |
| 282 | params.m_minVisibleScale = renderInfo.m_minZoom; |
| 283 | |
| 284 | uint32_t const overlayIndex = kStartUserMarkOverlayIndex + renderInfo.m_index; |
| 285 | if (renderInfo.m_hasTitlePriority) |
| 286 | { |
| 287 | params.m_specialDisplacement = renderInfo.m_displacement; |
| 288 | params.m_specialPriority = renderInfo.m_priority; |
| 289 | params.m_startOverlayRank = dp::OverlayRank0; |
| 290 | |
| 291 | if (renderInfo.m_symbolNames != nullptr && renderInfo.m_symbolIsPOI) |
| 292 | params.m_startOverlayRank++; |
| 293 | |
| 294 | if (renderInfo.m_coloredSymbols != nullptr && renderInfo.m_coloredSymbols->m_needOverlay) |
| 295 | params.m_startOverlayRank++; |
| 296 | |
| 297 | ASSERT_LESS(params.m_startOverlayRank, dp::OverlayRanksCount, ()); |
| 298 | } |
| 299 | |
| 300 | if (renderInfo.m_symbolSizes != nullptr) |
| 301 | { |
| 302 | TextShape(renderInfo.m_pivot, params, tileKey, *renderInfo.m_symbolSizes, |
| 303 | m2::PointF(0.0f, 0.0f) /* symbolOffset */, renderInfo.m_anchor, overlayIndex) |
| 304 | .Draw(context, &batcher, textures); |
| 305 | } |
| 306 | else |
| 307 | { |
| 308 | TextShape(renderInfo.m_pivot, params, tileKey, symbolSize, symbolOffset, renderInfo.m_anchor, overlayIndex) |
| 309 | .Draw(context, &batcher, textures); |
no test coverage detected