Fix bench crash (calling method on NULL object).
authorbsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 5 Feb 2013 21:32:06 +0000 (21:32 +0000)
committerbsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 5 Feb 2013 21:32:06 +0000 (21:32 +0000)
Review URL: https://codereview.appspot.com/7305048

git-svn-id: http://skia.googlecode.com/svn/trunk@7603 2bbb7eff-a529-9590-31e7-b0007b416f81

src/gpu/GrTextContext.cpp

index 2a26dae..684b7f7 100644 (file)
@@ -212,11 +212,13 @@ HAS_ATLAS:
         if (flush) {
             this->flushGlyphs();
             fContext->flush();
+            // flushGlyphs() will reset fDrawTarget to NULL.
+            fDrawTarget = fContext->getTextTarget(fPaint);
+            fDrawTarget->drawState()->setVertexLayout(fVertexLayout);
         }
         fMaxVertices = kDefaultRequestedVerts;
         // ignore return, no point in flushing again.
-        fDrawTarget->geometryHints(&fMaxVertices,
-                                   NULL);
+        fDrawTarget->geometryHints(&fMaxVertices, NULL);
 
         int maxQuadVertices = 4 * fContext->getQuadIndexBuffer()->maxQuads();
         if (fMaxVertices < kMinRequestedVerts) {