Avoid creating GrGLPath to the resource cache when creating GrGLPathRanges
authorkkinnunen <kkinnunen@nvidia.com>
Mon, 25 May 2015 05:12:21 +0000 (22:12 -0700)
committerCommit bot <commit-bot@chromium.org>
Mon, 25 May 2015 05:12:22 +0000 (22:12 -0700)
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

src/gpu/gl/GrGLPathRendering.cpp

index 3ceb87692ac9e7b51964ba2c08985faefa53c246..e000f03102fdcb27adaa899edfb1680627b90ead 100644 (file)
@@ -131,12 +131,14 @@ GrPathRange* GrGLPathRendering::createGlyphs(const SkTypeface* typeface,
 
     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) {