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

Side by Side Diff: src/gpu/GrDefaultPathRenderer.cpp

Issue 1132323003: Revert of Preliminary attempt to remove batch tracker (Closed) Base URL: https://skia.googlesource.com/skia.git@cleanup5
Patch Set: Created 5 years, 7 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/GrDefaultGeoProcFactory.cpp ('k') | src/gpu/GrGeometryProcessor.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 2011 Google Inc. 2 * Copyright 2011 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 "GrDefaultPathRenderer.h" 8 #include "GrDefaultPathRenderer.h"
9 9
10 #include "GrBatch.h" 10 #include "GrBatch.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 fBatch.fColorIgnored = init.fColorIgnored; 247 fBatch.fColorIgnored = init.fColorIgnored;
248 fBatch.fColor = fGeoData[0].fColor; 248 fBatch.fColor = fGeoData[0].fColor;
249 fBatch.fUsesLocalCoords = init.fUsesLocalCoords; 249 fBatch.fUsesLocalCoords = init.fUsesLocalCoords;
250 fBatch.fCoverageIgnored = init.fCoverageIgnored; 250 fBatch.fCoverageIgnored = init.fCoverageIgnored;
251 } 251 }
252 252
253 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline ) override { 253 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline ) override {
254 SkAutoTUnref<const GrGeometryProcessor> gp( 254 SkAutoTUnref<const GrGeometryProcessor> gp(
255 GrDefaultGeoProcFactory::Create(GrDefaultGeoProcFactory::kPositi on_GPType, 255 GrDefaultGeoProcFactory::Create(GrDefaultGeoProcFactory::kPositi on_GPType,
256 this->color(), 256 this->color(),
257 this->usesLocalCoords(),
258 this->coverageIgnored(),
259 this->viewMatrix(), 257 this->viewMatrix(),
260 SkMatrix::I(), 258 SkMatrix::I(),
261 this->coverage())); 259 this->coverage()));
262 260
263 size_t vertexStride = gp->getVertexStride(); 261 size_t vertexStride = gp->getVertexStride();
264 SkASSERT(vertexStride == sizeof(SkPoint)); 262 SkASSERT(vertexStride == sizeof(SkPoint));
265 263
266 batchTarget->initDraw(gp, pipeline); 264 batchTarget->initDraw(gp, pipeline);
267 265
266 // TODO this is hacky, but the only way we have to initialize the GP is to use the
267 // GrPipelineInfo struct so we can generate the correct shader. Once we have GrBatch
268 // everywhere we can remove this nastiness
269 GrPipelineInfo init;
270 init.fColorIgnored = fBatch.fColorIgnored;
271 init.fOverrideColor = GrColor_ILLEGAL;
272 init.fCoverageIgnored = fBatch.fCoverageIgnored;
273 init.fUsesLocalCoords = this->usesLocalCoords();
274 gp->initBatchTracker(batchTarget->currentBatchTracker(), init);
275
268 int instanceCount = fGeoData.count(); 276 int instanceCount = fGeoData.count();
269 277
270 // compute number of vertices 278 // compute number of vertices
271 int maxVertices = 0; 279 int maxVertices = 0;
272 280
273 // We will use index buffers if we have multiple paths or one path with multiple contours 281 // We will use index buffers if we have multiple paths or one path with multiple contours
274 bool isIndexed = instanceCount > 1; 282 bool isIndexed = instanceCount > 1;
275 for (int i = 0; i < instanceCount; i++) { 283 for (int i = 0; i < instanceCount; i++) {
276 Geometry& args = fGeoData[i]; 284 Geometry& args = fGeoData[i];
277 285
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 511
504 } 512 }
505 return true; 513 return true;
506 } 514 }
507 515
508 GrColor color() const { return fBatch.fColor; } 516 GrColor color() const { return fBatch.fColor; }
509 uint8_t coverage() const { return fBatch.fCoverage; } 517 uint8_t coverage() const { return fBatch.fCoverage; }
510 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } 518 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; }
511 const SkMatrix& viewMatrix() const { return fBatch.fViewMatrix; } 519 const SkMatrix& viewMatrix() const { return fBatch.fViewMatrix; }
512 bool isHairline() const { return fBatch.fIsHairline; } 520 bool isHairline() const { return fBatch.fIsHairline; }
513 bool coverageIgnored() const { return fBatch.fCoverageIgnored; }
514 521
515 struct BatchTracker { 522 struct BatchTracker {
516 GrColor fColor; 523 GrColor fColor;
517 uint8_t fCoverage; 524 uint8_t fCoverage;
518 SkMatrix fViewMatrix; 525 SkMatrix fViewMatrix;
519 bool fUsesLocalCoords; 526 bool fUsesLocalCoords;
520 bool fColorIgnored; 527 bool fColorIgnored;
521 bool fCoverageIgnored; 528 bool fCoverageIgnored;
522 bool fIsHairline; 529 bool fIsHairline;
523 }; 530 };
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 geometry.fColor = color; 766 geometry.fColor = color;
760 geometry.fPath = path; 767 geometry.fPath = path;
761 geometry.fTolerance = srcSpaceTol; 768 geometry.fTolerance = srcSpaceTol;
762 769
763 viewMatrix.mapRect(&bounds); 770 viewMatrix.mapRect(&bounds);
764 uint8_t coverage = GrRandomCoverage(random); 771 uint8_t coverage = GrRandomCoverage(random);
765 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds ); 772 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds );
766 } 773 }
767 774
768 #endif 775 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrDefaultGeoProcFactory.cpp ('k') | src/gpu/GrGeometryProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698