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

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

Issue 1806983002: Update how we send draws to gpu backend to reduce state setting. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: nit Created 4 years, 9 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/GrTInstanceBatch.h ('k') | src/gpu/batches/GrTestBatch.h » ('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 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrTessellatingPathRenderer.h" 8 #include "GrTessellatingPathRenderer.h"
9 9
10 #include "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
11 #include "GrBatchTest.h" 11 #include "GrBatchTest.h"
12 #include "GrDefaultGeoProcFactory.h" 12 #include "GrDefaultGeoProcFactory.h"
13 #include "GrMesh.h"
13 #include "GrPathUtils.h" 14 #include "GrPathUtils.h"
14 #include "GrVertices.h"
15 #include "GrResourceCache.h" 15 #include "GrResourceCache.h"
16 #include "GrResourceProvider.h" 16 #include "GrResourceProvider.h"
17 #include "GrTessellator.h" 17 #include "GrTessellator.h"
18 #include "SkGeometry.h" 18 #include "SkGeometry.h"
19 19
20 #include "batches/GrVertexBatch.h" 20 #include "batches/GrVertexBatch.h"
21 21
22 #include <stdio.h> 22 #include <stdio.h>
23 23
24 /* 24 /*
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 } 221 }
222 Coverage coverage(coverageType); 222 Coverage coverage(coverageType);
223 gp.reset(GrDefaultGeoProcFactory::Create(color, coverage, localCoord s, 223 gp.reset(GrDefaultGeoProcFactory::Create(color, coverage, localCoord s,
224 fViewMatrix)); 224 fViewMatrix));
225 } 225 }
226 this->draw(target, gp.get()); 226 this->draw(target, gp.get());
227 } 227 }
228 228
229 void drawVertices(Target* target, const GrGeometryProcessor* gp, const GrVer texBuffer* vb, 229 void drawVertices(Target* target, const GrGeometryProcessor* gp, const GrVer texBuffer* vb,
230 int firstVertex, int count) const { 230 int firstVertex, int count) const {
231 target->initDraw(gp, this->pipeline());
232 SkASSERT(gp->getVertexStride() == sizeof(SkPoint)); 231 SkASSERT(gp->getVertexStride() == sizeof(SkPoint));
233 232
234 GrPrimitiveType primitiveType = TESSELLATOR_WIREFRAME ? kLines_GrPrimiti veType 233 GrPrimitiveType primitiveType = TESSELLATOR_WIREFRAME ? kLines_GrPrimiti veType
235 : kTriangles_GrPri mitiveType; 234 : kTriangles_GrPri mitiveType;
236 GrVertices vertices; 235 target->initDraw(gp);
237 vertices.init(primitiveType, vb, firstVertex, count); 236
238 target->draw(vertices); 237 GrMesh mesh;
238 mesh.init(primitiveType, vb, firstVertex, count);
239 target->draw(mesh);
239 } 240 }
240 241
241 bool onCombineIfPossible(GrBatch*, const GrCaps&) override { return false; } 242 bool onCombineIfPossible(GrBatch*, const GrCaps&) override { return false; }
242 243
243 TessellatingPathBatch(const GrColor& color, 244 TessellatingPathBatch(const GrColor& color,
244 const SkPath& path, 245 const SkPath& path,
245 const GrStrokeInfo& stroke, 246 const GrStrokeInfo& stroke,
246 const SkMatrix& viewMatrix, 247 const SkMatrix& viewMatrix,
247 const SkRect& clipBounds) 248 const SkRect& clipBounds)
248 : INHERITED(ClassID()) 249 : INHERITED(ClassID())
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 bool result = viewMatrix.invert(&vmi); 322 bool result = viewMatrix.invert(&vmi);
322 if (!result) { 323 if (!result) {
323 SkFAIL("Cannot invert matrix\n"); 324 SkFAIL("Cannot invert matrix\n");
324 } 325 }
325 vmi.mapRect(&clipBounds); 326 vmi.mapRect(&clipBounds);
326 GrStrokeInfo strokeInfo = GrTest::TestStrokeInfo(random); 327 GrStrokeInfo strokeInfo = GrTest::TestStrokeInfo(random);
327 return TessellatingPathBatch::Create(color, path, strokeInfo, viewMatrix, cl ipBounds); 328 return TessellatingPathBatch::Create(color, path, strokeInfo, viewMatrix, cl ipBounds);
328 } 329 }
329 330
330 #endif 331 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrTInstanceBatch.h ('k') | src/gpu/batches/GrTestBatch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698