GrPathRenderer* GrAAHairLinePathRenderer::Create(GrContext* context) { GrGpu* gpu = context->getGpu(); GrIndexBuffer* qIdxBuf = gpu->createInstancedIndexBuffer(kQuadIdxBufPattern, kIdxsPerQuad, kQuadsNumInIdxBuffer, kQuadNumVertices); SkAutoTUnref<GrIndexBuffer> qIdxBuffer(qIdxBuf); GrIndexBuffer* lIdxBuf = gpu->createInstancedIndexBuffer(kLineSegIdxBufPattern, kIdxsPerLineSeg, kLineSegsNumInIdxBuffer, kLineSegNumVertices); SkAutoTUnref<GrIndexBuffer> lIdxBuffer(lIdxBuf); return SkNEW_ARGS(GrAAHairLinePathRenderer, (context, lIdxBuf, qIdxBuf)); }
GrPathRenderer* GrAAHairLinePathRenderer::Create(GrContext* context) { const GrIndexBuffer* lIdxBuffer = context->getQuadIndexBuffer(); if (NULL == lIdxBuffer) { return NULL; } GrGpu* gpu = context->getGpu(); GrIndexBuffer* qIdxBuf = gpu->createIndexBuffer(kQuadIdxSBufize, false); SkAutoTUnref<GrIndexBuffer> qIdxBuffer(qIdxBuf); if (NULL == qIdxBuf || !push_quad_index_data(qIdxBuf)) { return NULL; } return SkNEW_ARGS(GrAAHairLinePathRenderer, (context, lIdxBuffer, qIdxBuf)); }
GrPathRenderer* GrAAHairLinePathRenderer::Create(GrContext* context) { if (CanBeUsed(context)) { const GrIndexBuffer* lIdxBuffer = context->getQuadIndexBuffer(); if (NULL == lIdxBuffer) { return NULL; } GrGpu* gpu = context->getGpu(); GrIndexBuffer* qIdxBuf = gpu->createIndexBuffer(kQuadIdxSBufize, false); SkAutoTUnref<GrIndexBuffer> qIdxBuffer(qIdxBuf); // cons will take a ref if (NULL == qIdxBuf || !push_quad_index_data(qIdxBuffer.get())) { return NULL; } return new GrAAHairLinePathRenderer(context, lIdxBuffer, qIdxBuf); } else { return NULL; } }