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 "SkPerlinNoiseShader.h" | 9 #include "SkPerlinNoiseShader.h" |
10 #include "SkColorFilter.h" | 10 #include "SkColorFilter.h" |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 #if SK_SUPPORT_GPU | 508 #if SK_SUPPORT_GPU |
509 | 509 |
510 #include "GrTBackendProcessorFactory.h" | 510 #include "GrTBackendProcessorFactory.h" |
511 | 511 |
512 class GrGLPerlinNoise : public GrGLFragmentProcessor { | 512 class GrGLPerlinNoise : public GrGLFragmentProcessor { |
513 public: | 513 public: |
514 GrGLPerlinNoise(const GrBackendProcessorFactory&, | 514 GrGLPerlinNoise(const GrBackendProcessorFactory&, |
515 const GrProcessor&); | 515 const GrProcessor&); |
516 virtual ~GrGLPerlinNoise() {} | 516 virtual ~GrGLPerlinNoise() {} |
517 | 517 |
518 virtual void emitCode(GrGLProgramBuilder*, | 518 virtual void emitCode(GrGLFPBuilder*, |
519 const GrFragmentProcessor&, | 519 const GrFragmentProcessor&, |
520 const GrProcessorKey&, | 520 const GrProcessorKey&, |
521 const char* outputColor, | 521 const char* outputColor, |
522 const char* inputColor, | 522 const char* inputColor, |
523 const TransformedCoordsArray&, | 523 const TransformedCoordsArray&, |
524 const TextureSamplerArray&) SK_OVERRIDE; | 524 const TextureSamplerArray&) SK_OVERRIDE; |
525 | 525 |
526 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_O
VERRIDE; | 526 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_O
VERRIDE; |
527 | 527 |
528 static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKe
yBuilder* b); | 528 static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKe
yBuilder* b); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 } | 658 } |
659 | 659 |
660 GrGLPerlinNoise::GrGLPerlinNoise(const GrBackendProcessorFactory& factory, | 660 GrGLPerlinNoise::GrGLPerlinNoise(const GrBackendProcessorFactory& factory, |
661 const GrProcessor& processor) | 661 const GrProcessor& processor) |
662 : INHERITED (factory) | 662 : INHERITED (factory) |
663 , fType(processor.cast<GrPerlinNoiseEffect>().type()) | 663 , fType(processor.cast<GrPerlinNoiseEffect>().type()) |
664 , fStitchTiles(processor.cast<GrPerlinNoiseEffect>().stitchTiles()) | 664 , fStitchTiles(processor.cast<GrPerlinNoiseEffect>().stitchTiles()) |
665 , fNumOctaves(processor.cast<GrPerlinNoiseEffect>().numOctaves()) { | 665 , fNumOctaves(processor.cast<GrPerlinNoiseEffect>().numOctaves()) { |
666 } | 666 } |
667 | 667 |
668 void GrGLPerlinNoise::emitCode(GrGLProgramBuilder* builder, | 668 void GrGLPerlinNoise::emitCode(GrGLFPBuilder* builder, |
669 const GrFragmentProcessor&, | 669 const GrFragmentProcessor&, |
670 const GrProcessorKey& key, | 670 const GrProcessorKey& key, |
671 const char* outputColor, | 671 const char* outputColor, |
672 const char* inputColor, | 672 const char* inputColor, |
673 const TransformedCoordsArray& coords, | 673 const TransformedCoordsArray& coords, |
674 const TextureSamplerArray& samplers) { | 674 const TextureSamplerArray& samplers) { |
675 sk_ignore_unused_variable(inputColor); | 675 sk_ignore_unused_variable(inputColor); |
676 | 676 |
677 GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder(); | 677 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); |
678 SkString vCoords = fsBuilder->ensureFSCoords2D(coords, 0); | 678 SkString vCoords = fsBuilder->ensureFSCoords2D(coords, 0); |
679 | 679 |
680 fBaseFrequencyUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibi
lity, | 680 fBaseFrequencyUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibi
lity, |
681 kVec2f_GrSLType, "baseFrequency"); | 681 kVec2f_GrSLType, "baseFrequency"); |
682 const char* baseFrequencyUni = builder->getUniformCStr(fBaseFrequencyUni); | 682 const char* baseFrequencyUni = builder->getUniformCStr(fBaseFrequencyUni); |
683 fAlphaUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility, | 683 fAlphaUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility, |
684 kFloat_GrSLType, "alpha"); | 684 kFloat_GrSLType, "alpha"); |
685 const char* alphaUni = builder->getUniformCStr(fAlphaUni); | 685 const char* alphaUni = builder->getUniformCStr(fAlphaUni); |
686 | 686 |
687 const char* stitchDataUni = NULL; | 687 const char* stitchDataUni = NULL; |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 str->append(" seed: "); | 1054 str->append(" seed: "); |
1055 str->appendScalar(fSeed); | 1055 str->appendScalar(fSeed); |
1056 str->append(" stitch tiles: "); | 1056 str->append(" stitch tiles: "); |
1057 str->append(fStitchTiles ? "true " : "false "); | 1057 str->append(fStitchTiles ? "true " : "false "); |
1058 | 1058 |
1059 this->INHERITED::toString(str); | 1059 this->INHERITED::toString(str); |
1060 | 1060 |
1061 str->append(")"); | 1061 str->append(")"); |
1062 } | 1062 } |
1063 #endif | 1063 #endif |
OLD | NEW |