make pathrenderers release their geometry before returning

Review URL: http://codereview.appspot.com/5753073/



git-svn-id: http://skia.googlecode.com/svn/trunk@3335 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrAAHairLinePathRenderer.cpp b/src/gpu/GrAAHairLinePathRenderer.cpp
index 3ed4488..527c18b 100644
--- a/src/gpu/GrAAHairLinePathRenderer.cpp
+++ b/src/gpu/GrAAHairLinePathRenderer.cpp
@@ -500,12 +500,14 @@
 
 }
 
-bool GrAAHairLinePathRenderer::createGeom(const SkPath& path,
-                                          const GrVec* translate,
-                                          GrDrawTarget* target,
-                                          GrDrawState::StageMask stageMask,
-                                          int* lineCnt,
-                                          int* quadCnt) {
+bool GrAAHairLinePathRenderer::createGeom(
+            const SkPath& path,
+            const GrVec* translate,
+            GrDrawTarget* target,
+            GrDrawState::StageMask stageMask,
+            int* lineCnt,
+            int* quadCnt,
+            GrDrawTarget::AutoReleaseGeometry* arg) {
     const GrDrawState& drawState = target->getDrawState();
     int rtHeight = drawState.getRenderTarget()->height();
 
@@ -542,11 +544,12 @@
 
     GrAssert(sizeof(Vertex) == GrDrawTarget::VertexSize(layout));
 
-    Vertex* verts;
-    if (!target->reserveVertexSpace(layout, vertCnt, (void**)&verts)) {
+    if (!arg->set(target, layout, vertCnt, 0)) {
         return false;
     }
 
+    Vertex* verts = reinterpret_cast<Vertex*>(arg->vertices());
+
     const GrMatrix* toDevice = NULL;
     const GrMatrix* toSrc = NULL;
     GrMatrix ivm;
@@ -597,13 +600,14 @@
 
     int lineCnt;
     int quadCnt;
-
+    GrDrawTarget::AutoReleaseGeometry arg;
     if (!this->createGeom(path,
                           translate,
                           target,
                           stageMask,
                           &lineCnt,
-                          &quadCnt)) {
+                          &quadCnt,
+                          &arg)) {
         return false;
     }