Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: src/gpu/batches/GrAALinearizingConvexPathRenderer.cpp

Issue 1825393002: Consolidate GPU buffer implementations (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: asserts Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/batches/GrAAHairLinePathRenderer.cpp ('k') | src/gpu/batches/GrAAStrokeRectBatch.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2015 Google Inc. 3 * Copyright 2015 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 "GrAALinearizingConvexPathRenderer.h" 9 #include "GrAALinearizingConvexPathRenderer.h"
10 10
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 fBatch.fCoverageIgnored = !overrides.readsCoverage(); 157 fBatch.fCoverageIgnored = !overrides.readsCoverage();
158 fBatch.fLinesOnly = SkPath::kLine_SegmentMask == fGeoData[0].fPath.getSe gmentMasks(); 158 fBatch.fLinesOnly = SkPath::kLine_SegmentMask == fGeoData[0].fPath.getSe gmentMasks();
159 fBatch.fCanTweakAlphaForCoverage = overrides.canTweakAlphaForCoverage(); 159 fBatch.fCanTweakAlphaForCoverage = overrides.canTweakAlphaForCoverage();
160 } 160 }
161 161
162 void draw(GrVertexBatch::Target* target, const GrPipeline* pipeline, int ver texCount, 162 void draw(GrVertexBatch::Target* target, const GrPipeline* pipeline, int ver texCount,
163 size_t vertexStride, void* vertices, int indexCount, uint16_t* ind ices) const { 163 size_t vertexStride, void* vertices, int indexCount, uint16_t* ind ices) const {
164 if (vertexCount == 0 || indexCount == 0) { 164 if (vertexCount == 0 || indexCount == 0) {
165 return; 165 return;
166 } 166 }
167 const GrVertexBuffer* vertexBuffer; 167 const GrBuffer* vertexBuffer;
168 GrMesh mesh; 168 GrMesh mesh;
169 int firstVertex; 169 int firstVertex;
170 void* verts = target->makeVertexSpace(vertexStride, vertexCount, &vertex Buffer, 170 void* verts = target->makeVertexSpace(vertexStride, vertexCount, &vertex Buffer,
171 &firstVertex); 171 &firstVertex);
172 if (!verts) { 172 if (!verts) {
173 SkDebugf("Could not allocate vertices\n"); 173 SkDebugf("Could not allocate vertices\n");
174 return; 174 return;
175 } 175 }
176 memcpy(verts, vertices, vertexCount * vertexStride); 176 memcpy(verts, vertices, vertexCount * vertexStride);
177 177
178 const GrIndexBuffer* indexBuffer; 178 const GrBuffer* indexBuffer;
179 int firstIndex; 179 int firstIndex;
180 uint16_t* idxs = target->makeIndexSpace(indexCount, &indexBuffer, &first Index); 180 uint16_t* idxs = target->makeIndexSpace(indexCount, &indexBuffer, &first Index);
181 if (!idxs) { 181 if (!idxs) {
182 SkDebugf("Could not allocate indices\n"); 182 SkDebugf("Could not allocate indices\n");
183 return; 183 return;
184 } 184 }
185 memcpy(idxs, indices, indexCount * sizeof(uint16_t)); 185 memcpy(idxs, indices, indexCount * sizeof(uint16_t));
186 mesh.initIndexed(kTriangles_GrPrimitiveType, vertexBuffer, indexBuffer, firstVertex, 186 mesh.initIndexed(kTriangles_GrPrimitiveType, vertexBuffer, indexBuffer, firstVertex,
187 firstIndex, vertexCount, indexCount); 187 firstIndex, vertexCount, indexCount);
188 target->draw(mesh); 188 target->draw(mesh);
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 DRAW_BATCH_TEST_DEFINE(AAFlatteningConvexPathBatch) { 348 DRAW_BATCH_TEST_DEFINE(AAFlatteningConvexPathBatch) {
349 AAFlatteningConvexPathBatch::Geometry geometry; 349 AAFlatteningConvexPathBatch::Geometry geometry;
350 geometry.fColor = GrRandomColor(random); 350 geometry.fColor = GrRandomColor(random);
351 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); 351 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random);
352 geometry.fPath = GrTest::TestPathConvex(random); 352 geometry.fPath = GrTest::TestPathConvex(random);
353 353
354 return AAFlatteningConvexPathBatch::Create(geometry); 354 return AAFlatteningConvexPathBatch::Create(geometry);
355 } 355 }
356 356
357 #endif 357 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrAAHairLinePathRenderer.cpp ('k') | src/gpu/batches/GrAAStrokeRectBatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698