don't rely on fonts having a stream
Portable fonts don't have streams, so expect the stream open
to fail.
R=bungeman@google.com
TBR=cdalton@nvidia.com
Review URL: https://codereview.chromium.org/1185803003
diff --git a/src/fonts/SkTestScalerContext.h b/src/fonts/SkTestScalerContext.h
index 1d4b89a..5838c80 100644
--- a/src/fonts/SkTestScalerContext.h
+++ b/src/fonts/SkTestScalerContext.h
@@ -74,7 +74,6 @@
uint32_t glyphIDsCount) const override;
SkStreamAsset* onOpenStream(int* ttcIndex) const override {
- SkASSERT(0); // don't expect to get here
return NULL;
}
diff --git a/src/gpu/gl/GrGLPathRendering.cpp b/src/gpu/gl/GrGLPathRendering.cpp
index ae83395..e81d54c 100644
--- a/src/gpu/gl/GrGLPathRendering.cpp
+++ b/src/gpu/gl/GrGLPathRendering.cpp
@@ -113,7 +113,11 @@
}
int faceIndex;
- SkAutoTDelete<SkStream> fontStream(typeface->openStream(&faceIndex));
+ SkStreamAsset* asset = typeface->openStream(&faceIndex);
+ if (!asset) {
+ return GrPathRendering::createGlyphs(typeface, NULL, stroke);
+ }
+ SkAutoTDelete<SkStream> fontStream(asset);
const size_t fontDataLength = fontStream->getLength();
if (0 == fontDataLength) {