OLD | NEW |
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, bool usesLocal
Coords) { | 52 float lum, uint32_t flags, bool usesLocal
Coords) { |
53 return SkNEW_ARGS(GrDistanceFieldA8TextGeoProc, (color, viewMatrix, tex,
params, lum, | 53 return new GrDistanceFieldA8TextGeoProc(color, viewMatrix, tex, params,
lum, flags, |
54 flags, usesLocalCoords)
); | 54 usesLocalCoords); |
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, bool usesLocalCoords) { | 59 uint32_t flags, bool usesLocalCoords) { |
60 return SkNEW_ARGS(GrDistanceFieldA8TextGeoProc, (color, viewMatrix, tex,
params, flags, | 60 return new GrDistanceFieldA8TextGeoProc(color, viewMatrix, tex, params,
flags, |
61 usesLocalCoords)); | 61 usesLocalCoords); |
62 } | 62 } |
63 #endif | 63 #endif |
64 | 64 |
65 virtual ~GrDistanceFieldA8TextGeoProc() {} | 65 virtual ~GrDistanceFieldA8TextGeoProc() {} |
66 | 66 |
67 const char* name() const override { return "DistanceFieldTexture"; } | 67 const char* name() const override { return "DistanceFieldTexture"; } |
68 | 68 |
69 const Attribute* inPosition() const { return fInPosition; } | 69 const Attribute* inPosition() const { return fInPosition; } |
70 const Attribute* inColor() const { return fInColor; } | 70 const Attribute* inColor() const { return fInColor; } |
71 const Attribute* inTextureCoords() const { return fInTextureCoords; } | 71 const Attribute* inTextureCoords() const { return fInTextureCoords; } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 * The output color of this effect is a modulation of the input color and a sampl
e from a | 116 * The output color of this effect is a modulation of the input color and a sampl
e from a |
117 * distance field texture (using a smoothed step function near 0.5). | 117 * distance field texture (using a smoothed step function near 0.5). |
118 * It allows explicit specification of the filtering and wrap modes (GrTexturePar
ams). The input | 118 * It allows explicit specification of the filtering and wrap modes (GrTexturePar
ams). The input |
119 * coords are a custom attribute. No gamma correct blending is applied. Used for
paths only. | 119 * coords are a custom attribute. No gamma correct blending is applied. Used for
paths only. |
120 */ | 120 */ |
121 class GrDistanceFieldPathGeoProc : public GrGeometryProcessor { | 121 class GrDistanceFieldPathGeoProc : public GrGeometryProcessor { |
122 public: | 122 public: |
123 static GrGeometryProcessor* Create(GrColor color, const SkMatrix& viewMatrix
, GrTexture* tex, | 123 static GrGeometryProcessor* Create(GrColor color, const SkMatrix& viewMatrix
, GrTexture* tex, |
124 const GrTextureParams& params, | 124 const GrTextureParams& params, |
125 uint32_t flags, bool usesLocalCoords) { | 125 uint32_t flags, bool usesLocalCoords) { |
126 return SkNEW_ARGS(GrDistanceFieldPathGeoProc, (color, viewMatrix, tex, p
arams, flags, | 126 return new GrDistanceFieldPathGeoProc(color, viewMatrix, tex, params, fl
ags, |
127 usesLocalCoords)); | 127 usesLocalCoords); |
128 } | 128 } |
129 | 129 |
130 virtual ~GrDistanceFieldPathGeoProc() {} | 130 virtual ~GrDistanceFieldPathGeoProc() {} |
131 | 131 |
132 const char* name() const override { return "DistanceFieldTexture"; } | 132 const char* name() const override { return "DistanceFieldTexture"; } |
133 | 133 |
134 const Attribute* inPosition() const { return fInPosition; } | 134 const Attribute* inPosition() const { return fInPosition; } |
135 const Attribute* inColor() const { return fInColor; } | 135 const Attribute* inColor() const { return fInColor; } |
136 const Attribute* inTextureCoords() const { return fInTextureCoords; } | 136 const Attribute* inTextureCoords() const { return fInTextureCoords; } |
137 GrColor color() const { return fColor; } | 137 GrColor color() const { return fColor; } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 } | 187 } |
188 bool operator!=(const DistanceAdjust& wa) const { | 188 bool operator!=(const DistanceAdjust& wa) const { |
189 return !(*this == wa); | 189 return !(*this == wa); |
190 } | 190 } |
191 }; | 191 }; |
192 | 192 |
193 static GrGeometryProcessor* Create(GrColor color, const SkMatrix& viewMatrix
, | 193 static GrGeometryProcessor* Create(GrColor color, const SkMatrix& viewMatrix
, |
194 GrTexture* tex, const GrTextureParams& pa
rams, | 194 GrTexture* tex, const GrTextureParams& pa
rams, |
195 DistanceAdjust distanceAdjust, uint32_t f
lags, | 195 DistanceAdjust distanceAdjust, uint32_t f
lags, |
196 bool usesLocalCoords) { | 196 bool usesLocalCoords) { |
197 return SkNEW_ARGS(GrDistanceFieldLCDTextGeoProc, | 197 return new GrDistanceFieldLCDTextGeoProc(color, viewMatrix, tex, params,
distanceAdjust, |
198 (color, viewMatrix, tex, params, distanceAdjust, flags
, usesLocalCoords)); | 198 flags, usesLocalCoords); |
199 } | 199 } |
200 | 200 |
201 virtual ~GrDistanceFieldLCDTextGeoProc() {} | 201 virtual ~GrDistanceFieldLCDTextGeoProc() {} |
202 | 202 |
203 const char* name() const override { return "DistanceFieldLCDTexture"; } | 203 const char* name() const override { return "DistanceFieldLCDTexture"; } |
204 | 204 |
205 const Attribute* inPosition() const { return fInPosition; } | 205 const Attribute* inPosition() const { return fInPosition; } |
206 const Attribute* inTextureCoords() const { return fInTextureCoords; } | 206 const Attribute* inTextureCoords() const { return fInTextureCoords; } |
207 DistanceAdjust getDistanceAdjust() const { return fDistanceAdjust; } | 207 DistanceAdjust getDistanceAdjust() const { return fDistanceAdjust; } |
208 GrColor color() const { return fColor; } | 208 GrColor color() const { return fColor; } |
(...skipping 23 matching lines...) Expand all Loading... |
232 const Attribute* fInPosition; | 232 const Attribute* fInPosition; |
233 const Attribute* fInTextureCoords; | 233 const Attribute* fInTextureCoords; |
234 bool fUsesLocalCoords; | 234 bool fUsesLocalCoords; |
235 | 235 |
236 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; | 236 GR_DECLARE_GEOMETRY_PROCESSOR_TEST; |
237 | 237 |
238 typedef GrGeometryProcessor INHERITED; | 238 typedef GrGeometryProcessor INHERITED; |
239 }; | 239 }; |
240 | 240 |
241 #endif | 241 #endif |
OLD | NEW |