[core] Extract some GlyphRange-related constants

This commit is contained in:
John Firebaugh
2016-09-26 13:38:11 -07:00
parent 8764c20621
commit a9842dbd6b
2 changed files with 6 additions and 3 deletions

View File

@@ -114,7 +114,7 @@ OfflineRegionStatus OfflineDownload::getStatus() const {
}
if (!parser.glyphURL.empty()) {
result.requiredResourceCount += parser.fontStacks().size() * 256;
result.requiredResourceCount += parser.fontStacks().size() * GLYPH_RANGES_PER_FONT_STACK;
}
if (!parser.spriteURL.empty()) {
@@ -184,8 +184,8 @@ void OfflineDownload::activateDownload() {
if (!parser.glyphURL.empty()) {
for (const auto& fontStack : parser.fontStacks()) {
for (uint32_t i = 0; i < 256; i++) {
queueResource(Resource::glyphs(parser.glyphURL, fontStack, getGlyphRange(i * 256)));
for (uint32_t i = 0; i < GLYPH_RANGES_PER_FONT_STACK; i++) {
queueResource(Resource::glyphs(parser.glyphURL, fontStack, getGlyphRange(i * GLYPHS_PER_GLYPH_RANGE)));
}
}
}

View File

@@ -17,4 +17,7 @@ struct GlyphRangeHash {
typedef std::unordered_set<GlyphRange, GlyphRangeHash> GlyphRangeSet;
constexpr uint32_t GLYPHS_PER_GLYPH_RANGE = 256;
constexpr uint32_t GLYPH_RANGES_PER_FONT_STACK = 256;
} // end namespace mbgl