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 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 fPaintingData->fBaseFrequency == s.fPaintingData->fBaseFrequency
&& | 579 fPaintingData->fBaseFrequency == s.fPaintingData->fBaseFrequency
&& |
580 fNumOctaves == s.fNumOctaves && | 580 fNumOctaves == s.fNumOctaves && |
581 fStitchTiles == s.fStitchTiles && | 581 fStitchTiles == s.fStitchTiles && |
582 fCoordTransform.getMatrix() == s.fCoordTransform.getMatrix() && | 582 fCoordTransform.getMatrix() == s.fCoordTransform.getMatrix() && |
583 fAlpha == s.fAlpha && | 583 fAlpha == s.fAlpha && |
584 fPermutationsAccess.getTexture() == s.fPermutationsAccess.getText
ure() && | 584 fPermutationsAccess.getTexture() == s.fPermutationsAccess.getText
ure() && |
585 fNoiseAccess.getTexture() == s.fNoiseAccess.getTexture() && | 585 fNoiseAccess.getTexture() == s.fNoiseAccess.getTexture() && |
586 fPaintingData->fStitchDataInit == s.fPaintingData->fStitchDataIni
t; | 586 fPaintingData->fStitchDataInit == s.fPaintingData->fStitchDataIni
t; |
587 } | 587 } |
588 | 588 |
589 void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE { | |
590 inout->fValidFlags = 0; // This is noise. Nothing is constant. | |
591 inout->fIsSingleComponent = false; | |
592 } | |
593 | |
594 GrPerlinNoiseEffect(SkPerlinNoiseShader::Type type, | 589 GrPerlinNoiseEffect(SkPerlinNoiseShader::Type type, |
595 int numOctaves, bool stitchTiles, | 590 int numOctaves, bool stitchTiles, |
596 SkPerlinNoiseShader::PaintingData* paintingData, | 591 SkPerlinNoiseShader::PaintingData* paintingData, |
597 GrTexture* permutationsTexture, GrTexture* noiseTexture, | 592 GrTexture* permutationsTexture, GrTexture* noiseTexture, |
598 const SkMatrix& matrix, uint8_t alpha) | 593 const SkMatrix& matrix, uint8_t alpha) |
599 : fType(type) | 594 : fType(type) |
600 , fNumOctaves(numOctaves) | 595 , fNumOctaves(numOctaves) |
601 , fStitchTiles(stitchTiles) | 596 , fStitchTiles(stitchTiles) |
602 , fAlpha(alpha) | 597 , fAlpha(alpha) |
603 , fPermutationsAccess(permutationsTexture) | 598 , fPermutationsAccess(permutationsTexture) |
(...skipping 10 matching lines...) Expand all Loading... |
614 | 609 |
615 SkPerlinNoiseShader::Type fType; | 610 SkPerlinNoiseShader::Type fType; |
616 GrCoordTransform fCoordTransform; | 611 GrCoordTransform fCoordTransform; |
617 int fNumOctaves; | 612 int fNumOctaves; |
618 bool fStitchTiles; | 613 bool fStitchTiles; |
619 uint8_t fAlpha; | 614 uint8_t fAlpha; |
620 GrTextureAccess fPermutationsAccess; | 615 GrTextureAccess fPermutationsAccess; |
621 GrTextureAccess fNoiseAccess; | 616 GrTextureAccess fNoiseAccess; |
622 SkPerlinNoiseShader::PaintingData *fPaintingData; | 617 SkPerlinNoiseShader::PaintingData *fPaintingData; |
623 | 618 |
| 619 void getConstantColorComponents(GrColor*, uint32_t* validFlags) const SK_OVE
RRIDE { |
| 620 *validFlags = 0; // This is noise. Nothing is constant. |
| 621 } |
| 622 |
624 private: | 623 private: |
625 typedef GrFragmentProcessor INHERITED; | 624 typedef GrFragmentProcessor INHERITED; |
626 }; | 625 }; |
627 | 626 |
628 ///////////////////////////////////////////////////////////////////// | 627 ///////////////////////////////////////////////////////////////////// |
629 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrPerlinNoiseEffect); | 628 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrPerlinNoiseEffect); |
630 | 629 |
631 GrFragmentProcessor* GrPerlinNoiseEffect::TestCreate(SkRandom* random, | 630 GrFragmentProcessor* GrPerlinNoiseEffect::TestCreate(SkRandom* random, |
632 GrContext* context, | 631 GrContext* context, |
633 const GrDrawTargetCaps&, | 632 const GrDrawTargetCaps&, |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 str->append(" seed: "); | 1064 str->append(" seed: "); |
1066 str->appendScalar(fSeed); | 1065 str->appendScalar(fSeed); |
1067 str->append(" stitch tiles: "); | 1066 str->append(" stitch tiles: "); |
1068 str->append(fStitchTiles ? "true " : "false "); | 1067 str->append(fStitchTiles ? "true " : "false "); |
1069 | 1068 |
1070 this->INHERITED::toString(str); | 1069 this->INHERITED::toString(str); |
1071 | 1070 |
1072 str->append(")"); | 1071 str->append(")"); |
1073 } | 1072 } |
1074 #endif | 1073 #endif |
OLD | NEW |