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" |
11 #include "SkReadBuffer.h" | 11 #include "SkReadBuffer.h" |
12 #include "SkWriteBuffer.h" | 12 #include "SkWriteBuffer.h" |
13 #include "SkShader.h" | 13 #include "SkShader.h" |
14 #include "SkUnPreMultiply.h" | 14 #include "SkUnPreMultiply.h" |
15 #include "SkString.h" | 15 #include "SkString.h" |
16 | 16 |
17 #if SK_SUPPORT_GPU | 17 #if SK_SUPPORT_GPU |
18 #include "GrContext.h" | 18 #include "GrContext.h" |
19 #include "GrCoordTransform.h" | 19 #include "GrCoordTransform.h" |
| 20 #include "GrInvariantOutput.h" |
20 #include "gl/GrGLProcessor.h" | 21 #include "gl/GrGLProcessor.h" |
21 #include "gl/builders/GrGLProgramBuilder.h" | 22 #include "gl/builders/GrGLProgramBuilder.h" |
22 #include "GrTBackendProcessorFactory.h" | 23 #include "GrTBackendProcessorFactory.h" |
23 #include "SkGr.h" | 24 #include "SkGr.h" |
24 #endif | 25 #endif |
25 | 26 |
26 static const int kBlockSize = 256; | 27 static const int kBlockSize = 256; |
27 static const int kBlockMask = kBlockSize - 1; | 28 static const int kBlockMask = kBlockSize - 1; |
28 static const int kPerlinNoise = 4096; | 29 static const int kPerlinNoise = 4096; |
29 static const int kRandMaximum = SK_MaxS32; // 2**31 - 1 | 30 static const int kRandMaximum = SK_MaxS32; // 2**31 - 1 |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 virtual bool onIsEqual(const GrFragmentProcessor& sBase) const SK_OVERRIDE { | 577 virtual bool onIsEqual(const GrFragmentProcessor& sBase) const SK_OVERRIDE { |
577 const GrPerlinNoiseEffect& s = sBase.cast<GrPerlinNoiseEffect>(); | 578 const GrPerlinNoiseEffect& s = sBase.cast<GrPerlinNoiseEffect>(); |
578 return fType == s.fType && | 579 return fType == s.fType && |
579 fPaintingData->fBaseFrequency == s.fPaintingData->fBaseFrequency
&& | 580 fPaintingData->fBaseFrequency == s.fPaintingData->fBaseFrequency
&& |
580 fNumOctaves == s.fNumOctaves && | 581 fNumOctaves == s.fNumOctaves && |
581 fStitchTiles == s.fStitchTiles && | 582 fStitchTiles == s.fStitchTiles && |
582 fAlpha == s.fAlpha && | 583 fAlpha == s.fAlpha && |
583 fPaintingData->fStitchDataInit == s.fPaintingData->fStitchDataIni
t; | 584 fPaintingData->fStitchDataInit == s.fPaintingData->fStitchDataIni
t; |
584 } | 585 } |
585 | 586 |
586 void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERRIDE { | 587 void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVERRIDE { |
587 inout->setToUnknown(InvariantOutput::kWillNot_ReadInput); | 588 inout->setToUnknown(GrInvariantOutput::kWillNot_ReadInput); |
588 } | 589 } |
589 | 590 |
590 GrPerlinNoiseEffect(SkPerlinNoiseShader::Type type, | 591 GrPerlinNoiseEffect(SkPerlinNoiseShader::Type type, |
591 int numOctaves, bool stitchTiles, | 592 int numOctaves, bool stitchTiles, |
592 SkPerlinNoiseShader::PaintingData* paintingData, | 593 SkPerlinNoiseShader::PaintingData* paintingData, |
593 GrTexture* permutationsTexture, GrTexture* noiseTexture, | 594 GrTexture* permutationsTexture, GrTexture* noiseTexture, |
594 const SkMatrix& matrix, uint8_t alpha) | 595 const SkMatrix& matrix, uint8_t alpha) |
595 : fType(type) | 596 : fType(type) |
596 , fNumOctaves(numOctaves) | 597 , fNumOctaves(numOctaves) |
597 , fStitchTiles(stitchTiles) | 598 , fStitchTiles(stitchTiles) |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1049 str->append(" seed: "); | 1050 str->append(" seed: "); |
1050 str->appendScalar(fSeed); | 1051 str->appendScalar(fSeed); |
1051 str->append(" stitch tiles: "); | 1052 str->append(" stitch tiles: "); |
1052 str->append(fStitchTiles ? "true " : "false "); | 1053 str->append(fStitchTiles ? "true " : "false "); |
1053 | 1054 |
1054 this->INHERITED::toString(str); | 1055 this->INHERITED::toString(str); |
1055 | 1056 |
1056 str->append(")"); | 1057 str->append(")"); |
1057 } | 1058 } |
1058 #endif | 1059 #endif |
OLD | NEW |