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

Unified Diff: src/effects/SkPerlinNoiseShader.cpp

Issue 132053002: Use truncation, not rounding, when converting perlin noise seed (required by SVG spec). (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Add comment Created 6 years, 11 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 | « no previous file | no next file » | 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 5f858303c5772c9d8096cd32d1132260682faed6..77ce9cb3482346a5ebc719afdad8954146ccbfc1 100644
--- a/src/effects/SkPerlinNoiseShader.cpp
+++ b/src/effects/SkPerlinNoiseShader.cpp
@@ -124,8 +124,9 @@ public:
{
static const SkScalar gInvBlockSizef = SkScalarInvert(SkIntToScalar(kBlockSize));
+ // According to the SVG spec, we must truncate (not round) the seed value.
+ fSeed = SkScalarTruncToInt(seed);
// The seed value clamp to the range [1, kRandMaximum - 1].
- fSeed = SkScalarRoundToInt(seed);
if (fSeed <= 0) {
fSeed = -(fSeed % (kRandMaximum - 1)) + 1;
}
« 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