Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorr.kuznetsov <r.kuznetsov@corp.mail.ru>2016-08-02 23:30:43 +0300
committerr.kuznetsov <r.kuznetsov@corp.mail.ru>2016-08-02 23:30:43 +0300
commit734e33f499ef03ca1432d6703556b30395b83b0d (patch)
tree908d5f8dffb4653e8285e7165f2fec95ab42474e /skin_generator
parentc853ef9f49002018d157136b27239f4eb75eeae9 (diff)
Added max size to skin generator
Diffstat (limited to 'skin_generator')
-rw-r--r--skin_generator/main.cpp9
-rw-r--r--skin_generator/skin_generator.cpp13
-rw-r--r--skin_generator/skin_generator.hpp2
3 files changed, 21 insertions, 3 deletions
diff --git a/skin_generator/main.cpp b/skin_generator/main.cpp
index aa956a4f23..d1648c5684 100644
--- a/skin_generator/main.cpp
+++ b/skin_generator/main.cpp
@@ -1,5 +1,7 @@
#include "skin_generator.hpp"
+#include "base/logging.hpp"
+
#include <QtCore/QFile>
#include <QtCore/QString>
#include <QApplication>
@@ -22,6 +24,7 @@ DEFINE_string(searchIconsSrcPath, "../../data/search-icons/svg", "input path for
DEFINE_int32(searchIconWidth, 24, "width of the search category icon");
DEFINE_int32(searchIconHeight, 24, "height of the search category icon");
DEFINE_bool(colorCorrection, false, "apply color correction");
+DEFINE_int32(maxSize, 2048, "max width/height of output textures");
// Used to lock the hash seed, so the order of XML attributes is always the same.
extern Q_CORE_EXPORT QBasicAtomicInt qt_qhash_seed;
@@ -42,7 +45,11 @@ int main(int argc, char *argv[])
gen.processSymbols(FLAGS_symbolsDir, FLAGS_skinName, symbolSizes, suffixes);
- gen.renderPages();
+ if (!gen.renderPages(FLAGS_maxSize))
+ {
+ LOG(LINFO, ("Skin generation finished with error."));
+ return 1;
+ }
QString newSkin(FLAGS_skinName.c_str());
newSkin.replace("basic", "symbols");
diff --git a/skin_generator/skin_generator.cpp b/skin_generator/skin_generator.cpp
index 965bc3cb46..6f5611d334 100644
--- a/skin_generator/skin_generator.cpp
+++ b/skin_generator/skin_generator.cpp
@@ -161,7 +161,7 @@ namespace tools
}
}
- void SkinGenerator::renderPages()
+ bool SkinGenerator::renderPages(uint32_t maxSize)
{
for (TSkinPages::iterator pageIt = m_pages.begin(); pageIt != m_pages.end(); ++pageIt)
{
@@ -196,6 +196,15 @@ namespace tools
page.m_width *= 2;
else
page.m_height *= 2;
+
+ if (page.m_width > maxSize)
+ {
+ page.m_width = maxSize;
+ page.m_height *= 2;
+ if (page.m_height > maxSize)
+ return false;
+ }
+
continue;
}
@@ -237,6 +246,8 @@ namespace tools
correctColors(gilImage);
img.save(s.c_str());
}
+
+ return true;
}
void SkinGenerator::markOverflow()
diff --git a/skin_generator/skin_generator.hpp b/skin_generator/skin_generator.hpp
index 295059744e..4c3df60b58 100644
--- a/skin_generator/skin_generator.hpp
+++ b/skin_generator/skin_generator.hpp
@@ -77,7 +77,7 @@ namespace tools
string const & skinName,
vector<QSize> const & symbolSizes,
vector<string> const & suffix);
- void renderPages();
+ bool renderPages(uint32_t maxSize);
bool writeToFile(string const & skinName);
void writeToFileNewStyle(string const & skinName);
};