Index: src/core/SkGlyphCache.cpp |
diff --git a/src/core/SkGlyphCache.cpp b/src/core/SkGlyphCache.cpp |
index 51ed657861eeefea0bd5c965a82ef5acfc8ef607..4bde762585ee88fdc006d25c3896dd5e65d4da50 100644 |
--- a/src/core/SkGlyphCache.cpp |
+++ b/src/core/SkGlyphCache.cpp |
@@ -5,6 +5,8 @@ |
* found in the LICENSE file. |
*/ |
+#include <ctype.h> |
Primiano Tucci (use gerrit)
2015/09/22 17:30:35
you don't need ctype, just <string>
ssid
2015/09/23 13:11:41
Done.
|
+ |
#include "SkGlyphCache.h" |
#include "SkGlyphCache_Globals.h" |
#include "SkGraphics.h" |
@@ -427,12 +429,21 @@ static void sk_trace_dump_visitor(const SkGlyphCache& cache, void* context) { |
*counter += 1; |
const SkTypeface* face = cache.getScalerContext()->getTypeface(); |
+ const SkScalerContextRec& rec = cache.getScalerContext()->getRec(); |
+ |
SkString fontName; |
face->getFamilyName(&fontName); |
- const SkScalerContextRec& rec = cache.getScalerContext()->getRec(); |
+ // Dump only alpha numeric characters in font name, to avoid '/' or special chars. |
+ SkString strippedName; |
Primiano Tucci (use gerrit)
2015/09/22 17:30:35
you can make this more efficient giving a capacity
ssid
2015/09/23 13:11:40
Done.
|
+ for (int index = 0; index < fontName.size(); ++index) { |
Primiano Tucci (use gerrit)
2015/09/22 17:30:35
nit: size_t
ssid
2015/09/23 13:11:40
Done.
|
+ if (isalnum(fontName[index])) { |
Primiano Tucci (use gerrit)
2015/09/22 17:30:35
std::isalnum
ssid
2015/09/23 13:11:40
Done.
|
+ strippedName += fontName[index]; |
+ } |
Primiano Tucci (use gerrit)
2015/09/22 17:30:35
else: += '_'
ssid
2015/09/23 13:11:40
Done.
|
+ } |
- SkString dumpName = SkStringPrintf("%s/%s_%3d/index_%d", |
- gGlyphCacheDumpName, fontName.c_str(), rec.fFontID, index); |
+ SkString dumpName = SkStringPrintf("%s/%s_%d/index_%d", |
+ gGlyphCacheDumpName, strippedName.c_str(), rec.fFontID, |
+ index); |
dump->dumpNumericValue(dumpName.c_str(), "size", "bytes", cache.getMemoryUsed()); |
dump->dumpNumericValue(dumpName.c_str(), "glyph_count", "objects", cache.countCachedGlyphs()); |