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

Side by Side Diff: src/gpu/GrTestBatch.h

Issue 1275083002: Don't pass pipeline to GrBatch::generateGeometry() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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/GrTessellatingPathRenderer.cpp ('k') | src/gpu/effects/GrDashingEffect.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 * 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 #ifndef GrTestBatch_DEFINED 8 #ifndef GrTestBatch_DEFINED
9 #define GrTestBatch_DEFINED 9 #define GrTestBatch_DEFINED
10 10
(...skipping 28 matching lines...) Expand all
39 } 39 }
40 init.getOverrideColorIfSet(&this->geoData(0)->fColor); 40 init.getOverrideColorIfSet(&this->geoData(0)->fColor);
41 41
42 // setup batch properties 42 // setup batch properties
43 fBatch.fColorIgnored = !init.readsColor(); 43 fBatch.fColorIgnored = !init.readsColor();
44 fBatch.fColor = this->geoData(0)->fColor; 44 fBatch.fColor = this->geoData(0)->fColor;
45 fBatch.fUsesLocalCoords = init.readsLocalCoords(); 45 fBatch.fUsesLocalCoords = init.readsLocalCoords();
46 fBatch.fCoverageIgnored = !init.readsCoverage(); 46 fBatch.fCoverageIgnored = !init.readsCoverage();
47 } 47 }
48 48
49 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline ) override { 49 void generateGeometry(GrBatchTarget* batchTarget) override {
50 batchTarget->initDraw(fGeometryProcessor, pipeline); 50 batchTarget->initDraw(fGeometryProcessor, this->pipeline());
51 51
52 this->onGenerateGeometry(batchTarget, pipeline); 52 this->onGenerateGeometry(batchTarget);
53 } 53 }
54 54
55 protected: 55 protected:
56 GrTestBatch(const GrGeometryProcessor* gp, const SkRect& bounds) { 56 GrTestBatch(const GrGeometryProcessor* gp, const SkRect& bounds) {
57 fGeometryProcessor.reset(SkRef(gp)); 57 fGeometryProcessor.reset(SkRef(gp));
58 58
59 this->setBounds(bounds); 59 this->setBounds(bounds);
60 } 60 }
61 61
62 const GrGeometryProcessor* geometryProcessor() const { return fGeometryProce ssor; } 62 const GrGeometryProcessor* geometryProcessor() const { return fGeometryProce ssor; }
63 63
64 private: 64 private:
65 virtual Geometry* geoData(int index) = 0; 65 virtual Geometry* geoData(int index) = 0;
66 virtual const Geometry* geoData(int index) const = 0; 66 virtual const Geometry* geoData(int index) const = 0;
67 67
68 bool onCombineIfPossible(GrBatch* t) override { 68 bool onCombineIfPossible(GrBatch* t) override {
69 return false; 69 return false;
70 } 70 }
71 71
72 virtual void onGenerateGeometry(GrBatchTarget* batchTarget, const GrPipeline * pipeline) = 0; 72 virtual void onGenerateGeometry(GrBatchTarget* batchTarget) = 0;
73 73
74 struct BatchTracker { 74 struct BatchTracker {
75 GrColor fColor; 75 GrColor fColor;
76 bool fUsesLocalCoords; 76 bool fUsesLocalCoords;
77 bool fColorIgnored; 77 bool fColorIgnored;
78 bool fCoverageIgnored; 78 bool fCoverageIgnored;
79 }; 79 };
80 80
81 SkAutoTUnref<const GrGeometryProcessor> fGeometryProcessor; 81 SkAutoTUnref<const GrGeometryProcessor> fGeometryProcessor;
82 BatchTracker fBatch; 82 BatchTracker fBatch;
83 }; 83 };
84 84
85 #endif 85 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrTessellatingPathRenderer.cpp ('k') | src/gpu/effects/GrDashingEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698