mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 13:03:36 +00:00
Format all C++ and Java code via clang-format
Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
@@ -12,9 +12,7 @@
|
||||
|
||||
namespace dp
|
||||
{
|
||||
GlyphPacker::GlyphPacker(const m2::PointU & size)
|
||||
: m_size(size)
|
||||
{}
|
||||
GlyphPacker::GlyphPacker(m2::PointU const & size) : m_size(size) {}
|
||||
|
||||
bool GlyphPacker::PackGlyph(uint32_t width, uint32_t height, m2::RectU & rect)
|
||||
{
|
||||
@@ -34,8 +32,7 @@ bool GlyphPacker::PackGlyph(uint32_t width, uint32_t height, m2::RectU & rect)
|
||||
return false;
|
||||
}
|
||||
|
||||
rect = m2::RectU(m_cursor.x, m_cursor.y,
|
||||
m_cursor.x + width, m_cursor.y + height);
|
||||
rect = m2::RectU(m_cursor.x, m_cursor.y, m_cursor.x + width, m_cursor.y + height);
|
||||
|
||||
m_cursor.x += width;
|
||||
m_yStep = std::max(height, m_yStep);
|
||||
@@ -64,7 +61,7 @@ bool GlyphPacker::CanBePacked(uint32_t glyphsCount, uint32_t width, uint32_t hei
|
||||
return true;
|
||||
}
|
||||
|
||||
m2::RectF GlyphPacker::MapTextureCoords(const m2::RectU & pixelRect) const
|
||||
m2::RectF GlyphPacker::MapTextureCoords(m2::RectU const & pixelRect) const
|
||||
{
|
||||
auto const width = static_cast<float>(m_size.x);
|
||||
auto const height = static_cast<float>(m_size.y);
|
||||
@@ -74,17 +71,16 @@ m2::RectF GlyphPacker::MapTextureCoords(const m2::RectU & pixelRect) const
|
||||
if (pixelRect.SizeX() != 0 && pixelRect.SizeY() != 0)
|
||||
offset = 0.5f;
|
||||
|
||||
return {(pixelRect.minX() + offset) / width,
|
||||
(pixelRect.minY() + offset) / height,
|
||||
(pixelRect.maxX() - offset) / width,
|
||||
(pixelRect.maxY() - offset) / height};
|
||||
return {(pixelRect.minX() + offset) / width, (pixelRect.minY() + offset) / height,
|
||||
(pixelRect.maxX() - offset) / width, (pixelRect.maxY() - offset) / height};
|
||||
}
|
||||
|
||||
bool GlyphPacker::IsFull() const { return m_isFull; }
|
||||
bool GlyphPacker::IsFull() const
|
||||
{
|
||||
return m_isFull;
|
||||
}
|
||||
|
||||
GlyphIndex::GlyphIndex(m2::PointU const & size, ref_ptr<GlyphManager> mng)
|
||||
: m_packer(size)
|
||||
, m_mng(mng)
|
||||
GlyphIndex::GlyphIndex(m2::PointU const & size, ref_ptr<GlyphManager> mng) : m_packer(size), m_mng(mng)
|
||||
{
|
||||
ASSERT(m_mng != nullptr, ());
|
||||
}
|
||||
@@ -97,8 +93,7 @@ GlyphIndex::~GlyphIndex()
|
||||
m_pendingNodes.clear();
|
||||
}
|
||||
|
||||
std::vector<ref_ptr<Texture::ResourceInfo>> GlyphIndex::MapResources(TGlyphs const & keys,
|
||||
bool & hasNewResources)
|
||||
std::vector<ref_ptr<Texture::ResourceInfo>> GlyphIndex::MapResources(TGlyphs const & keys, bool & hasNewResources)
|
||||
{
|
||||
std::vector<ref_ptr<Texture::ResourceInfo>> info;
|
||||
info.reserve(keys.size());
|
||||
@@ -130,9 +125,8 @@ ref_ptr<Texture::ResourceInfo> GlyphIndex::MapResource(GlyphFontAndId const & ke
|
||||
{
|
||||
glyphImage.Destroy();
|
||||
|
||||
LOG(LWARNING, ("Glyphs packer could not pack a glyph with fontIndex =", key.m_fontIndex,
|
||||
"glyphId =", key.m_glyphId, "w =", glyphImage.m_width, "h =", glyphImage.m_height,
|
||||
"packerSize =", m_packer.GetSize()));
|
||||
LOG(LWARNING, ("Glyphs packer could not pack a glyph with fontIndex =", key.m_fontIndex, "glyphId =", key.m_glyphId,
|
||||
"w =", glyphImage.m_width, "h =", glyphImage.m_height, "packerSize =", m_packer.GetSize()));
|
||||
|
||||
// TODO(AB): Is it a valid invalid glyph?
|
||||
GlyphFontAndId constexpr kInvalidGlyphKey{0, 0};
|
||||
|
||||
Reference in New Issue
Block a user