| Index: src/gpu/GrDrawTarget.cpp | 
| diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp | 
| index bca347dbea6edf206e0a30b53def318c554cc13d..d6fbbc24fdb3d50f539db846e0c3003abfdb27ae 100644 | 
| --- a/src/gpu/GrDrawTarget.cpp | 
| +++ b/src/gpu/GrDrawTarget.cpp | 
| @@ -50,43 +50,6 @@ GrDrawTarget::DrawInfo& GrDrawTarget::DrawInfo::operator =(const DrawInfo& di) { | 
| return *this; | 
| } | 
|  | 
| -#ifdef SK_DEBUG | 
| -bool GrDrawTarget::DrawInfo::isInstanced() const { | 
| -    if (fInstanceCount > 0) { | 
| -        SkASSERT(0 == fIndexCount % fIndicesPerInstance); | 
| -        SkASSERT(0 == fVertexCount % fVerticesPerInstance); | 
| -        SkASSERT(fIndexCount / fIndicesPerInstance == fInstanceCount); | 
| -        SkASSERT(fVertexCount / fVerticesPerInstance == fInstanceCount); | 
| -        // there is no way to specify a non-zero start index to drawIndexedInstances(). | 
| -        SkASSERT(0 == fStartIndex); | 
| -        return true; | 
| -    } else { | 
| -        SkASSERT(!fVerticesPerInstance); | 
| -        SkASSERT(!fIndicesPerInstance); | 
| -        return false; | 
| -    } | 
| -} | 
| -#endif | 
| - | 
| -void GrDrawTarget::DrawInfo::adjustInstanceCount(int instanceOffset) { | 
| -    SkASSERT(this->isInstanced()); | 
| -    SkASSERT(instanceOffset + fInstanceCount >= 0); | 
| -    fInstanceCount += instanceOffset; | 
| -    fVertexCount = fVerticesPerInstance * fInstanceCount; | 
| -    fIndexCount = fIndicesPerInstance * fInstanceCount; | 
| -} | 
| - | 
| -void GrDrawTarget::DrawInfo::adjustStartVertex(int vertexOffset) { | 
| -    fStartVertex += vertexOffset; | 
| -    SkASSERT(fStartVertex >= 0); | 
| -} | 
| - | 
| -void GrDrawTarget::DrawInfo::adjustStartIndex(int indexOffset) { | 
| -    SkASSERT(this->isIndexed()); | 
| -    fStartIndex += indexOffset; | 
| -    SkASSERT(fStartIndex >= 0); | 
| -} | 
| - | 
| //////////////////////////////////////////////////////////////////////////////// | 
|  | 
| #define DEBUG_INVAL_BUFFER 0xdeadcafe | 
| @@ -96,288 +59,10 @@ GrDrawTarget::GrDrawTarget(GrContext* context) | 
| : fContext(context) | 
| , fGpuTraceMarkerCount(0) { | 
| SkASSERT(context); | 
| -    GeometrySrcState& geoSrc = fGeoSrcStateStack.push_back(); | 
| -#ifdef SK_DEBUG | 
| -    geoSrc.fVertexCount = DEBUG_INVAL_START_IDX; | 
| -    geoSrc.fVertexBuffer = (GrVertexBuffer*)DEBUG_INVAL_BUFFER; | 
| -    geoSrc.fIndexCount = DEBUG_INVAL_START_IDX; | 
| -    geoSrc.fIndexBuffer = (GrIndexBuffer*)DEBUG_INVAL_BUFFER; | 
| -#endif | 
| -    geoSrc.fVertexSrc = kNone_GeometrySrcType; | 
| -    geoSrc.fIndexSrc  = kNone_GeometrySrcType; | 
| -} | 
| - | 
| -GrDrawTarget::~GrDrawTarget() { | 
| -    SkASSERT(1 == fGeoSrcStateStack.count()); | 
| -    SkDEBUGCODE(GeometrySrcState& geoSrc = fGeoSrcStateStack.back()); | 
| -    SkASSERT(kNone_GeometrySrcType == geoSrc.fIndexSrc); | 
| -    SkASSERT(kNone_GeometrySrcType == geoSrc.fVertexSrc); | 
| -} | 
| - | 
| -void GrDrawTarget::releaseGeometry() { | 
| -    int popCnt = fGeoSrcStateStack.count() - 1; | 
| -    while (popCnt) { | 
| -        this->popGeometrySource(); | 
| -        --popCnt; | 
| -    } | 
| -    this->resetVertexSource(); | 
| -    this->resetIndexSource(); | 
| -} | 
| - | 
| -bool GrDrawTarget::reserveVertexSpace(size_t vertexSize, | 
| -                                      int vertexCount, | 
| -                                      void** vertices) { | 
| -    GeometrySrcState& geoSrc = fGeoSrcStateStack.back(); | 
| -    bool acquired = false; | 
| -    if (vertexCount > 0) { | 
| -        SkASSERT(vertices); | 
| -        this->releasePreviousVertexSource(); | 
| -        geoSrc.fVertexSrc = kNone_GeometrySrcType; | 
| - | 
| -        acquired = this->onReserveVertexSpace(vertexSize, | 
| -                                              vertexCount, | 
| -                                              vertices); | 
| -    } | 
| -    if (acquired) { | 
| -        geoSrc.fVertexSrc = kReserved_GeometrySrcType; | 
| -        geoSrc.fVertexCount = vertexCount; | 
| -        geoSrc.fVertexSize = vertexSize; | 
| -    } else if (vertices) { | 
| -        *vertices = NULL; | 
| -    } | 
| -    return acquired; | 
| -} | 
| - | 
| -bool GrDrawTarget::reserveIndexSpace(int indexCount, | 
| -                                     void** indices) { | 
| -    GeometrySrcState& geoSrc = fGeoSrcStateStack.back(); | 
| -    bool acquired = false; | 
| -    if (indexCount > 0) { | 
| -        SkASSERT(indices); | 
| -        this->releasePreviousIndexSource(); | 
| -        geoSrc.fIndexSrc = kNone_GeometrySrcType; | 
| - | 
| -        acquired = this->onReserveIndexSpace(indexCount, indices); | 
| -    } | 
| -    if (acquired) { | 
| -        geoSrc.fIndexSrc = kReserved_GeometrySrcType; | 
| -        geoSrc.fIndexCount = indexCount; | 
| -    } else if (indices) { | 
| -        *indices = NULL; | 
| -    } | 
| -    return acquired; | 
| - | 
| -} | 
| - | 
| -bool GrDrawTarget::reserveVertexAndIndexSpace(int vertexCount, | 
| -                                              size_t vertexStride, | 
| -                                              int indexCount, | 
| -                                              void** vertices, | 
| -                                              void** indices) { | 
| -    this->willReserveVertexAndIndexSpace(vertexCount, vertexStride, indexCount); | 
| -    if (vertexCount) { | 
| -        if (!this->reserveVertexSpace(vertexStride, vertexCount, vertices)) { | 
| -            if (indexCount) { | 
| -                this->resetIndexSource(); | 
| -            } | 
| -            return false; | 
| -        } | 
| -    } | 
| -    if (indexCount) { | 
| -        if (!this->reserveIndexSpace(indexCount, indices)) { | 
| -            if (vertexCount) { | 
| -                this->resetVertexSource(); | 
| -            } | 
| -            return false; | 
| -        } | 
| -    } | 
| -    return true; | 
| -} | 
| - | 
| -bool GrDrawTarget::geometryHints(size_t vertexStride, | 
| -                                 int32_t* vertexCount, | 
| -                                 int32_t* indexCount) const { | 
| -    if (vertexCount) { | 
| -        *vertexCount = -1; | 
| -    } | 
| -    if (indexCount) { | 
| -        *indexCount = -1; | 
| -    } | 
| -    return false; | 
| -} | 
| - | 
| -void GrDrawTarget::releasePreviousVertexSource() { | 
| -    GeometrySrcState& geoSrc = fGeoSrcStateStack.back(); | 
| -    switch (geoSrc.fVertexSrc) { | 
| -        case kNone_GeometrySrcType: | 
| -            break; | 
| -        case kReserved_GeometrySrcType: | 
| -            this->releaseReservedVertexSpace(); | 
| -            break; | 
| -        case kBuffer_GeometrySrcType: | 
| -            geoSrc.fVertexBuffer->unref(); | 
| -#ifdef SK_DEBUG | 
| -            geoSrc.fVertexBuffer = (GrVertexBuffer*)DEBUG_INVAL_BUFFER; | 
| -#endif | 
| -            break; | 
| -        default: | 
| -            SkFAIL("Unknown Vertex Source Type."); | 
| -            break; | 
| -    } | 
| -} | 
| - | 
| -void GrDrawTarget::releasePreviousIndexSource() { | 
| -    GeometrySrcState& geoSrc = fGeoSrcStateStack.back(); | 
| -    switch (geoSrc.fIndexSrc) { | 
| -        case kNone_GeometrySrcType:   // these two don't require | 
| -            break; | 
| -        case kReserved_GeometrySrcType: | 
| -            this->releaseReservedIndexSpace(); | 
| -            break; | 
| -        case kBuffer_GeometrySrcType: | 
| -            geoSrc.fIndexBuffer->unref(); | 
| -#ifdef SK_DEBUG | 
| -            geoSrc.fIndexBuffer = (GrIndexBuffer*)DEBUG_INVAL_BUFFER; | 
| -#endif | 
| -            break; | 
| -        default: | 
| -            SkFAIL("Unknown Index Source Type."); | 
| -            break; | 
| -    } | 
| -} | 
| - | 
| -void GrDrawTarget::setVertexSourceToBuffer(const GrVertexBuffer* buffer, size_t vertexStride) { | 
| -    this->releasePreviousVertexSource(); | 
| -    GeometrySrcState& geoSrc = fGeoSrcStateStack.back(); | 
| -    geoSrc.fVertexSrc    = kBuffer_GeometrySrcType; | 
| -    geoSrc.fVertexBuffer = buffer; | 
| -    buffer->ref(); | 
| -    geoSrc.fVertexSize = vertexStride; | 
| -} | 
| - | 
| -void GrDrawTarget::setIndexSourceToBuffer(const GrIndexBuffer* buffer) { | 
| -    this->releasePreviousIndexSource(); | 
| -    GeometrySrcState& geoSrc = fGeoSrcStateStack.back(); | 
| -    geoSrc.fIndexSrc     = kBuffer_GeometrySrcType; | 
| -    geoSrc.fIndexBuffer  = buffer; | 
| -    buffer->ref(); | 
| -} | 
| - | 
| -void GrDrawTarget::resetVertexSource() { | 
| -    this->releasePreviousVertexSource(); | 
| -    GeometrySrcState& geoSrc = fGeoSrcStateStack.back(); | 
| -    geoSrc.fVertexSrc = kNone_GeometrySrcType; | 
| -} | 
| - | 
| -void GrDrawTarget::resetIndexSource() { | 
| -    this->releasePreviousIndexSource(); | 
| -    GeometrySrcState& geoSrc = fGeoSrcStateStack.back(); | 
| -    geoSrc.fIndexSrc = kNone_GeometrySrcType; | 
| -} | 
| - | 
| -void GrDrawTarget::pushGeometrySource() { | 
| -    this->geometrySourceWillPush(); | 
| -    GeometrySrcState& newState = fGeoSrcStateStack.push_back(); | 
| -    newState.fIndexSrc = kNone_GeometrySrcType; | 
| -    newState.fVertexSrc = kNone_GeometrySrcType; | 
| -#ifdef SK_DEBUG | 
| -    newState.fVertexCount  = ~0; | 
| -    newState.fVertexBuffer = (GrVertexBuffer*)~0; | 
| -    newState.fIndexCount   = ~0; | 
| -    newState.fIndexBuffer = (GrIndexBuffer*)~0; | 
| -#endif | 
| -} | 
| - | 
| -void GrDrawTarget::popGeometrySource() { | 
| -    // if popping last element then pops are unbalanced with pushes | 
| -    SkASSERT(fGeoSrcStateStack.count() > 1); | 
| - | 
| -    this->geometrySourceWillPop(fGeoSrcStateStack.fromBack(1)); | 
| -    this->releasePreviousVertexSource(); | 
| -    this->releasePreviousIndexSource(); | 
| -    fGeoSrcStateStack.pop_back(); | 
| } | 
|  | 
| //////////////////////////////////////////////////////////////////////////////// | 
|  | 
| -bool GrDrawTarget::checkDraw(const GrPipelineBuilder& pipelineBuilder, | 
| -                             const GrGeometryProcessor* gp, | 
| -                             GrPrimitiveType type, | 
| -                             int startVertex, | 
| -                             int startIndex, | 
| -                             int vertexCount, | 
| -                             int indexCount) const { | 
| -#ifdef SK_DEBUG | 
| -    const GeometrySrcState& geoSrc = fGeoSrcStateStack.back(); | 
| -    int maxVertex = startVertex + vertexCount; | 
| -    int maxValidVertex; | 
| -    switch (geoSrc.fVertexSrc) { | 
| -        case kNone_GeometrySrcType: | 
| -            SkFAIL("Attempting to draw without vertex src."); | 
| -        case kReserved_GeometrySrcType: // fallthrough | 
| -            maxValidVertex = geoSrc.fVertexCount; | 
| -            break; | 
| -        case kBuffer_GeometrySrcType: | 
| -            maxValidVertex = static_cast<int>(geoSrc.fVertexBuffer->gpuMemorySize() / | 
| -                                              geoSrc.fVertexSize); | 
| -            break; | 
| -    } | 
| -    if (maxVertex > maxValidVertex) { | 
| -        SkFAIL("Drawing outside valid vertex range."); | 
| -    } | 
| -    if (indexCount > 0) { | 
| -        int maxIndex = startIndex + indexCount; | 
| -        int maxValidIndex; | 
| -        switch (geoSrc.fIndexSrc) { | 
| -            case kNone_GeometrySrcType: | 
| -                SkFAIL("Attempting to draw indexed geom without index src."); | 
| -            case kReserved_GeometrySrcType: // fallthrough | 
| -                maxValidIndex = geoSrc.fIndexCount; | 
| -                break; | 
| -            case kBuffer_GeometrySrcType: | 
| -                maxValidIndex = static_cast<int>(geoSrc.fIndexBuffer->gpuMemorySize() / | 
| -                                                 sizeof(uint16_t)); | 
| -                break; | 
| -        } | 
| -        if (maxIndex > maxValidIndex) { | 
| -            SkFAIL("Index reads outside valid index range."); | 
| -        } | 
| -    } | 
| - | 
| -    SkASSERT(pipelineBuilder.getRenderTarget()); | 
| - | 
| -    if (gp) { | 
| -        int numTextures = gp->numTextures(); | 
| -        for (int t = 0; t < numTextures; ++t) { | 
| -            GrTexture* texture = gp->texture(t); | 
| -            SkASSERT(texture->asRenderTarget() != pipelineBuilder.getRenderTarget()); | 
| -        } | 
| -    } | 
| - | 
| -    for (int s = 0; s < pipelineBuilder.numColorFragmentStages(); ++s) { | 
| -        const GrProcessor* effect = pipelineBuilder.getColorFragmentStage(s).processor(); | 
| -        int numTextures = effect->numTextures(); | 
| -        for (int t = 0; t < numTextures; ++t) { | 
| -            GrTexture* texture = effect->texture(t); | 
| -            SkASSERT(texture->asRenderTarget() != pipelineBuilder.getRenderTarget()); | 
| -        } | 
| -    } | 
| -    for (int s = 0; s < pipelineBuilder.numCoverageFragmentStages(); ++s) { | 
| -        const GrProcessor* effect = pipelineBuilder.getCoverageFragmentStage(s).processor(); | 
| -        int numTextures = effect->numTextures(); | 
| -        for (int t = 0; t < numTextures; ++t) { | 
| -            GrTexture* texture = effect->texture(t); | 
| -            SkASSERT(texture->asRenderTarget() != pipelineBuilder.getRenderTarget()); | 
| -        } | 
| -    } | 
| - | 
| -#endif | 
| -    if (NULL == pipelineBuilder.getRenderTarget()) { | 
| -        return false; | 
| -    } | 
| -    return true; | 
| -} | 
| - | 
| bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuilder, | 
| const GrProcOptInfo& colorPOI, | 
| const GrProcOptInfo& coveragePOI, | 
| @@ -429,100 +114,6 @@ bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuil | 
| } | 
| } | 
|  | 
| -void GrDrawTarget::drawIndexed(GrPipelineBuilder* pipelineBuilder, | 
| -                               const GrGeometryProcessor* gp, | 
| -                               GrPrimitiveType type, | 
| -                               int startVertex, | 
| -                               int startIndex, | 
| -                               int vertexCount, | 
| -                               int indexCount, | 
| -                               const SkRect* devBounds) { | 
| -    SkASSERT(pipelineBuilder); | 
| -    if (indexCount > 0 && | 
| -        this->checkDraw(*pipelineBuilder, gp, type, startVertex, startIndex, vertexCount, | 
| -                        indexCount)) { | 
| - | 
| -        // Setup clip | 
| -        GrScissorState scissorState; | 
| -        GrPipelineBuilder::AutoRestoreFragmentProcessors arfp; | 
| -        GrPipelineBuilder::AutoRestoreStencil ars; | 
| -        if (!this->setupClip(pipelineBuilder, &arfp, &ars, &scissorState, devBounds)) { | 
| -            return; | 
| -        } | 
| - | 
| -        DrawInfo info; | 
| -        info.fPrimitiveType = type; | 
| -        info.fStartVertex   = startVertex; | 
| -        info.fStartIndex    = startIndex; | 
| -        info.fVertexCount   = vertexCount; | 
| -        info.fIndexCount    = indexCount; | 
| - | 
| -        info.fInstanceCount         = 0; | 
| -        info.fVerticesPerInstance   = 0; | 
| -        info.fIndicesPerInstance    = 0; | 
| - | 
| -        if (devBounds) { | 
| -            info.setDevBounds(*devBounds); | 
| -        } | 
| - | 
| -        GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, gp, devBounds, | 
| -                                                this); | 
| -        if (pipelineInfo.mustSkipDraw()) { | 
| -            return; | 
| -        } | 
| - | 
| -        this->setDrawBuffers(&info, gp->getVertexStride()); | 
| - | 
| -        this->onDraw(gp, info, pipelineInfo); | 
| -    } | 
| -} | 
| - | 
| -void GrDrawTarget::drawNonIndexed(GrPipelineBuilder* pipelineBuilder, | 
| -                                  const GrGeometryProcessor* gp, | 
| -                                  GrPrimitiveType type, | 
| -                                  int startVertex, | 
| -                                  int vertexCount, | 
| -                                  const SkRect* devBounds) { | 
| -    SkASSERT(pipelineBuilder); | 
| -    if (vertexCount > 0 && this->checkDraw(*pipelineBuilder, gp, type, startVertex, -1, vertexCount, | 
| -                                           -1)) { | 
| - | 
| -        // Setup clip | 
| -        GrScissorState scissorState; | 
| -        GrPipelineBuilder::AutoRestoreFragmentProcessors arfp; | 
| -        GrPipelineBuilder::AutoRestoreStencil ars; | 
| -        if (!this->setupClip(pipelineBuilder, &arfp, &ars, &scissorState, devBounds)) { | 
| -            return; | 
| -        } | 
| - | 
| -        DrawInfo info; | 
| -        info.fPrimitiveType = type; | 
| -        info.fStartVertex   = startVertex; | 
| -        info.fStartIndex    = 0; | 
| -        info.fVertexCount   = vertexCount; | 
| -        info.fIndexCount    = 0; | 
| - | 
| -        info.fInstanceCount         = 0; | 
| -        info.fVerticesPerInstance   = 0; | 
| -        info.fIndicesPerInstance    = 0; | 
| - | 
| -        if (devBounds) { | 
| -            info.setDevBounds(*devBounds); | 
| -        } | 
| - | 
| -        GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, gp, devBounds, | 
| -                                                this); | 
| -        if (pipelineInfo.mustSkipDraw()) { | 
| -            return; | 
| -        } | 
| - | 
| -        this->setDrawBuffers(&info, gp->getVertexStride()); | 
| - | 
| -        this->onDraw(gp, info, pipelineInfo); | 
| -    } | 
| -} | 
| - | 
| - | 
| void GrDrawTarget::drawBatch(GrPipelineBuilder* pipelineBuilder, | 
| GrBatch* batch, | 
| const SkRect* devBounds) { | 
| @@ -750,126 +341,6 @@ void GrDrawTarget::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { | 
|  | 
| //////////////////////////////////////////////////////////////////////////////// | 
|  | 
| -void GrDrawTarget::drawIndexedInstances(GrPipelineBuilder* pipelineBuilder, | 
| -                                        const GrGeometryProcessor* gp, | 
| -                                        GrPrimitiveType type, | 
| -                                        int instanceCount, | 
| -                                        int verticesPerInstance, | 
| -                                        int indicesPerInstance, | 
| -                                        const SkRect* devBounds) { | 
| -    SkASSERT(pipelineBuilder); | 
| - | 
| -    if (!verticesPerInstance || !indicesPerInstance) { | 
| -        return; | 
| -    } | 
| - | 
| -    int maxInstancesPerDraw = this->indexCountInCurrentSource() / indicesPerInstance; | 
| -    if (!maxInstancesPerDraw) { | 
| -        return; | 
| -    } | 
| - | 
| -    // Setup clip | 
| -    GrScissorState scissorState; | 
| -    GrPipelineBuilder::AutoRestoreFragmentProcessors arfp; | 
| -    GrPipelineBuilder::AutoRestoreStencil ars; | 
| -    if (!this->setupClip(pipelineBuilder, &arfp, &ars, &scissorState, devBounds)) { | 
| -        return; | 
| -    } | 
| - | 
| -    DrawInfo info; | 
| -    info.fPrimitiveType = type; | 
| -    info.fStartIndex = 0; | 
| -    info.fStartVertex = 0; | 
| -    info.fIndicesPerInstance = indicesPerInstance; | 
| -    info.fVerticesPerInstance = verticesPerInstance; | 
| - | 
| -    // Set the same bounds for all the draws. | 
| -    if (devBounds) { | 
| -        info.setDevBounds(*devBounds); | 
| -    } | 
| - | 
| -    while (instanceCount) { | 
| -        info.fInstanceCount = SkTMin(instanceCount, maxInstancesPerDraw); | 
| -        info.fVertexCount = info.fInstanceCount * verticesPerInstance; | 
| -        info.fIndexCount = info.fInstanceCount * indicesPerInstance; | 
| - | 
| -        if (this->checkDraw(*pipelineBuilder, | 
| -                            gp, | 
| -                            type, | 
| -                            info.fStartVertex, | 
| -                            info.fStartIndex, | 
| -                            info.fVertexCount, | 
| -                            info.fIndexCount)) { | 
| - | 
| -            GrDrawTarget::PipelineInfo pipelineInfo(pipelineBuilder, &scissorState, gp, devBounds, | 
| -                                                    this); | 
| -            if (pipelineInfo.mustSkipDraw()) { | 
| -                return; | 
| -            } | 
| - | 
| -            this->setDrawBuffers(&info, gp->getVertexStride()); | 
| -            this->onDraw(gp, info, pipelineInfo); | 
| -        } | 
| -        info.fStartVertex += info.fVertexCount; | 
| -        instanceCount -= info.fInstanceCount; | 
| -    } | 
| -} | 
| - | 
| -//////////////////////////////////////////////////////////////////////////////// | 
| - | 
| -GrDrawTarget::AutoReleaseGeometry::AutoReleaseGeometry( | 
| -                                         GrDrawTarget*  target, | 
| -                                         int vertexCount, | 
| -                                         size_t vertexStride, | 
| -                                         int indexCount) { | 
| -    fTarget = NULL; | 
| -    this->set(target, vertexCount, vertexStride, indexCount); | 
| -} | 
| - | 
| -GrDrawTarget::AutoReleaseGeometry::AutoReleaseGeometry() { | 
| -    fTarget = NULL; | 
| -} | 
| - | 
| -GrDrawTarget::AutoReleaseGeometry::~AutoReleaseGeometry() { | 
| -    this->reset(); | 
| -} | 
| - | 
| -bool GrDrawTarget::AutoReleaseGeometry::set(GrDrawTarget*  target, | 
| -                                            int vertexCount, | 
| -                                            size_t vertexStride, | 
| -                                            int indexCount) { | 
| -    this->reset(); | 
| -    fTarget = target; | 
| -    bool success = true; | 
| -    if (fTarget) { | 
| -        success = target->reserveVertexAndIndexSpace(vertexCount, | 
| -                                                     vertexStride, | 
| -                                                     indexCount, | 
| -                                                     &fVertices, | 
| -                                                     &fIndices); | 
| -        if (!success) { | 
| -            fTarget = NULL; | 
| -            this->reset(); | 
| -        } | 
| -    } | 
| -    SkASSERT(success == SkToBool(fTarget)); | 
| -    return success; | 
| -} | 
| - | 
| -void GrDrawTarget::AutoReleaseGeometry::reset() { | 
| -    if (fTarget) { | 
| -        if (fVertices) { | 
| -            fTarget->resetVertexSource(); | 
| -        } | 
| -        if (fIndices) { | 
| -            fTarget->resetIndexSource(); | 
| -        } | 
| -        fTarget = NULL; | 
| -    } | 
| -    fVertices = NULL; | 
| -    fIndices = NULL; | 
| -} | 
| - | 
| namespace { | 
| // returns true if the read/written rect intersects the src/dst and false if not. | 
| bool clip_srcrect_and_dstpoint(const GrSurface* dst, | 
|  |