| 12 | GlyphPacker::GlyphPacker(m2::PointU const & size) : m_size(size) {} |
| 13 | |
| 14 | bool 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 | |
| 39 | bool GlyphPacker::CanBePacked(uint32_t glyphsCount, uint32_t width, uint32_t height) const |
| 40 | { |
no outgoing calls