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

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

Issue 2198263002: Image filters: force near-zero floating point parameters to zero. Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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
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 "SkPerlinNoiseShader.h" 8 #include "SkPerlinNoiseShader.h"
9 #include "SkColorFilter.h" 9 #include "SkColorFilter.h"
10 #include "SkReadBuffer.h" 10 #include "SkReadBuffer.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 PaintingData(const SkISize& tileSize, SkScalar seed, 79 PaintingData(const SkISize& tileSize, SkScalar seed,
80 SkScalar baseFrequencyX, SkScalar baseFrequencyY, 80 SkScalar baseFrequencyX, SkScalar baseFrequencyY,
81 const SkMatrix& matrix) 81 const SkMatrix& matrix)
82 { 82 {
83 SkVector vec[2] = { 83 SkVector vec[2] = {
84 { SkScalarInvert(baseFrequencyX), SkScalarInvert(baseFrequencyY) }, 84 { SkScalarInvert(baseFrequencyX), SkScalarInvert(baseFrequencyY) },
85 { SkIntToScalar(tileSize.fWidth), SkIntToScalar(tileSize.fHeight) }, 85 { SkIntToScalar(tileSize.fWidth), SkIntToScalar(tileSize.fHeight) },
86 }; 86 };
87 matrix.mapVectors(vec, 2); 87 matrix.mapVectors(vec, 2);
88 88
89 fBaseFrequency.set(SkScalarInvert(vec[0].fX), SkScalarInvert(vec[0].fY)) ; 89 fBaseFrequency.set(SkScalarNormalize(SkScalarInvert(vec[0].fX)), SkScala rNormalize(SkScalarInvert(vec[0].fY)));
90 fTileSize.set(SkScalarRoundToInt(vec[1].fX), SkScalarRoundToInt(vec[1].f Y)); 90 fTileSize.set(SkScalarRoundToInt(vec[1].fX), SkScalarRoundToInt(vec[1].f Y));
91 this->init(seed); 91 this->init(seed);
92 if (!fTileSize.isEmpty()) { 92 if (!fTileSize.isEmpty()) {
93 this->stitch(); 93 this->stitch();
94 } 94 }
95 95
96 #if SK_SUPPORT_GPU 96 #if SK_SUPPORT_GPU
97 fPermutationsBitmap.setInfo(SkImageInfo::MakeA8(kBlockSize, 1)); 97 fPermutationsBitmap.setInfo(SkImageInfo::MakeA8(kBlockSize, 1));
98 fPermutationsBitmap.setPixels(fLatticeSelector); 98 fPermutationsBitmap.setPixels(fLatticeSelector);
99 99
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 str->append(" seed: "); 973 str->append(" seed: ");
974 str->appendScalar(fSeed); 974 str->appendScalar(fSeed);
975 str->append(" stitch tiles: "); 975 str->append(" stitch tiles: ");
976 str->append(fStitchTiles ? "true " : "false "); 976 str->append(fStitchTiles ? "true " : "false ");
977 977
978 this->INHERITED::toString(str); 978 this->INHERITED::toString(str);
979 979
980 str->append(")"); 980 str->append(")");
981 } 981 }
982 #endif 982 #endif
OLDNEW
« include/core/SkScalar.h ('K') | « src/effects/SkMatrixConvolutionImageFilter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698