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 "SkPerlinNoiseShader.h" | 8 #include "SkPerlinNoiseShader.h" |
9 #include "SkColorFilter.h" | 9 #include "SkColorFilter.h" |
10 #include "SkReadBuffer.h" | 10 #include "SkReadBuffer.h" |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 } | 466 } |
467 } | 467 } |
468 | 468 |
469 ///////////////////////////////////////////////////////////////////// | 469 ///////////////////////////////////////////////////////////////////// |
470 | 470 |
471 #if SK_SUPPORT_GPU | 471 #if SK_SUPPORT_GPU |
472 | 472 |
473 class GrGLPerlinNoise : public GrGLSLFragmentProcessor { | 473 class GrGLPerlinNoise : public GrGLSLFragmentProcessor { |
474 public: | 474 public: |
475 GrGLPerlinNoise(const GrProcessor&); | 475 GrGLPerlinNoise(const GrProcessor&); |
476 virtual ~GrGLPerlinNoise() {} | |
477 | 476 |
478 virtual void emitCode(EmitArgs&) override; | 477 void emitCode(EmitArgs&) override; |
479 | 478 |
480 static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessor
KeyBuilder* b); | 479 static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessor
KeyBuilder* b); |
481 | 480 |
482 protected: | 481 protected: |
483 void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override
; | 482 void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override
; |
484 | 483 |
485 private: | 484 private: |
486 | 485 |
487 GrGLSLProgramDataManager::UniformHandle fStitchDataUni; | 486 GrGLSLProgramDataManager::UniformHandle fStitchDataUni; |
488 SkPerlinNoiseShader::Type fType; | 487 SkPerlinNoiseShader::Type fType; |
489 bool fStitchTiles; | 488 bool fStitchTiles; |
490 int fNumOctaves; | 489 int fNumOctaves; |
491 GrGLSLProgramDataManager::UniformHandle fBaseFrequencyUni; | 490 GrGLSLProgramDataManager::UniformHandle fBaseFrequencyUni; |
492 | 491 |
493 private: | |
494 typedef GrGLSLFragmentProcessor INHERITED; | 492 typedef GrGLSLFragmentProcessor INHERITED; |
495 }; | 493 }; |
496 | 494 |
497 ///////////////////////////////////////////////////////////////////// | 495 ///////////////////////////////////////////////////////////////////// |
498 | 496 |
499 class GrPerlinNoiseEffect : public GrFragmentProcessor { | 497 class GrPerlinNoiseEffect : public GrFragmentProcessor { |
500 public: | 498 public: |
501 static GrFragmentProcessor* Create(SkPerlinNoiseShader::Type type, | 499 static GrFragmentProcessor* Create(SkPerlinNoiseShader::Type type, |
502 int numOctaves, bool stitchTiles, | 500 int numOctaves, bool stitchTiles, |
503 SkPerlinNoiseShader::PaintingData* painti
ngData, | 501 SkPerlinNoiseShader::PaintingData* painti
ngData, |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 str->append(" seed: "); | 980 str->append(" seed: "); |
983 str->appendScalar(fSeed); | 981 str->appendScalar(fSeed); |
984 str->append(" stitch tiles: "); | 982 str->append(" stitch tiles: "); |
985 str->append(fStitchTiles ? "true " : "false "); | 983 str->append(fStitchTiles ? "true " : "false "); |
986 | 984 |
987 this->INHERITED::toString(str); | 985 this->INHERITED::toString(str); |
988 | 986 |
989 str->append(")"); | 987 str->append(")"); |
990 } | 988 } |
991 #endif | 989 #endif |
OLD | NEW |