mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-08 05:17:56 +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:
@@ -9,28 +9,26 @@
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
|
||||
#include <QtXml/QDomElement>
|
||||
#include <QtXml/QDomDocument>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtXml/QDomDocument>
|
||||
#include <QtXml/QDomElement>
|
||||
|
||||
namespace tools
|
||||
{
|
||||
namespace
|
||||
{
|
||||
|
||||
static constexpr double kLargeIconSize = 24.0; // Size of the -l SVG icons
|
||||
static constexpr double kMediumIconSize = 18.0; // size of the -m SVG icons
|
||||
static constexpr double kLargeIconSize = 24.0; // Size of the -l SVG icons
|
||||
static constexpr double kMediumIconSize = 18.0; // size of the -m SVG icons
|
||||
|
||||
struct GreaterHeight
|
||||
{
|
||||
bool operator() (SkinGenerator::SymbolInfo const & left,
|
||||
SkinGenerator::SymbolInfo const & right) const
|
||||
bool operator()(SkinGenerator::SymbolInfo const & left, SkinGenerator::SymbolInfo const & right) const
|
||||
{
|
||||
QString symbolIDleft = left.m_fullFileName.left(left.m_fullFileName.lastIndexOf("."));
|
||||
QString symbolIDright = right.m_fullFileName.left(right.m_fullFileName.lastIndexOf("."));
|
||||
if (left.m_size.height() == right.m_size.height()) {
|
||||
if (left.m_size.height() == right.m_size.height())
|
||||
return symbolIDleft > symbolIDright;
|
||||
}
|
||||
return (left.m_size.height() > right.m_size.height());
|
||||
}
|
||||
};
|
||||
@@ -40,8 +38,7 @@ struct MaxDimensions
|
||||
uint32_t & m_width;
|
||||
uint32_t & m_height;
|
||||
|
||||
MaxDimensions(uint32_t & width, uint32_t & height)
|
||||
: m_width(width), m_height(height)
|
||||
MaxDimensions(uint32_t & width, uint32_t & height) : m_width(width), m_height(height)
|
||||
{
|
||||
m_width = 0;
|
||||
m_height = 0;
|
||||
@@ -65,12 +62,10 @@ uint32_t NextPowerOf2(uint32_t n)
|
||||
|
||||
return n + 1;
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void SkinGenerator::ProcessSymbols(std::string const & svgDataDir,
|
||||
std::string const & skinName,
|
||||
std::vector<QSize> const & symbolSizes,
|
||||
std::vector<std::string> const & suffixes)
|
||||
void SkinGenerator::ProcessSymbols(std::string const & svgDataDir, std::string const & skinName,
|
||||
std::vector<QSize> const & symbolSizes, std::vector<std::string> const & suffixes)
|
||||
{
|
||||
for (size_t j = 0; j < symbolSizes.size(); ++j)
|
||||
{
|
||||
@@ -97,7 +92,7 @@ void SkinGenerator::ProcessSymbols(std::string const & svgDataDir,
|
||||
QString fullFileName = QString(dir.absolutePath()) + "/" + fileName;
|
||||
if (m_svgRenderer.load(fullFileName))
|
||||
{
|
||||
QSize svgSize = m_svgRenderer.defaultSize(); // Size of the SVG file
|
||||
QSize svgSize = m_svgRenderer.defaultSize(); // Size of the SVG file
|
||||
|
||||
// Capping svg symbol to kLargeIconSize maximum, keeping aspect ratio
|
||||
/*if (svgSize.width() > kLargeIconSize)
|
||||
@@ -153,8 +148,8 @@ bool SkinGenerator::RenderPages(uint32_t maxSize)
|
||||
|
||||
for (auto & s : page.m_symbols)
|
||||
{
|
||||
s.m_handle = page.m_packer.pack(static_cast<uint32_t>(s.m_size.width()),
|
||||
static_cast<uint32_t>(s.m_size.height()));
|
||||
s.m_handle =
|
||||
page.m_packer.pack(static_cast<uint32_t>(s.m_size.width()), static_cast<uint32_t>(s.m_size.height()));
|
||||
if (m_overflowDetected)
|
||||
break;
|
||||
}
|
||||
@@ -221,7 +216,7 @@ void SkinGenerator::MarkOverflow()
|
||||
m_overflowDetected = true;
|
||||
}
|
||||
|
||||
bool SkinGenerator::WriteToFileNewStyle(std::string const &skinName)
|
||||
bool SkinGenerator::WriteToFileNewStyle(std::string const & skinName)
|
||||
{
|
||||
QDomDocument doc = QDomDocument("skin");
|
||||
QDomElement rootElem = doc.createElement("root");
|
||||
@@ -254,4 +249,4 @@ bool SkinGenerator::WriteToFileNewStyle(std::string const &skinName)
|
||||
ts << doc.toString();
|
||||
return true;
|
||||
}
|
||||
} // namespace tools
|
||||
} // namespace tools
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include "geometry/rect2d.hpp"
|
||||
#include "geometry/packer.hpp"
|
||||
#include "geometry/rect2d.hpp"
|
||||
|
||||
#include "coding/writer.hpp"
|
||||
|
||||
#include "base/base.hpp"
|
||||
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QImage>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QSize>
|
||||
#include <QtGui/QImage>
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtSvg/QSvgRenderer>
|
||||
|
||||
#include <cstdint>
|
||||
@@ -35,7 +35,9 @@ public:
|
||||
|
||||
SymbolInfo() {}
|
||||
SymbolInfo(QSize size, QString const & fullFileName, QString const & symbolID)
|
||||
: m_size(size), m_fullFileName(fullFileName), m_symbolID(symbolID)
|
||||
: m_size(size)
|
||||
, m_fullFileName(fullFileName)
|
||||
, m_symbolID(symbolID)
|
||||
{}
|
||||
};
|
||||
|
||||
@@ -53,8 +55,7 @@ public:
|
||||
};
|
||||
|
||||
void ProcessSymbols(std::string const & symbolsDir, std::string const & skinName,
|
||||
std::vector<QSize> const & symbolSizes,
|
||||
std::vector<std::string> const & suffix);
|
||||
std::vector<QSize> const & symbolSizes, std::vector<std::string> const & suffix);
|
||||
bool RenderPages(uint32_t maxSize);
|
||||
bool WriteToFileNewStyle(std::string const & skinName);
|
||||
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
#include "generator.hpp"
|
||||
|
||||
#include "base/logging.hpp"
|
||||
#include <iostream>
|
||||
#include "base/logging.hpp"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QString>
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
|
||||
DEFINE_string(fontFileName, "../../data/01_dejavusans.ttf", "path to TrueType font file");
|
||||
DEFINE_string(symbolsFile, "../../data/results.unicode", "file with 2bytes symbols for which the skin should be generated");
|
||||
DEFINE_string(symbolsFile, "../../data/results.unicode",
|
||||
"file with 2bytes symbols for which the skin should be generated");
|
||||
DEFINE_string(symbolsDir, "../../data/styles/symbols", "directory with svg symbol files");
|
||||
DEFINE_int32(symbolWidth, 24, "width of the rendered symbol");
|
||||
DEFINE_int32(symbolHeight, 24, "height of the rendered symbol");
|
||||
@@ -21,9 +22,9 @@ DEFINE_int32(searchIconWidth, 24, "width of the search category icon");
|
||||
DEFINE_int32(searchIconHeight, 24, "height of the search category icon");
|
||||
DEFINE_int32(maxSize, 4096, "max width/height of output textures");
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
// Used to lock the hash seed, so the order of XML attributes is always the same.
|
||||
// Used to lock the hash seed, so the order of XML attributes is always the same.
|
||||
QHashSeed::setDeterministicGlobalSeed();
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user