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

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

Issue 974183002: simplify logic in SkPerliNoiseShader for GPU when constant color (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use >> Created 5 years, 9 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 | « no previous file | no next file » | 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 943 matching lines...) Expand 10 before | Expand all | Expand 10 after
954 954
955 SkMatrix localMatrix = this->getLocalMatrix(); 955 SkMatrix localMatrix = this->getLocalMatrix();
956 if (externalLocalMatrix) { 956 if (externalLocalMatrix) {
957 localMatrix.preConcat(*externalLocalMatrix); 957 localMatrix.preConcat(*externalLocalMatrix);
958 } 958 }
959 959
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;
965 if (kFractalNoise_Type == fType) { 964 if (kFractalNoise_Type == fType) {
966 clearColor = SkColorSetARGB(paint.getAlpha() / 2, 127, 127, 127); 965 uint32_t alpha = paint.getAlpha() >> 1;
967 } 966 uint32_t rgb = alpha >> 1;
968 SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter( 967 *paintColor = GrColorPackRGBA(rgb, rgb, rgb, alpha);
969 clearColor, SkXfermode::kSrc_Mod e)); 968 } else {
970 SkTDArray<GrFragmentProcessor*> array; 969 *paintColor = 0;
971 if (cf->asFragmentProcessors(context, &array)) {
972 SkASSERT(1 == array.count()); // modecolorfilter only returns one
973 *fp = array[0]; // transfer ownership to fp
974 } 970 }
975 return true; 971 return true;
976 } 972 }
977 973
978 // Either we don't stitch tiles, either we have a valid tile size 974 // Either we don't stitch tiles, either we have a valid tile size
979 SkASSERT(!fStitchTiles || !fTileSize.isEmpty()); 975 SkASSERT(!fStitchTiles || !fTileSize.isEmpty());
980 976
981 SkPerlinNoiseShader::PaintingData* paintingData = 977 SkPerlinNoiseShader::PaintingData* paintingData =
982 SkNEW_ARGS(PaintingData, (fTileSize, fSeed, fBaseFrequencyX, fBaseFr equencyY, matrix)); 978 SkNEW_ARGS(PaintingData, (fTileSize, fSeed, fBaseFrequencyX, fBaseFr equencyY, matrix));
983 SkAutoTUnref<GrTexture> permutationsTexture( 979 SkAutoTUnref<GrTexture> permutationsTexture(
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 str->append(" seed: "); 1034 str->append(" seed: ");
1039 str->appendScalar(fSeed); 1035 str->appendScalar(fSeed);
1040 str->append(" stitch tiles: "); 1036 str->append(" stitch tiles: ");
1041 str->append(fStitchTiles ? "true " : "false "); 1037 str->append(fStitchTiles ? "true " : "false ");
1042 1038
1043 this->INHERITED::toString(str); 1039 this->INHERITED::toString(str);
1044 1040
1045 str->append(")"); 1041 str->append(")");
1046 } 1042 }
1047 #endif 1043 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698