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)); }
const GrIndexBuffer* GrGpu::getQuadIndexBuffer() const { if (NULL == fQuadIndexBuffer || fQuadIndexBuffer->wasDestroyed()) { SkSafeUnref(fQuadIndexBuffer); GrGpu* me = const_cast<GrGpu*>(this); fQuadIndexBuffer = me->createInstancedIndexBuffer(gQuadIndexPattern, 6, MAX_QUADS, 4); } return fQuadIndexBuffer; }