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

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

Issue 1352813003: add a ClassID function to GrBatch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks 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
214 struct Geometry { 216 struct Geometry {
215 GrColor fColor; 217 GrColor fColor;
216 SkPath fPath; 218 SkPath fPath;
217 SkScalar fTolerance; 219 SkScalar fTolerance;
218 }; 220 };
219 221
220 static GrDrawBatch* Create(const Geometry& geometry, uint8_t coverage, 222 static GrDrawBatch* Create(const Geometry& geometry, uint8_t coverage,
221 const SkMatrix& viewMatrix, bool isHairline, 223 const SkMatrix& viewMatrix, bool isHairline,
222 const SkRect& devBounds) { 224 const SkRect& devBounds) {
223 return new DefaultPathBatch(geometry, coverage, viewMatrix, isHairline, devBounds); 225 return new DefaultPathBatch(geometry, coverage, viewMatrix, isHairline, devBounds);
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 target->draw(vertices); 371 target->draw(vertices);
370 372
371 // put back reserves 373 // put back reserves
372 target->putBackIndices((size_t)(maxIndices - indexOffset)); 374 target->putBackIndices((size_t)(maxIndices - indexOffset));
373 target->putBackVertices((size_t)(maxVertices - vertexOffset), (size_t)ve rtexStride); 375 target->putBackVertices((size_t)(maxVertices - vertexOffset), (size_t)ve rtexStride);
374 } 376 }
375 377
376 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } 378 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
377 379
378 DefaultPathBatch(const Geometry& geometry, uint8_t coverage, const SkMatrix& viewMatrix, 380 DefaultPathBatch(const Geometry& geometry, uint8_t coverage, const SkMatrix& viewMatrix,
379 bool isHairline, const SkRect& devBounds) { 381 bool isHairline, const SkRect& devBounds)
380 this->initClassID<DefaultPathBatch>(); 382 : INHERITED(ClassID()) {
381 fBatch.fCoverage = coverage; 383 fBatch.fCoverage = coverage;
382 fBatch.fIsHairline = isHairline; 384 fBatch.fIsHairline = isHairline;
383 fBatch.fViewMatrix = viewMatrix; 385 fBatch.fViewMatrix = viewMatrix;
384 fGeoData.push_back(geometry); 386 fGeoData.push_back(geometry);
385 387
386 this->setBounds(devBounds); 388 this->setBounds(devBounds);
387 } 389 }
388 390
389 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { 391 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
390 DefaultPathBatch* that = t->cast<DefaultPathBatch>(); 392 DefaultPathBatch* that = t->cast<DefaultPathBatch>();
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 uint8_t fCoverage; 525 uint8_t fCoverage;
524 SkMatrix fViewMatrix; 526 SkMatrix fViewMatrix;
525 bool fUsesLocalCoords; 527 bool fUsesLocalCoords;
526 bool fColorIgnored; 528 bool fColorIgnored;
527 bool fCoverageIgnored; 529 bool fCoverageIgnored;
528 bool fIsHairline; 530 bool fIsHairline;
529 }; 531 };
530 532
531 BatchTracker fBatch; 533 BatchTracker fBatch;
532 SkSTArray<1, Geometry, true> fGeoData; 534 SkSTArray<1, Geometry, true> fGeoData;
535
536 typedef GrVertexBatch INHERITED;
533 }; 537 };
534 538
535 bool GrDefaultPathRenderer::internalDrawPath(GrDrawTarget* target, 539 bool GrDefaultPathRenderer::internalDrawPath(GrDrawTarget* target,
536 GrPipelineBuilder* pipelineBuilder, 540 GrPipelineBuilder* pipelineBuilder,
537 GrColor color, 541 GrColor color,
538 const SkMatrix& viewMatrix, 542 const SkMatrix& viewMatrix,
539 const SkPath& path, 543 const SkPath& path,
540 const GrStrokeInfo& origStroke, 544 const GrStrokeInfo& origStroke,
541 bool stencilOnly) { 545 bool stencilOnly) {
542 SkTCopyOnFirstWrite<GrStrokeInfo> stroke(origStroke); 546 SkTCopyOnFirstWrite<GrStrokeInfo> stroke(origStroke);
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 geometry.fColor = color; 756 geometry.fColor = color;
753 geometry.fPath = path; 757 geometry.fPath = path;
754 geometry.fTolerance = srcSpaceTol; 758 geometry.fTolerance = srcSpaceTol;
755 759
756 viewMatrix.mapRect(&bounds); 760 viewMatrix.mapRect(&bounds);
757 uint8_t coverage = GrRandomCoverage(random); 761 uint8_t coverage = GrRandomCoverage(random);
758 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds ); 762 return DefaultPathBatch::Create(geometry, coverage, viewMatrix, true, bounds );
759 } 763 }
760 764
761 #endif 765 #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