diff options
author | 2018-03-29 11:18:06 -0400 | |
---|---|---|
committer | 2018-04-05 22:37:33 +0000 | |
commit | 5ddb30862509967eca24ba3831cc11ed5396eee7 (patch) | |
tree | 85e8919cee2be60a66581b137ef861d783c583f4 /src/core/SkGlyphCache.cpp | |
parent | b45aac961db511e805525c6d32125e8958983ab4 (diff) |
Distinguish between glyphs with empty path and no path.
BUG=skia:4904
Change-Id: I065e3b4d8596b415ddaf094d7f9a4b65da64d4d4
Reviewed-on: https://skia-review.googlesource.com/117280
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Diffstat (limited to 'src/core/SkGlyphCache.cpp')
-rw-r--r-- | src/core/SkGlyphCache.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/core/SkGlyphCache.cpp b/src/core/SkGlyphCache.cpp index e030c4b9a3..057f4d731e 100644 --- a/src/core/SkGlyphCache.cpp +++ b/src/core/SkGlyphCache.cpp @@ -214,9 +214,14 @@ const SkPath* SkGlyphCache::findPath(const SkGlyph& glyph) { SkGlyph::PathData* pathData = fAlloc.make<SkGlyph::PathData>(); const_cast<SkGlyph&>(glyph).fPathData = pathData; pathData->fIntercept = nullptr; - SkPath* path = pathData->fPath = new SkPath; - fScalerContext->getPath(glyph.getPackedID(), path); - fMemoryUsed += sizeof(SkPath) + path->countPoints() * sizeof(SkPoint); + SkPath* path = new SkPath; + if (fScalerContext->getPath(glyph.getPackedID(), path)) { + pathData->fPath = path; + fMemoryUsed += sizeof(SkPath) + path->countPoints() * sizeof(SkPoint); + } else { + pathData->fPath = nullptr; + delete path; + } } } return glyph.fPathData ? glyph.fPathData->fPath : nullptr; |