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

Unified Diff: src/effects/SkPerlinNoiseShader.cpp

Issue 1003813003: some utils for rect and matrix (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkScan_Hairline.cpp ('k') | src/fonts/SkTestScalerContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkPerlinNoiseShader.cpp
diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp
index 3c1bf2fd0342e44ab3ecb74532d49b7efd198c9c..fa46cbd44ac5c5e073b197a8b204170001a0f9c2 100644
--- a/src/effects/SkPerlinNoiseShader.cpp
+++ b/src/effects/SkPerlinNoiseShader.cpp
@@ -78,16 +78,14 @@ struct SkPerlinNoiseShader::PaintingData {
SkScalar baseFrequencyX, SkScalar baseFrequencyY,
const SkMatrix& matrix)
{
- SkVector wavelength = SkVector::Make(SkScalarInvert(baseFrequencyX),
- SkScalarInvert(baseFrequencyY));
- matrix.mapVectors(&wavelength, 1);
- fBaseFrequency.fX = SkScalarInvert(wavelength.fX);
- fBaseFrequency.fY = SkScalarInvert(wavelength.fY);
- SkVector sizeVec = SkVector::Make(SkIntToScalar(tileSize.fWidth),
- SkIntToScalar(tileSize.fHeight));
- matrix.mapVectors(&sizeVec, 1);
- fTileSize.fWidth = SkScalarRoundToInt(sizeVec.fX);
- fTileSize.fHeight = SkScalarRoundToInt(sizeVec.fY);
+ SkVector vec[2] = {
+ { SkScalarInvert(baseFrequencyX), SkScalarInvert(baseFrequencyY) },
+ { SkIntToScalar(tileSize.fWidth), SkIntToScalar(tileSize.fHeight) },
+ };
+ matrix.mapVectors(vec, 2);
+
+ fBaseFrequency.set(SkScalarInvert(vec[0].fX), SkScalarInvert(vec[0].fY));
+ fTileSize.set(SkScalarRoundToInt(vec[1].fX), SkScalarRoundToInt(vec[1].fY));
this->init(seed);
if (!fTileSize.isEmpty()) {
this->stitch();
« no previous file with comments | « src/core/SkScan_Hairline.cpp ('k') | src/fonts/SkTestScalerContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698