| 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 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 // Emit zero. | 936 // Emit zero. |
| 937 return GrConstColorProcessor::Create(0x0, GrConstColorProcessor::kIgnore
_InputMode); | 937 return GrConstColorProcessor::Create(0x0, GrConstColorProcessor::kIgnore
_InputMode); |
| 938 } | 938 } |
| 939 | 939 |
| 940 // Either we don't stitch tiles, either we have a valid tile size | 940 // Either we don't stitch tiles, either we have a valid tile size |
| 941 SkASSERT(!fStitchTiles || !fTileSize.isEmpty()); | 941 SkASSERT(!fStitchTiles || !fTileSize.isEmpty()); |
| 942 | 942 |
| 943 SkPerlinNoiseShader::PaintingData* paintingData = | 943 SkPerlinNoiseShader::PaintingData* paintingData = |
| 944 new PaintingData(fTileSize, fSeed, fBaseFrequencyX, fBaseFrequencyY,
matrix); | 944 new PaintingData(fTileSize, fSeed, fBaseFrequencyX, fBaseFrequencyY,
matrix); |
| 945 SkAutoTUnref<GrTexture> permutationsTexture( | 945 SkAutoTUnref<GrTexture> permutationsTexture( |
| 946 GrRefCachedBitmapTexture(context, paintingData->getPermutationsBitmap(),
nullptr)); | 946 GrRefCachedBitmapTexture(context, paintingData->getPermutationsBitmap(), |
| 947 GrTextureParams::ClampNoFilter())); |
| 947 SkAutoTUnref<GrTexture> noiseTexture( | 948 SkAutoTUnref<GrTexture> noiseTexture( |
| 948 GrRefCachedBitmapTexture(context, paintingData->getNoiseBitmap(), nullpt
r)); | 949 GrRefCachedBitmapTexture(context, paintingData->getNoiseBitmap(), |
| 950 GrTextureParams::ClampNoFilter())); |
| 949 | 951 |
| 950 SkMatrix m = viewM; | 952 SkMatrix m = viewM; |
| 951 m.setTranslateX(-localMatrix.getTranslateX() + SK_Scalar1); | 953 m.setTranslateX(-localMatrix.getTranslateX() + SK_Scalar1); |
| 952 m.setTranslateY(-localMatrix.getTranslateY() + SK_Scalar1); | 954 m.setTranslateY(-localMatrix.getTranslateY() + SK_Scalar1); |
| 953 if ((permutationsTexture) && (noiseTexture)) { | 955 if ((permutationsTexture) && (noiseTexture)) { |
| 954 SkAutoTUnref<GrFragmentProcessor> inner( | 956 SkAutoTUnref<GrFragmentProcessor> inner( |
| 955 GrPerlinNoiseEffect::Create(fType, | 957 GrPerlinNoiseEffect::Create(fType, |
| 956 fNumOctaves, | 958 fNumOctaves, |
| 957 fStitchTiles, | 959 fStitchTiles, |
| 958 paintingData, | 960 paintingData, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 str->append(" seed: "); | 993 str->append(" seed: "); |
| 992 str->appendScalar(fSeed); | 994 str->appendScalar(fSeed); |
| 993 str->append(" stitch tiles: "); | 995 str->append(" stitch tiles: "); |
| 994 str->append(fStitchTiles ? "true " : "false "); | 996 str->append(fStitchTiles ? "true " : "false "); |
| 995 | 997 |
| 996 this->INHERITED::toString(str); | 998 this->INHERITED::toString(str); |
| 997 | 999 |
| 998 str->append(")"); | 1000 str->append(")"); |
| 999 } | 1001 } |
| 1000 #endif | 1002 #endif |
| OLD | NEW |