OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SkSweepGradient.h" | 9 #include "SkSweepGradient.h" |
10 | 10 |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 190 |
191 class GrGLSweepGradient : public GrGLGradientEffect { | 191 class GrGLSweepGradient : public GrGLGradientEffect { |
192 public: | 192 public: |
193 | 193 |
194 GrGLSweepGradient(const GrBackendProcessorFactory& factory, | 194 GrGLSweepGradient(const GrBackendProcessorFactory& factory, |
195 const GrProcessor&) : INHERITED (factory) { } | 195 const GrProcessor&) : INHERITED (factory) { } |
196 virtual ~GrGLSweepGradient() { } | 196 virtual ~GrGLSweepGradient() { } |
197 | 197 |
198 virtual void emitCode(GrGLFPBuilder*, | 198 virtual void emitCode(GrGLFPBuilder*, |
199 const GrFragmentProcessor&, | 199 const GrFragmentProcessor&, |
200 const GrProcessorKey&, | |
201 const char* outputColor, | 200 const char* outputColor, |
202 const char* inputColor, | 201 const char* inputColor, |
203 const TransformedCoordsArray&, | 202 const TransformedCoordsArray&, |
204 const TextureSamplerArray&) SK_OVERRIDE; | 203 const TextureSamplerArray&) SK_OVERRIDE; |
205 | 204 |
206 static void GenKey(const GrProcessor& processor, const GrGLCaps&, GrProcesso
rKeyBuilder* b) { | 205 static void GenKey(const GrProcessor& processor, const GrGLCaps&, GrProcesso
rKeyBuilder* b) { |
207 b->add32(GenBaseGradientKey(processor)); | 206 b->add32(GenBaseGradientKey(processor)); |
208 } | 207 } |
209 | 208 |
210 private: | 209 private: |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 GrFragmentProcessor* fp; | 260 GrFragmentProcessor* fp; |
262 GrColor paintColor; | 261 GrColor paintColor; |
263 SkAssertResult(shader->asFragmentProcessor(context, paint, NULL, &paintColor
, &fp)); | 262 SkAssertResult(shader->asFragmentProcessor(context, paint, NULL, &paintColor
, &fp)); |
264 return fp; | 263 return fp; |
265 } | 264 } |
266 | 265 |
267 ///////////////////////////////////////////////////////////////////// | 266 ///////////////////////////////////////////////////////////////////// |
268 | 267 |
269 void GrGLSweepGradient::emitCode(GrGLFPBuilder* builder, | 268 void GrGLSweepGradient::emitCode(GrGLFPBuilder* builder, |
270 const GrFragmentProcessor& fp, | 269 const GrFragmentProcessor& fp, |
271 const GrProcessorKey& key, | |
272 const char* outputColor, | 270 const char* outputColor, |
273 const char* inputColor, | 271 const char* inputColor, |
274 const TransformedCoordsArray& coords, | 272 const TransformedCoordsArray& coords, |
275 const TextureSamplerArray& samplers) { | 273 const TextureSamplerArray& samplers) { |
276 const GrGradientEffect& ge = fp.cast<GrGradientEffect>(); | 274 const GrGradientEffect& ge = fp.cast<GrGradientEffect>(); |
277 this->emitUniforms(builder, ge); | 275 this->emitUniforms(builder, ge); |
278 SkString coords2D = builder->getFragmentShaderBuilder()->ensureFSCoords2D(co
ords, 0); | 276 SkString coords2D = builder->getFragmentShaderBuilder()->ensureFSCoords2D(co
ords, 0); |
279 const GrGLContextInfo ctxInfo = builder->ctxInfo(); | 277 const GrGLContextInfo ctxInfo = builder->ctxInfo(); |
280 SkString t; | 278 SkString t; |
281 // 0.1591549430918 is 1/(2*pi), used since atan returns values [-pi, pi] | 279 // 0.1591549430918 is 1/(2*pi), used since atan returns values [-pi, pi] |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 str->appendScalar(fCenter.fX); | 332 str->appendScalar(fCenter.fX); |
335 str->append(", "); | 333 str->append(", "); |
336 str->appendScalar(fCenter.fY); | 334 str->appendScalar(fCenter.fY); |
337 str->append(") "); | 335 str->append(") "); |
338 | 336 |
339 this->INHERITED::toString(str); | 337 this->INHERITED::toString(str); |
340 | 338 |
341 str->append(")"); | 339 str->append(")"); |
342 } | 340 } |
343 #endif | 341 #endif |
OLD | NEW |