aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkGlyphCache.cpp
diff options
context:
space:
mode:
authorGravatar Ben Wagner <bungeman@google.com>2018-03-29 11:18:06 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-04-05 22:37:33 +0000
commit5ddb30862509967eca24ba3831cc11ed5396eee7 (patch)
tree85e8919cee2be60a66581b137ef861d783c583f4 /src/core/SkGlyphCache.cpp
parentb45aac961db511e805525c6d32125e8958983ab4 (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.cpp11
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;