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

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

Issue 1345393003: Revert of add a ClassID function to GrBatch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 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/GrCopySurfaceBatch.h ('k') | src/gpu/batches/GrDiscardBatch.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 "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 if (indexed) { 204 if (indexed) {
205 for (uint16_t i = 0; i < numPts; ++i) { 205 for (uint16_t i = 0; i < numPts; ++i) {
206 append_countour_edge_indices(isHairline, subpathIdxStart, 206 append_countour_edge_indices(isHairline, subpathIdxStart,
207 firstQPtIdx + i, idx); 207 firstQPtIdx + i, idx);
208 } 208 }
209 } 209 }
210 } 210 }
211 211
212 class DefaultPathBatch : public GrVertexBatch { 212 class DefaultPathBatch : public GrVertexBatch {
213 public: 213 public:
214 DEFINE_BATCH_CLASS_ID
215
216 struct Geometry { 214 struct Geometry {
217 GrColor fColor; 215 GrColor fColor;
218 SkPath fPath; 216 SkPath fPath;
219 SkScalar fTolerance; 217 SkScalar fTolerance;
220 }; 218 };
221 219
222 static GrDrawBatch* Create(const Geometry& geometry, uint8_t coverage, 220 static GrDrawBatch* Create(const Geometry& geometry, uint8_t coverage,
223 const SkMatrix& viewMatrix, bool isHairline, 221 const SkMatrix& viewMatrix, bool isHairline,
224 const SkRect& devBounds) { 222 const SkRect& devBounds) {
225 return new DefaultPathBatch(geometry, coverage, viewMatrix, isHairline, devBounds); 223 return new DefaultPathBatch(geometry, coverage, viewMatrix, isHairline, devBounds);
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 target->draw(vertices); 369 target->draw(vertices);
372 370
373 // put back reserves 371 // put back reserves
374 target->putBackIndices((size_t)(maxIndices - indexOffset)); 372 target->putBackIndices((size_t)(maxIndices - indexOffset));
375 target->putBackVertices((size_t)(maxVertices - vertexOffset), (size_t)ve rtexStride); 373 target->putBackVertices((size_t)(maxVertices - vertexOffset), (size_t)ve rtexStride);
376 } 374 }
377 375
378 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } 376 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
379 377
380 DefaultPathBatch(const Geometry& geometry, uint8_t coverage, const SkMatrix& viewMatrix, 378 DefaultPathBatch(const Geometry& geometry, uint8_t coverage, const SkMatrix& viewMatrix,
381 bool isHairline, const SkRect& devBounds) 379 bool isHairline, const SkRect& devBounds) {
382 : INHERITED(ClassID()) { 380 this->initClassID<DefaultPathBatch>();
383 fBatch.fCoverage = coverage; 381 fBatch.fCoverage = coverage;
384 fBatch.fIsHairline = isHairline; 382 fBatch.fIsHairline = isHairline;
385 fBatch.fViewMatrix = viewMatrix; 383 fBatch.fViewMatrix = viewMatrix;
386 fGeoData.push_back(geometry); 384 fGeoData.push_back(geometry);
387 385
388 this->setBounds(devBounds); 386 this->setBounds(devBounds);
389 } 387 }
390 388
391 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { 389 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
392 DefaultPathBatch* that = t->cast<DefaultPathBatch>(); 390 DefaultPathBatch* that = t->cast<DefaultPathBatch>();
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 uint8_t fCoverage; 523 uint8_t fCoverage;
526 SkMatrix fViewMatrix; 524 SkMatrix fViewMatrix;
527 bool fUsesLocalCoords; 525 bool fUsesLocalCoords;
528 bool fColorIgnored; 526 bool fColorIgnored;
529 bool fCoverageIgnored; 527 bool fCoverageIgnored;
530 bool fIsHairline; 528 bool fIsHairline;
531 }; 529 };
532 530
533 BatchTracker fBatch; 531 BatchTracker fBatch;
534 SkSTArray<1, Geometry, true> fGeoData; 532 SkSTArray<1, Geometry, true> fGeoData;
535
536 typedef GrVertexBatch INHERITED;
537 }; 533 };
538 534
539 bool GrDefaultPathRenderer::internalDrawPath(GrDrawTarget* target, 535 bool GrDefaultPathRenderer::internalDrawPath(GrDrawTarget* target,
540 GrPipelineBuilder* pipelineBuilder, 536 GrPipelineBuilder* pipelineBuilder,
541 GrColor color, 537 GrColor color,
542 const SkMatrix& viewMatrix, 538 const SkMatrix& viewMatrix,
543 const SkPath& path, 539 const SkPath& path,
544 const GrStrokeInfo& origStroke, 540 const GrStrokeInfo& origStroke,
545 bool stencilOnly) { 541 bool stencilOnly) {
546 SkTCopyOnFirstWrite<GrStrokeInfo> stroke(origStroke); 542 SkTCopyOnFirstWrite<GrStrokeInfo> stroke(origStroke);
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 geometry.fColor = color; 752 geometry.fColor = color;
757 geometry.fPath = path; 753 geometry.fPath = path;
758 geometry.fTolerance = srcSpaceTol; 754 geometry.fTolerance = srcSpaceTol;
759 755
760 viewMatrix.mapRect(&bounds); 756 viewMatrix.mapRect(&bounds);
761 uint8_t coverage = GrRandomCoverage(random); 757 uint8_t coverage = GrRandomCoverage(random);
762 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds ); 758 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds );
763 } 759 }
764 760
765 #endif 761 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrCopySurfaceBatch.h ('k') | src/gpu/batches/GrDiscardBatch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698