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

Method GetPixelShape

libs/drape_frontend/path_text_handle.cpp:310–340  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

308}
309
310void PathTextHandle::GetPixelShape(ScreenBase const & screen, bool perspective, Rects & rects) const
311{
312 m2::PointD const pixelPivot(screen.GtoP(m_globalPivot));
313 for (size_t quadIndex = 0; quadIndex < m_buffer.size(); quadIndex += 4)
314 {
315 m2::RectF r;
316 r.Add(m2::PointF(pixelPivot) + glsl::ToPoint(m_buffer[quadIndex].m_normal));
317 r.Add(m2::PointF(pixelPivot) + glsl::ToPoint(m_buffer[quadIndex + 1].m_normal));
318 r.Add(m2::PointF(pixelPivot) + glsl::ToPoint(m_buffer[quadIndex + 2].m_normal));
319 r.Add(m2::PointF(pixelPivot) + glsl::ToPoint(m_buffer[quadIndex + 3].m_normal));
320
321 if (perspective)
322 {
323 if (IsBillboard())
324 {
325 m2::PointD const pxPivotPerspective = screen.PtoP3d(pixelPivot);
326
327 r.Offset(m2::PointF(-pixelPivot));
328 r.Offset(m2::PointF(pxPivotPerspective));
329 }
330 else
331 {
332 r = m2::RectF(GetPerspectiveRect(m2::RectD(r), screen));
333 }
334 }
335
336 bool const needAddRect = perspective ? !screen.IsReverseProjection3d(m2::PointD(r.Center())) : true;
337 if (needAddRect)
338 rects.emplace_back(std::move(r));
339 }
340}
341
342void PathTextHandle::GetAttributeMutation(ref_ptr<dp::AttributeBufferMutator> mutator) const
343{

Callers

nothing calls this directly

Calls 9

ToPointFunction · 0.85
PtoP3dMethod · 0.80
IsReverseProjection3dMethod · 0.80
GtoPMethod · 0.45
sizeMethod · 0.45
AddMethod · 0.45
OffsetMethod · 0.45
CenterMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected