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 #include "SkDither.h" | 8 #include "SkDither.h" |
9 #include "SkPerlinNoiseShader2.h" | 9 #include "SkPerlinNoiseShader2.h" |
10 #include "SkColorFilter.h" | 10 #include "SkColorFilter.h" |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 | 663 |
664 const SkPerlinNoiseShader2::StitchData& stitchData() const { return fPaintin
gData->fStitchDataInit; } | 664 const SkPerlinNoiseShader2::StitchData& stitchData() const { return fPaintin
gData->fStitchDataInit; } |
665 | 665 |
666 SkPerlinNoiseShader2::Type type() const { return fType; } | 666 SkPerlinNoiseShader2::Type type() const { return fType; } |
667 bool stitchTiles() const { return fStitchTiles; } | 667 bool stitchTiles() const { return fStitchTiles; } |
668 const SkVector& baseFrequency() const { return fPaintingData->fBaseFrequency
; } | 668 const SkVector& baseFrequency() const { return fPaintingData->fBaseFrequency
; } |
669 int numOctaves() const { return fNumOctaves; } | 669 int numOctaves() const { return fNumOctaves; } |
670 const SkMatrix& matrix() const { return fCoordTransform.getMatrix(); } | 670 const SkMatrix& matrix() const { return fCoordTransform.getMatrix(); } |
671 | 671 |
672 private: | 672 private: |
673 GrGLSLFragmentProcessor* onCreateGLInstance() const override { | 673 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override { |
674 return new GrGLPerlinNoise2(*this); | 674 return new GrGLPerlinNoise2(*this); |
675 } | 675 } |
676 | 676 |
677 virtual void onGetGLProcessorKey(const GrGLSLCaps& caps, | 677 virtual void onGetGLSLProcessorKey(const GrGLSLCaps& caps, |
678 GrProcessorKeyBuilder* b) const override { | 678 GrProcessorKeyBuilder* b) const override
{ |
679 GrGLPerlinNoise2::GenKey(*this, caps, b); | 679 GrGLPerlinNoise2::GenKey(*this, caps, b); |
680 } | 680 } |
681 | 681 |
682 bool onIsEqual(const GrFragmentProcessor& sBase) const override { | 682 bool onIsEqual(const GrFragmentProcessor& sBase) const override { |
683 const GrPerlinNoise2Effect& s = sBase.cast<GrPerlinNoise2Effect>(); | 683 const GrPerlinNoise2Effect& s = sBase.cast<GrPerlinNoise2Effect>(); |
684 return fType == s.fType && | 684 return fType == s.fType && |
685 fPaintingData->fBaseFrequency == s.fPaintingData->fBaseFrequency
&& | 685 fPaintingData->fBaseFrequency == s.fPaintingData->fBaseFrequency
&& |
686 fNumOctaves == s.fNumOctaves && | 686 fNumOctaves == s.fNumOctaves && |
687 fStitchTiles == s.fStitchTiles && | 687 fStitchTiles == s.fStitchTiles && |
688 fPaintingData->fStitchDataInit == s.fPaintingData->fStitchDataIni
t; | 688 fPaintingData->fStitchDataInit == s.fPaintingData->fStitchDataIni
t; |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1088 virtual ~GrImprovedPerlinNoiseEffect() { delete fPaintingData; } | 1088 virtual ~GrImprovedPerlinNoiseEffect() { delete fPaintingData; } |
1089 | 1089 |
1090 const char* name() const override { return "ImprovedPerlinNoise"; } | 1090 const char* name() const override { return "ImprovedPerlinNoise"; } |
1091 | 1091 |
1092 const SkVector& baseFrequency() const { return fPaintingData->fBaseFrequency
; } | 1092 const SkVector& baseFrequency() const { return fPaintingData->fBaseFrequency
; } |
1093 SkScalar z() const { return fZ; } | 1093 SkScalar z() const { return fZ; } |
1094 int octaves() const { return fOctaves; } | 1094 int octaves() const { return fOctaves; } |
1095 const SkMatrix& matrix() const { return fCoordTransform.getMatrix(); } | 1095 const SkMatrix& matrix() const { return fCoordTransform.getMatrix(); } |
1096 | 1096 |
1097 private: | 1097 private: |
1098 GrGLSLFragmentProcessor* onCreateGLInstance() const override { | 1098 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override { |
1099 return new GrGLImprovedPerlinNoise(*this); | 1099 return new GrGLImprovedPerlinNoise(*this); |
1100 } | 1100 } |
1101 | 1101 |
1102 virtual void onGetGLProcessorKey(const GrGLSLCaps& caps, | 1102 virtual void onGetGLSLProcessorKey(const GrGLSLCaps& caps, |
1103 GrProcessorKeyBuilder* b) const override { | 1103 GrProcessorKeyBuilder* b) const override
{ |
1104 GrGLImprovedPerlinNoise::GenKey(*this, caps, b); | 1104 GrGLImprovedPerlinNoise::GenKey(*this, caps, b); |
1105 } | 1105 } |
1106 | 1106 |
1107 bool onIsEqual(const GrFragmentProcessor& sBase) const override { | 1107 bool onIsEqual(const GrFragmentProcessor& sBase) const override { |
1108 const GrImprovedPerlinNoiseEffect& s = sBase.cast<GrImprovedPerlinNoiseE
ffect>(); | 1108 const GrImprovedPerlinNoiseEffect& s = sBase.cast<GrImprovedPerlinNoiseE
ffect>(); |
1109 return fZ == fZ && | 1109 return fZ == fZ && |
1110 fPaintingData->fBaseFrequency == s.fPaintingData->fBaseFrequency; | 1110 fPaintingData->fBaseFrequency == s.fPaintingData->fBaseFrequency; |
1111 } | 1111 } |
1112 | 1112 |
1113 void onComputeInvariantOutput(GrInvariantOutput* inout) const override { | 1113 void onComputeInvariantOutput(GrInvariantOutput* inout) const override { |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1427 str->append(" seed: "); | 1427 str->append(" seed: "); |
1428 str->appendScalar(fSeed); | 1428 str->appendScalar(fSeed); |
1429 str->append(" stitch tiles: "); | 1429 str->append(" stitch tiles: "); |
1430 str->append(fStitchTiles ? "true " : "false "); | 1430 str->append(fStitchTiles ? "true " : "false "); |
1431 | 1431 |
1432 this->INHERITED::toString(str); | 1432 this->INHERITED::toString(str); |
1433 | 1433 |
1434 str->append(")"); | 1434 str->append(")"); |
1435 } | 1435 } |
1436 #endif | 1436 #endif |
OLD | NEW |