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

Side by Side Diff: src/gpu/effects/GrDistanceFieldGeoProc.h

Issue 1110993002: Revert of removing equality / compute invariant loops from GrGeometryProcessors (Closed) Base URL: https://skia.googlesource.com/skia.git@cleanup1
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/effects/GrDashingEffect.cpp ('k') | src/gpu/effects/GrDistanceFieldGeoProc.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 2013 Google Inc. 2 * Copyright 2013 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 GrDistanceFieldGeoProc_DEFINED 8 #ifndef GrDistanceFieldGeoProc_DEFINED
9 #define GrDistanceFieldGeoProc_DEFINED 9 #define GrDistanceFieldGeoProc_DEFINED
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 * The output color of this effect is a modulation of the input color and a samp le from a 42 * The output color of this effect is a modulation of the input color and a samp le from a
43 * distance field texture (using a smoothed step function near 0.5). 43 * distance field texture (using a smoothed step function near 0.5).
44 * It allows explicit specification of the filtering and wrap modes (GrTexturePa rams). The input 44 * It allows explicit specification of the filtering and wrap modes (GrTexturePa rams). The input
45 * coords are a custom attribute. Gamma correction is handled via a texture LUT. 45 * coords are a custom attribute. Gamma correction is handled via a texture LUT.
46 */ 46 */
47 class GrDistanceFieldA8TextGeoProc : public GrGeometryProcessor { 47 class GrDistanceFieldA8TextGeoProc : public GrGeometryProcessor {
48 public: 48 public:
49 #ifdef SK_GAMMA_APPLY_TO_A8 49 #ifdef SK_GAMMA_APPLY_TO_A8
50 static GrGeometryProcessor* Create(GrColor color, const SkMatrix& viewMatrix , 50 static GrGeometryProcessor* Create(GrColor color, const SkMatrix& viewMatrix ,
51 GrTexture* tex, const GrTextureParams& pa rams, 51 GrTexture* tex, const GrTextureParams& pa rams,
52 float lum, uint32_t flags) { 52 float lum, uint32_t flags, bool opaqueVer texColors) {
53 return SkNEW_ARGS(GrDistanceFieldA8TextGeoProc, (color, viewMatrix, tex, params, lum, 53 return SkNEW_ARGS(GrDistanceFieldA8TextGeoProc, (color, viewMatrix, tex,
54 flags)); 54 params, lum, flags, opa queVertexColors));
55 } 55 }
56 #else 56 #else
57 static GrGeometryProcessor* Create(GrColor color, const SkMatrix& viewMatrix , 57 static GrGeometryProcessor* Create(GrColor color, const SkMatrix& viewMatrix ,
58 GrTexture* tex, const GrTextureParams& pa rams, 58 GrTexture* tex, const GrTextureParams& pa rams,
59 uint32_t flags) { 59 uint32_t flags, bool opaqueVertexColors) {
60 return SkNEW_ARGS(GrDistanceFieldA8TextGeoProc, (color, viewMatrix, tex, params, flags)); 60 return SkNEW_ARGS(GrDistanceFieldA8TextGeoProc, (color, viewMatrix, tex,
61 params, flags, opaqueVe rtexColors));
61 } 62 }
62 #endif 63 #endif
63 64
64 virtual ~GrDistanceFieldA8TextGeoProc() {} 65 virtual ~GrDistanceFieldA8TextGeoProc() {}
65 66
66 const char* name() const override { return "DistanceFieldTexture"; } 67 const char* name() const override { return "DistanceFieldTexture"; }
67 68
68 const Attribute* inPosition() const { return fInPosition; } 69 const Attribute* inPosition() const { return fInPosition; }
69 const Attribute* inColor() const { return fInColor; } 70 const Attribute* inColor() const { return fInColor; }
70 const Attribute* inTextureCoords() const { return fInTextureCoords; } 71 const Attribute* inTextureCoords() const { return fInTextureCoords; }
71 #ifdef SK_GAMMA_APPLY_TO_A8 72 #ifdef SK_GAMMA_APPLY_TO_A8
72 float getDistanceAdjust() const { return fDistanceAdjust; } 73 float getDistanceAdjust() const { return fDistanceAdjust; }
73 #endif 74 #endif
74 uint32_t getFlags() const { return fFlags; } 75 uint32_t getFlags() const { return fFlags; }
75 76
76 virtual void getGLProcessorKey(const GrBatchTracker& bt, 77 virtual void getGLProcessorKey(const GrBatchTracker& bt,
77 const GrGLCaps& caps, 78 const GrGLCaps& caps,
78 GrProcessorKeyBuilder* b) const override; 79 GrProcessorKeyBuilder* b) const override;
79 80
80 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt, 81 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt,
81 const GrGLCaps&) const over ride; 82 const GrGLCaps&) const over ride;
82 83
83 void initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const override; 84 void initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const override;
84 85
86 bool onCanMakeEqual(const GrBatchTracker&,
87 const GrGeometryProcessor&,
88 const GrBatchTracker&) const override;
89
85 private: 90 private:
86 GrDistanceFieldA8TextGeoProc(GrColor, const SkMatrix& viewMatrix, 91 GrDistanceFieldA8TextGeoProc(GrColor, const SkMatrix& viewMatrix,
87 GrTexture* texture, const GrTextureParams& para ms, 92 GrTexture* texture, const GrTextureParams& para ms,
88 #ifdef SK_GAMMA_APPLY_TO_A8 93 #ifdef SK_GAMMA_APPLY_TO_A8
89 float distanceAdjust, 94 float distanceAdjust,
90 #endif 95 #endif
91 uint32_t flags); 96 uint32_t flags, bool opaqueVertexColors);
97
98 bool onIsEqual(const GrGeometryProcessor& other) const override;
99
100 void onGetInvariantOutputCoverage(GrInitInvariantOutput*) const override;
92 101
93 GrTextureAccess fTextureAccess; 102 GrTextureAccess fTextureAccess;
94 #ifdef SK_GAMMA_APPLY_TO_A8 103 #ifdef SK_GAMMA_APPLY_TO_A8
95 float fDistanceAdjust; 104 float fDistanceAdjust;
96 #endif 105 #endif
97 uint32_t fFlags; 106 uint32_t fFlags;
98 const Attribute* fInPosition; 107 const Attribute* fInPosition;
99 const Attribute* fInColor; 108 const Attribute* fInColor;
100 const Attribute* fInTextureCoords; 109 const Attribute* fInTextureCoords;
101 110
102 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; 111 GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
103 112
104 typedef GrGeometryProcessor INHERITED; 113 typedef GrGeometryProcessor INHERITED;
105 }; 114 };
106 115
107 116
108 /** 117 /**
109 * The output color of this effect is a modulation of the input color and a sampl e from a 118 * The output color of this effect is a modulation of the input color and a sampl e from a
110 * distance field texture (using a smoothed step function near 0.5). 119 * distance field texture (using a smoothed step function near 0.5).
111 * It allows explicit specification of the filtering and wrap modes (GrTexturePar ams). The input 120 * It allows explicit specification of the filtering and wrap modes (GrTexturePar ams). The input
112 * coords are a custom attribute. No gamma correct blending is applied. Used for paths only. 121 * coords are a custom attribute. No gamma correct blending is applied. Used for paths only.
113 */ 122 */
114 class GrDistanceFieldPathGeoProc : public GrGeometryProcessor { 123 class GrDistanceFieldPathGeoProc : public GrGeometryProcessor {
115 public: 124 public:
116 static GrGeometryProcessor* Create(GrColor color, const SkMatrix& viewMatrix , GrTexture* tex, 125 static GrGeometryProcessor* Create(GrColor color, const SkMatrix& viewMatrix , GrTexture* tex,
117 const GrTextureParams& params, 126 const GrTextureParams& params,
118 uint32_t flags) { 127 uint32_t flags, bool opaqueVertexColors) {
119 return SkNEW_ARGS(GrDistanceFieldPathGeoProc, (color, viewMatrix, tex, p arams, flags)); 128 return SkNEW_ARGS(GrDistanceFieldPathGeoProc, (color, viewMatrix, tex, p arams,
129 flags, opaqueVertexColors ));
120 } 130 }
121 131
122 virtual ~GrDistanceFieldPathGeoProc() {} 132 virtual ~GrDistanceFieldPathGeoProc() {}
123 133
124 const char* name() const override { return "DistanceFieldTexture"; } 134 const char* name() const override { return "DistanceFieldTexture"; }
125 135
126 const Attribute* inPosition() const { return fInPosition; } 136 const Attribute* inPosition() const { return fInPosition; }
127 const Attribute* inColor() const { return fInColor; } 137 const Attribute* inColor() const { return fInColor; }
128 const Attribute* inTextureCoords() const { return fInTextureCoords; } 138 const Attribute* inTextureCoords() const { return fInTextureCoords; }
129 uint32_t getFlags() const { return fFlags; } 139 uint32_t getFlags() const { return fFlags; }
130 140
131 virtual void getGLProcessorKey(const GrBatchTracker& bt, 141 virtual void getGLProcessorKey(const GrBatchTracker& bt,
132 const GrGLCaps& caps, 142 const GrGLCaps& caps,
133 GrProcessorKeyBuilder* b) const override; 143 GrProcessorKeyBuilder* b) const override;
134 144
135 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt, 145 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt,
136 const GrGLCaps&) const over ride; 146 const GrGLCaps&) const over ride;
137 147
138 void initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const override; 148 void initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const override;
139 149
150 bool onCanMakeEqual(const GrBatchTracker&,
151 const GrGeometryProcessor&,
152 const GrBatchTracker&) const override;
153
140 private: 154 private:
141 GrDistanceFieldPathGeoProc(GrColor, const SkMatrix& viewMatrix, GrTexture* t exture, 155 GrDistanceFieldPathGeoProc(GrColor, const SkMatrix& viewMatrix, GrTexture* t exture,
142 const GrTextureParams& params, uint32_t flags); 156 const GrTextureParams& params, uint32_t flags,
157 bool opaqueVertexColors);
158
159 bool onIsEqual(const GrGeometryProcessor& other) const override;
160
161 void onGetInvariantOutputCoverage(GrInitInvariantOutput*) const override;
143 162
144 GrTextureAccess fTextureAccess; 163 GrTextureAccess fTextureAccess;
145 uint32_t fFlags; 164 uint32_t fFlags;
146 const Attribute* fInPosition; 165 const Attribute* fInPosition;
147 const Attribute* fInColor; 166 const Attribute* fInColor;
148 const Attribute* fInTextureCoords; 167 const Attribute* fInTextureCoords;
149 168
150 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; 169 GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
151 170
152 typedef GrGeometryProcessor INHERITED; 171 typedef GrGeometryProcessor INHERITED;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 212
194 virtual void getGLProcessorKey(const GrBatchTracker& bt, 213 virtual void getGLProcessorKey(const GrBatchTracker& bt,
195 const GrGLCaps& caps, 214 const GrGLCaps& caps,
196 GrProcessorKeyBuilder* b) const override; 215 GrProcessorKeyBuilder* b) const override;
197 216
198 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt, 217 virtual GrGLPrimitiveProcessor* createGLInstance(const GrBatchTracker& bt,
199 const GrGLCaps&) const over ride; 218 const GrGLCaps&) const over ride;
200 219
201 void initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const override; 220 void initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const override;
202 221
222 bool onCanMakeEqual(const GrBatchTracker&,
223 const GrGeometryProcessor&,
224 const GrBatchTracker&) const override;
225
203 private: 226 private:
204 GrDistanceFieldLCDTextGeoProc(GrColor, const SkMatrix& viewMatrix, 227 GrDistanceFieldLCDTextGeoProc(GrColor, const SkMatrix& viewMatrix,
205 GrTexture* texture, const GrTextureParams& par ams, 228 GrTexture* texture, const GrTextureParams& par ams,
206 DistanceAdjust wa, uint32_t flags); 229 DistanceAdjust wa, uint32_t flags);
207 230
231 bool onIsEqual(const GrGeometryProcessor& other) const override;
232
233 void onGetInvariantOutputCoverage(GrInitInvariantOutput*) const override;
234
208 GrTextureAccess fTextureAccess; 235 GrTextureAccess fTextureAccess;
209 DistanceAdjust fDistanceAdjust; 236 DistanceAdjust fDistanceAdjust;
210 uint32_t fFlags; 237 uint32_t fFlags;
211 const Attribute* fInPosition; 238 const Attribute* fInPosition;
212 const Attribute* fInTextureCoords; 239 const Attribute* fInTextureCoords;
213 240
214 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; 241 GR_DECLARE_GEOMETRY_PROCESSOR_TEST;
215 242
216 typedef GrGeometryProcessor INHERITED; 243 typedef GrGeometryProcessor INHERITED;
217 }; 244 };
218 245
219 #endif 246 #endif
OLDNEW
« no previous file with comments | « src/gpu/effects/GrDashingEffect.cpp ('k') | src/gpu/effects/GrDistanceFieldGeoProc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698