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

Unified Diff: src/effects/SkPerlinNoiseShader.cpp

Issue 111393010: replace SkScalarMulRound(a,b) with SkScalarRountToInt(a*b) (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years 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/animator/SkMemberInfo.cpp ('k') | src/utils/SkInterpolator.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 26771c5db7d5d79b9c83d2a74e3c988ea379e9a7..5f858303c5772c9d8096cd32d1132260682faed6 100644
--- a/src/effects/SkPerlinNoiseShader.cpp
+++ b/src/effects/SkPerlinNoiseShader.cpp
@@ -203,10 +203,10 @@ public:
// When stitching tiled turbulence, the frequencies must be adjusted
// so that the tile borders will be continuous.
if (fBaseFrequency.fX) {
- SkScalar lowFrequencx = SkScalarDiv(
- SkScalarMulFloor(tileWidth, fBaseFrequency.fX), tileWidth);
- SkScalar highFrequencx = SkScalarDiv(
- SkScalarMulCeil(tileWidth, fBaseFrequency.fX), tileWidth);
+ SkScalar lowFrequencx =
+ SkScalarFloorToScalar(tileWidth * fBaseFrequency.fX) / tileWidth;
+ SkScalar highFrequencx =
+ SkScalarCeilToScalar(tileWidth * fBaseFrequency.fX) / tileWidth;
// BaseFrequency should be non-negative according to the standard.
if (SkScalarDiv(fBaseFrequency.fX, lowFrequencx) <
SkScalarDiv(highFrequencx, fBaseFrequency.fX)) {
@@ -216,10 +216,10 @@ public:
}
}
if (fBaseFrequency.fY) {
- SkScalar lowFrequency = SkScalarDiv(
- SkScalarMulFloor(tileHeight, fBaseFrequency.fY), tileHeight);
- SkScalar highFrequency = SkScalarDiv(
- SkScalarMulCeil(tileHeight, fBaseFrequency.fY), tileHeight);
+ SkScalar lowFrequency =
+ SkScalarFloorToScalar(tileHeight * fBaseFrequency.fY) / tileHeight;
+ SkScalar highFrequency =
+ SkScalarCeilToScalar(tileHeight * fBaseFrequency.fY) / tileHeight;
if (SkScalarDiv(fBaseFrequency.fY, lowFrequency) <
SkScalarDiv(highFrequency, fBaseFrequency.fY)) {
fBaseFrequency.fY = lowFrequency;
@@ -229,10 +229,10 @@ public:
}
// Set up TurbulenceInitial stitch values.
fStitchDataInit.fWidth =
- SkScalarMulRound(tileWidth, fBaseFrequency.fX);
+ SkScalarRoundToInt(tileWidth * fBaseFrequency.fX);
fStitchDataInit.fWrapX = kPerlinNoise + fStitchDataInit.fWidth;
fStitchDataInit.fHeight =
- SkScalarMulRound(tileHeight, fBaseFrequency.fY);
+ SkScalarRoundToInt(tileHeight * fBaseFrequency.fY);
fStitchDataInit.fWrapY = kPerlinNoise + fStitchDataInit.fHeight;
}
« no previous file with comments | « src/animator/SkMemberInfo.cpp ('k') | src/utils/SkInterpolator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698