Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/effects/SkPerlinNoiseShader.cpp

Issue 1348583002: Make skpaint->grpaint flow work for composing draws (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove unused inheriteds to satisfy clang Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/effects/SkColorFilters.cpp ('k') | src/effects/gradients/SkLinearGradient.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 927
928 SkMatrix matrix = viewM; 928 SkMatrix matrix = viewM;
929 matrix.preConcat(localMatrix); 929 matrix.preConcat(localMatrix);
930 930
931 if (0 == fNumOctaves) { 931 if (0 == fNumOctaves) {
932 if (kFractalNoise_Type == fType) { 932 if (kFractalNoise_Type == fType) {
933 // Extract the incoming alpha and emit rgba = (a/4, a/4, a/4, a/2) 933 // Extract the incoming alpha and emit rgba = (a/4, a/4, a/4, a/2)
934 SkAutoTUnref<const GrFragmentProcessor> inner( 934 SkAutoTUnref<const GrFragmentProcessor> inner(
935 GrConstColorProcessor::Create(0x80404040, 935 GrConstColorProcessor::Create(0x80404040,
936 GrConstColorProcessor::kModulateRG BA_InputMode)); 936 GrConstColorProcessor::kModulateRG BA_InputMode));
937 return GrFragmentProcessor::MulOuputByInputAlpha(inner); 937 return GrFragmentProcessor::MulOutputByInputAlpha(inner);
938 } 938 }
939 // Emit zero. 939 // Emit zero.
940 return GrConstColorProcessor::Create(0x0, GrConstColorProcessor::kIgnore _InputMode); 940 return GrConstColorProcessor::Create(0x0, GrConstColorProcessor::kIgnore _InputMode);
941 } 941 }
942 942
943 // Either we don't stitch tiles, either we have a valid tile size 943 // Either we don't stitch tiles, either we have a valid tile size
944 SkASSERT(!fStitchTiles || !fTileSize.isEmpty()); 944 SkASSERT(!fStitchTiles || !fTileSize.isEmpty());
945 945
946 SkPerlinNoiseShader::PaintingData* paintingData = 946 SkPerlinNoiseShader::PaintingData* paintingData =
947 new PaintingData(fTileSize, fSeed, fBaseFrequencyX, fBaseFrequencyY, matrix); 947 new PaintingData(fTileSize, fSeed, fBaseFrequencyX, fBaseFrequencyY, matrix);
948 SkAutoTUnref<GrTexture> permutationsTexture( 948 SkAutoTUnref<GrTexture> permutationsTexture(
949 GrRefCachedBitmapTexture(context, paintingData->getPermutationsBitmap(), nullptr)); 949 GrRefCachedBitmapTexture(context, paintingData->getPermutationsBitmap(), nullptr));
950 SkAutoTUnref<GrTexture> noiseTexture( 950 SkAutoTUnref<GrTexture> noiseTexture(
951 GrRefCachedBitmapTexture(context, paintingData->getNoiseBitmap(), nullpt r)); 951 GrRefCachedBitmapTexture(context, paintingData->getNoiseBitmap(), nullpt r));
952 952
953 SkMatrix m = viewM; 953 SkMatrix m = viewM;
954 m.setTranslateX(-localMatrix.getTranslateX() + SK_Scalar1); 954 m.setTranslateX(-localMatrix.getTranslateX() + SK_Scalar1);
955 m.setTranslateY(-localMatrix.getTranslateY() + SK_Scalar1); 955 m.setTranslateY(-localMatrix.getTranslateY() + SK_Scalar1);
956 if ((permutationsTexture) && (noiseTexture)) { 956 if ((permutationsTexture) && (noiseTexture)) {
957 SkAutoTUnref<GrFragmentProcessor> inner( 957 SkAutoTUnref<GrFragmentProcessor> inner(
958 GrPerlinNoiseEffect::Create(procDataManager, 958 GrPerlinNoiseEffect::Create(procDataManager,
959 fType, 959 fType,
960 fNumOctaves, 960 fNumOctaves,
961 fStitchTiles, 961 fStitchTiles,
962 paintingData, 962 paintingData,
963 permutationsTexture, noiseTexture, 963 permutationsTexture, noiseTexture,
964 m)); 964 m));
965 return GrFragmentProcessor::MulOuputByInputAlpha(inner); 965 return GrFragmentProcessor::MulOutputByInputAlpha(inner);
966 } 966 }
967 delete paintingData; 967 delete paintingData;
968 return nullptr; 968 return nullptr;
969 } 969 }
970 970
971 #endif 971 #endif
972 972
973 #ifndef SK_IGNORE_TO_STRING 973 #ifndef SK_IGNORE_TO_STRING
974 void SkPerlinNoiseShader::toString(SkString* str) const { 974 void SkPerlinNoiseShader::toString(SkString* str) const {
975 str->append("SkPerlinNoiseShader: ("); 975 str->append("SkPerlinNoiseShader: (");
(...skipping 19 matching lines...) Expand all
995 str->append(" seed: "); 995 str->append(" seed: ");
996 str->appendScalar(fSeed); 996 str->appendScalar(fSeed);
997 str->append(" stitch tiles: "); 997 str->append(" stitch tiles: ");
998 str->append(fStitchTiles ? "true " : "false "); 998 str->append(fStitchTiles ? "true " : "false ");
999 999
1000 this->INHERITED::toString(str); 1000 this->INHERITED::toString(str);
1001 1001
1002 str->append(")"); 1002 str->append(")");
1003 } 1003 }
1004 #endif 1004 #endif
OLDNEW
« no previous file with comments | « src/effects/SkColorFilters.cpp ('k') | src/effects/gradients/SkLinearGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698