Use truncation, not rounding, when converting perlin noise seed (required by SVG...
authorsenorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Thu, 9 Jan 2014 17:41:42 +0000 (17:41 +0000)
committersenorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Thu, 9 Jan 2014 17:41:42 +0000 (17:41 +0000)
BUG=
R=reed@google.com

Review URL: https://codereview.chromium.org/132053002

git-svn-id: http://skia.googlecode.com/svn/trunk@12995 2bbb7eff-a529-9590-31e7-b0007b416f81

src/effects/SkPerlinNoiseShader.cpp

index 5f85830..77ce9cb 100644 (file)
@@ -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;
         }