Avoid creating GrGLPath to the resource cache when creating GrGLPathRanges
Do not create a GrGLPath when loading glyphs with the driver and creating
GrGLPathRange based on those. The path would be inserted to the GPU
resource cache and then immediately be released.
Instead, just init the first path object of the path range as the
template.
Review URL: https://codereview.chromium.org/1146983004
diff --git a/src/gpu/gl/GrGLPathRendering.cpp b/src/gpu/gl/GrGLPathRendering.cpp
index 3ceb876..e000f03 100644
--- a/src/gpu/gl/GrGLPathRendering.cpp
+++ b/src/gpu/gl/GrGLPathRendering.cpp
@@ -131,12 +131,14 @@
const int numPaths = typeface->countGlyphs();
const GrGLuint basePathID = this->genPaths(numPaths);
- SkAutoTUnref<GrGLPath> templatePath(SkNEW_ARGS(GrGLPath, (fGpu, SkPath(), stroke)));
+
+ // Init the basePathID as the template path.
+ GrGLPath::InitPathObject(fGpu, basePathID, SkPath(), stroke);
GrGLenum status;
GL_CALL_RET(status, PathMemoryGlyphIndexArray(basePathID, GR_GL_STANDARD_FONT_FORMAT,
fontDataLength, fontData, faceIndex, 0,
- numPaths, templatePath->pathID(),
+ numPaths, basePathID,
SkPaint::kCanonicalTextSizeForPaths));
if (GR_GL_FONT_GLYPHS_AVAILABLE != status) {