OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "GrAADistanceFieldPathRenderer.h" | 9 #include "GrAADistanceFieldPathRenderer.h" |
10 | 10 |
11 #include "GrBatch.h" | 11 #include "GrBatch.h" |
12 #include "GrBatchTarget.h" | 12 #include "GrBatchTarget.h" |
13 #include "GrBufferAllocPool.h" | |
14 #include "GrContext.h" | 13 #include "GrContext.h" |
15 #include "GrPipelineBuilder.h" | 14 #include "GrPipelineBuilder.h" |
16 #include "GrResourceProvider.h" | 15 #include "GrResourceProvider.h" |
17 #include "GrSurfacePriv.h" | 16 #include "GrSurfacePriv.h" |
18 #include "GrSWMaskHelper.h" | 17 #include "GrSWMaskHelper.h" |
19 #include "GrTexturePriv.h" | 18 #include "GrTexturePriv.h" |
20 #include "GrVertexBuffer.h" | 19 #include "GrVertexBuffer.h" |
21 #include "effects/GrDistanceFieldGeoProc.h" | 20 #include "effects/GrDistanceFieldGeoProc.h" |
22 | 21 |
23 #include "SkDistanceFieldGen.h" | 22 #include "SkDistanceFieldGen.h" |
(...skipping 178 matching lines...) Loading... |
202 | 201 |
203 this->initDraw(batchTarget, dfProcessor, pipeline); | 202 this->initDraw(batchTarget, dfProcessor, pipeline); |
204 | 203 |
205 FlushInfo flushInfo; | 204 FlushInfo flushInfo; |
206 | 205 |
207 // allocate vertices | 206 // allocate vertices |
208 size_t vertexStride = dfProcessor->getVertexStride(); | 207 size_t vertexStride = dfProcessor->getVertexStride(); |
209 SkASSERT(vertexStride == 2 * sizeof(SkPoint)); | 208 SkASSERT(vertexStride == 2 * sizeof(SkPoint)); |
210 | 209 |
211 const GrVertexBuffer* vertexBuffer; | 210 const GrVertexBuffer* vertexBuffer; |
212 void* vertices = batchTarget->vertexPool()->makeSpace(vertexStride, | 211 void* vertices = batchTarget->makeVertSpace(vertexStride, |
213 kVerticesPerQuad *
instanceCount, | 212 kVerticesPerQuad * instanceC
ount, |
214 &vertexBuffer, | 213 &vertexBuffer, |
215 &flushInfo.fVertex
Offset); | 214 &flushInfo.fVertexOffset); |
216 flushInfo.fVertexBuffer.reset(SkRef(vertexBuffer)); | 215 flushInfo.fVertexBuffer.reset(SkRef(vertexBuffer)); |
217 flushInfo.fIndexBuffer.reset(batchTarget->resourceProvider()->refQuadInd
exBuffer()); | 216 flushInfo.fIndexBuffer.reset(batchTarget->resourceProvider()->refQuadInd
exBuffer()); |
218 if (!vertices || !flushInfo.fIndexBuffer) { | 217 if (!vertices || !flushInfo.fIndexBuffer) { |
219 SkDebugf("Could not allocate vertices\n"); | 218 SkDebugf("Could not allocate vertices\n"); |
220 return; | 219 return; |
221 } | 220 } |
222 | 221 |
223 flushInfo.fInstancesToFlush = 0; | 222 flushInfo.fInstancesToFlush = 0; |
224 for (int i = 0; i < instanceCount; i++) { | 223 for (int i = 0; i < instanceCount; i++) { |
225 Geometry& args = fGeoData[i]; | 224 Geometry& args = fGeoData[i]; |
(...skipping 370 matching lines...) Loading... |
596 geometry.fPath = path; | 595 geometry.fPath = path; |
597 geometry.fAntiAlias = antiAlias; | 596 geometry.fAntiAlias = antiAlias; |
598 | 597 |
599 SkAutoTUnref<GrBatch> batch(AADistanceFieldPathBatch::Create(geometry, color
, viewMatrix, | 598 SkAutoTUnref<GrBatch> batch(AADistanceFieldPathBatch::Create(geometry, color
, viewMatrix, |
600 fAtlas, &fPathC
ache, &fPathList)); | 599 fAtlas, &fPathC
ache, &fPathList)); |
601 target->drawBatch(pipelineBuilder, batch); | 600 target->drawBatch(pipelineBuilder, batch); |
602 | 601 |
603 return true; | 602 return true; |
604 } | 603 } |
605 | 604 |
OLD | NEW |