aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects
diff options
context:
space:
mode:
authorGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-01-09 17:41:42 +0000
committerGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-01-09 17:41:42 +0000
commit857e320300372dab938c0dbffadc3c2c8a893b92 (patch)
tree70c005b39f96ede6242133d8556d1b0cede7dcad /src/effects
parent9a907fa0d3ac573af2f5b45bd41af76c9035777f (diff)
Use truncation, not rounding, when converting perlin noise seed (required by SVG spec).
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
Diffstat (limited to 'src/effects')
-rw-r--r--src/effects/SkPerlinNoiseShader.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp
index 5f858303c5..77ce9cb348 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;
}