From a2670336d4387782bb607092f3a06814bdf4eb8d Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Wed, 12 Apr 2017 17:50:17 -0700 Subject: [tests] Rewrite GlyphAtlas tests to use public API --- src/mbgl/text/glyph_atlas.cpp | 26 ++------------------------ src/mbgl/text/glyph_atlas.hpp | 8 -------- 2 files changed, 2 insertions(+), 32 deletions(-) (limited to 'src/mbgl/text') 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& 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& 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(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& 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 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&, const GlyphRange&) const; - GlyphRequest& requestRange(Entry&, const FontStack&, const GlyphRange&); void processResponse(const Response&, const FontStack&, const GlyphRange&); -- cgit v1.2.1