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

Method PackGlyph

libs/drape/font_texture.cpp:14–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12GlyphPacker::GlyphPacker(m2::PointU const & size) : m_size(size) {}
13
14bool GlyphPacker::PackGlyph(uint32_t width, uint32_t height, m2::RectU & rect)
15{
16 ASSERT_LESS(width, m_size.x, ());
17 ASSERT_LESS(height, m_size.y, ());
18
19 if (m_cursor.x + width > m_size.x)
20 {
21 m_cursor.x = 0;
22 m_cursor.y += m_yStep;
23 m_yStep = 0;
24 }
25
26 if (m_cursor.y + height > m_size.y)
27 {
28 m_isFull = true;
29 return false;
30 }
31
32 rect = m2::RectU(m_cursor.x, m_cursor.y, m_cursor.x + width, m_cursor.y + height);
33
34 m_cursor.x += width;
35 m_yStep = std::max(height, m_yStep);
36 return true;
37}
38
39bool GlyphPacker::CanBePacked(uint32_t glyphsCount, uint32_t width, uint32_t height) const
40{

Callers 2

MapResourceMethod · 0.80
UNIT_TESTFunction · 0.80

Calls

no outgoing calls

Tested by 1

UNIT_TESTFunction · 0.64