summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-04-12 17:50:17 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-04-13 10:10:56 -0700
commita2670336d4387782bb607092f3a06814bdf4eb8d (patch)
treea263f1deb32af9193cea8a6e2a4d34ffddf211c6 /src
parentc8480491a66f48f034b9dfc6700c4997532c89ec (diff)
downloadqtlocation-mapboxgl-a2670336d4387782bb607092f3a06814bdf4eb8d.tar.gz
[tests] Rewrite GlyphAtlas tests to use public API
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/text/glyph_atlas.cpp26
-rw-r--r--src/mbgl/text/glyph_atlas.hpp8
2 files changed, 2 insertions, 32 deletions
diff --git a/src/mbgl/text/glyph_atlas.cpp b/src/mbgl/text/glyph_atlas.cpp
index 2256805606..2b09bc5763 100644
--- a/src/mbgl/text/glyph_atlas.cpp
+++ b/src/mbgl/text/glyph_atlas.cpp
@@ -25,29 +25,6 @@ GlyphAtlas::GlyphAtlas(const Size size, FileSource& fileSource_)
GlyphAtlas::~GlyphAtlas() = default;
-std::map<uint32_t, SDFGlyph>& GlyphAtlas::getGlyphSet(const FontStack& fontStack) {
- return entries[fontStack].sdfs;
-}
-
-bool GlyphAtlas::hasGlyphRanges(const FontStack& fontStack, const GlyphRangeSet& ranges) const {
- for (const auto& range : ranges) {
- if (!hasGlyphRange(fontStack,range)) {
- return false;
- }
- }
- return true;
-}
-
-bool GlyphAtlas::rangeIsParsed(const std::map<GlyphRange, GlyphRequest>& ranges, const GlyphRange& range) const {
- auto it = ranges.find(range);
- return it != ranges.end() && it->second.parsed;
-}
-
-bool GlyphAtlas::hasGlyphRange(const FontStack& fontStack, const GlyphRange& range) const {
- auto it = entries.find(fontStack);
- return it != entries.end() && rangeIsParsed(it->second.ranges, range);
-}
-
void GlyphAtlas::getGlyphs(GlyphRequestor& requestor, GlyphDependencies glyphDependencies) {
auto dependencies = std::make_shared<GlyphDependencies>(std::move(glyphDependencies));
@@ -66,7 +43,8 @@ void GlyphAtlas::getGlyphs(GlyphRequestor& requestor, GlyphDependencies glyphDep
}
for (const auto& range : ranges) {
- if (!rangeIsParsed(entry.ranges, range)) {
+ auto it = entry.ranges.find(range);
+ if (it == entry.ranges.end() || !it->second.parsed) {
GlyphRequest& request = requestRange(entry, fontStack, range);
request.requestors[&requestor] = dependencies;
}
diff --git a/src/mbgl/text/glyph_atlas.hpp b/src/mbgl/text/glyph_atlas.hpp
index 2003c8e593..ef1ddc85ed 100644
--- a/src/mbgl/text/glyph_atlas.hpp
+++ b/src/mbgl/text/glyph_atlas.hpp
@@ -39,8 +39,6 @@ public:
GlyphAtlas(Size, FileSource&);
~GlyphAtlas();
- std::map<uint32_t, SDFGlyph>& getGlyphSet(const FontStack&);
-
// Workers send a `getGlyphs` message to the main thread once they have determined
// which glyphs they will need. Invoking this method will increment reference
// counts for all the glyphs in `GlyphDependencies`. If all glyphs are already
@@ -93,12 +91,6 @@ private:
std::unordered_map<FontStack, Entry, FontStackHash> entries;
- // Only used by GlyphAtlasTest
- friend class ::GlyphAtlasTest;
- bool hasGlyphRanges(const FontStack&, const GlyphRangeSet&) const;
- bool hasGlyphRange(const FontStack&, const GlyphRange&) const;
- bool rangeIsParsed(const std::map<GlyphRange, GlyphRequest>&, const GlyphRange&) const;
-
GlyphRequest& requestRange(Entry&, const FontStack&, const GlyphRange&);
void processResponse(const Response&, const FontStack&, const GlyphRange&);