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 "SkTwoPointRadialGradient.h" | 9 #include "SkTwoPointRadialGradient.h" |
10 | 10 |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 public: | 398 public: |
399 | 399 |
400 GrGLRadial2Gradient(const GrProcessor&); | 400 GrGLRadial2Gradient(const GrProcessor&); |
401 virtual ~GrGLRadial2Gradient() { } | 401 virtual ~GrGLRadial2Gradient() { } |
402 | 402 |
403 virtual void emitCode(GrGLFPBuilder*, | 403 virtual void emitCode(GrGLFPBuilder*, |
404 const GrFragmentProcessor&, | 404 const GrFragmentProcessor&, |
405 const char* outputColor, | 405 const char* outputColor, |
406 const char* inputColor, | 406 const char* inputColor, |
407 const TransformedCoordsArray&, | 407 const TransformedCoordsArray&, |
408 const TextureSamplerArray&) SK_OVERRIDE; | 408 const TextureSamplerArray&) override; |
409 void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE; | 409 void setData(const GrGLProgramDataManager&, const GrProcessor&) override; |
410 | 410 |
411 static void GenKey(const GrProcessor&, const GrGLCaps& caps, GrProcessorKeyB
uilder* b); | 411 static void GenKey(const GrProcessor&, const GrGLCaps& caps, GrProcessorKeyB
uilder* b); |
412 | 412 |
413 protected: | 413 protected: |
414 | 414 |
415 UniformHandle fParamUni; | 415 UniformHandle fParamUni; |
416 | 416 |
417 const char* fVSVaryingName; | 417 const char* fVSVaryingName; |
418 const char* fFSVaryingName; | 418 const char* fFSVaryingName; |
419 | 419 |
(...skipping 20 matching lines...) Expand all Loading... |
440 public: | 440 public: |
441 static GrFragmentProcessor* Create(GrContext* ctx, | 441 static GrFragmentProcessor* Create(GrContext* ctx, |
442 const SkTwoPointRadialGradient& shader, | 442 const SkTwoPointRadialGradient& shader, |
443 const SkMatrix& matrix, | 443 const SkMatrix& matrix, |
444 SkShader::TileMode tm) { | 444 SkShader::TileMode tm) { |
445 return SkNEW_ARGS(GrRadial2Gradient, (ctx, shader, matrix, tm)); | 445 return SkNEW_ARGS(GrRadial2Gradient, (ctx, shader, matrix, tm)); |
446 } | 446 } |
447 | 447 |
448 virtual ~GrRadial2Gradient() { } | 448 virtual ~GrRadial2Gradient() { } |
449 | 449 |
450 const char* name() const SK_OVERRIDE { return "Two-Point Radial Gradient"; } | 450 const char* name() const override { return "Two-Point Radial Gradient"; } |
451 | 451 |
452 virtual void getGLProcessorKey(const GrGLCaps& caps, | 452 virtual void getGLProcessorKey(const GrGLCaps& caps, |
453 GrProcessorKeyBuilder* b) const SK_OVERRIDE { | 453 GrProcessorKeyBuilder* b) const override { |
454 GrGLRadial2Gradient::GenKey(*this, caps, b); | 454 GrGLRadial2Gradient::GenKey(*this, caps, b); |
455 } | 455 } |
456 | 456 |
457 GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE { | 457 GrGLFragmentProcessor* createGLInstance() const override { |
458 return SkNEW_ARGS(GrGLRadial2Gradient, (*this)); | 458 return SkNEW_ARGS(GrGLRadial2Gradient, (*this)); |
459 } | 459 } |
460 | 460 |
461 // The radial gradient parameters can collapse to a linear (instead of quadr
atic) equation. | 461 // The radial gradient parameters can collapse to a linear (instead of quadr
atic) equation. |
462 bool isDegenerate() const { return SK_Scalar1 == fCenterX1; } | 462 bool isDegenerate() const { return SK_Scalar1 == fCenterX1; } |
463 SkScalar center() const { return fCenterX1; } | 463 SkScalar center() const { return fCenterX1; } |
464 SkScalar radius() const { return fRadius0; } | 464 SkScalar radius() const { return fRadius0; } |
465 bool isPosRoot() const { return SkToBool(fPosRoot); } | 465 bool isPosRoot() const { return SkToBool(fPosRoot); } |
466 | 466 |
467 private: | 467 private: |
468 bool onIsEqual(const GrFragmentProcessor& sBase) const SK_OVERRIDE { | 468 bool onIsEqual(const GrFragmentProcessor& sBase) const override { |
469 const GrRadial2Gradient& s = sBase.cast<GrRadial2Gradient>(); | 469 const GrRadial2Gradient& s = sBase.cast<GrRadial2Gradient>(); |
470 return (INHERITED::onIsEqual(sBase) && | 470 return (INHERITED::onIsEqual(sBase) && |
471 this->fCenterX1 == s.fCenterX1 && | 471 this->fCenterX1 == s.fCenterX1 && |
472 this->fRadius0 == s.fRadius0 && | 472 this->fRadius0 == s.fRadius0 && |
473 this->fPosRoot == s.fPosRoot); | 473 this->fPosRoot == s.fPosRoot); |
474 } | 474 } |
475 | 475 |
476 GrRadial2Gradient(GrContext* ctx, | 476 GrRadial2Gradient(GrContext* ctx, |
477 const SkTwoPointRadialGradient& shader, | 477 const SkTwoPointRadialGradient& shader, |
478 const SkMatrix& matrix, | 478 const SkMatrix& matrix, |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 #else | 715 #else |
716 | 716 |
717 bool SkTwoPointRadialGradient::asFragmentProcessor(GrContext*, const SkPaint&, c
onst SkMatrix&, | 717 bool SkTwoPointRadialGradient::asFragmentProcessor(GrContext*, const SkPaint&, c
onst SkMatrix&, |
718 const SkMatrix*, | 718 const SkMatrix*, |
719 GrColor*, GrFragmentProcessor
**) const { | 719 GrColor*, GrFragmentProcessor
**) const { |
720 SkDEBUGFAIL("Should not call in GPU-less build"); | 720 SkDEBUGFAIL("Should not call in GPU-less build"); |
721 return false; | 721 return false; |
722 } | 722 } |
723 | 723 |
724 #endif | 724 #endif |
OLD | NEW |