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 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 SkMatrix matrix = viewM; | 960 SkMatrix matrix = viewM; |
961 matrix.preConcat(localMatrix); | 961 matrix.preConcat(localMatrix); |
962 | 962 |
963 if (0 == fNumOctaves) { | 963 if (0 == fNumOctaves) { |
964 SkColor clearColor = 0; | 964 SkColor clearColor = 0; |
965 if (kFractalNoise_Type == fType) { | 965 if (kFractalNoise_Type == fType) { |
966 clearColor = SkColorSetARGB(paint.getAlpha() / 2, 127, 127, 127); | 966 clearColor = SkColorSetARGB(paint.getAlpha() / 2, 127, 127, 127); |
967 } | 967 } |
968 SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter( | 968 SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter( |
969 clearColor, SkXfermode::kSrc_Mod
e)); | 969 clearColor, SkXfermode::kSrc_Mod
e)); |
970 *fp = cf->asFragmentProcessor(context); | 970 SkTDArray<GrFragmentProcessor*> array; |
| 971 if (cf->asFragmentProcessors(context, &array)) { |
| 972 SkASSERT(1 == array.count()); // modecolorfilter only returns one |
| 973 *fp = array[0]; // transfer ownership to fp |
| 974 } |
971 return true; | 975 return true; |
972 } | 976 } |
973 | 977 |
974 // Either we don't stitch tiles, either we have a valid tile size | 978 // Either we don't stitch tiles, either we have a valid tile size |
975 SkASSERT(!fStitchTiles || !fTileSize.isEmpty()); | 979 SkASSERT(!fStitchTiles || !fTileSize.isEmpty()); |
976 | 980 |
977 SkPerlinNoiseShader::PaintingData* paintingData = | 981 SkPerlinNoiseShader::PaintingData* paintingData = |
978 SkNEW_ARGS(PaintingData, (fTileSize, fSeed, fBaseFrequencyX, fBaseFr
equencyY, matrix)); | 982 SkNEW_ARGS(PaintingData, (fTileSize, fSeed, fBaseFrequencyX, fBaseFr
equencyY, matrix)); |
979 SkAutoTUnref<GrTexture> permutationsTexture( | 983 SkAutoTUnref<GrTexture> permutationsTexture( |
980 GrRefCachedBitmapTexture(context, paintingData->getPermutationsBitmap(),
NULL)); | 984 GrRefCachedBitmapTexture(context, paintingData->getPermutationsBitmap(),
NULL)); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1034 str->append(" seed: "); | 1038 str->append(" seed: "); |
1035 str->appendScalar(fSeed); | 1039 str->appendScalar(fSeed); |
1036 str->append(" stitch tiles: "); | 1040 str->append(" stitch tiles: "); |
1037 str->append(fStitchTiles ? "true " : "false "); | 1041 str->append(fStitchTiles ? "true " : "false "); |
1038 | 1042 |
1039 this->INHERITED::toString(str); | 1043 this->INHERITED::toString(str); |
1040 | 1044 |
1041 str->append(")"); | 1045 str->append(")"); |
1042 } | 1046 } |
1043 #endif | 1047 #endif |
OLD | NEW |