Fix tiled perlin noise.
authorsenorblanco <senorblanco@chromium.org>
Thu, 12 Jun 2014 18:24:19 +0000 (11:24 -0700)
committerCommit bot <commit-bot@chromium.org>
Thu, 12 Jun 2014 18:24:20 +0000 (11:24 -0700)
commitce6a354e121915c2925e545e7df2929492d69d50
tree0d402dcd9fb7e585254f3dcd43051b7d532e3c93
parente61c411c1258a323a010558c08de3d9f8d170dca
Fix tiled perlin noise.

It turns out that the perlin implementation we inherited from WebKit
does not actually generate tileable noise (see Chromium bug
http://crbug.com/383495).

The main problem is that when generating coordinates for gradient
interpolation, it was attempting to wrap both x and (x + 1)
simultaneously at the tile boundary (that is, either both or neither
are wrapped). This obviously won't work, since along the tile seams,
(x + 1) should be wrapped, but x should not. The same is true in y.

This patch fixes both the CPU and GPU paths, renames some variables to
more closely match the spec, and modifies the perlin noise GM to
actually test tiling. (Note that the clipping the GM was doing was
removed, since it's superfluous: it used to be necessary for image
filters, but isn't anymore, and this isn't an image filter GM anyway.)

R=sugoi@google.com, sugoi
TBR=senorblanco

Author: senorblanco@chromium.org

Review URL: https://codereview.chromium.org/332523006
expectations/gm/ignored-tests.txt
gm/perlinnoise.cpp
src/effects/SkPerlinNoiseShader.cpp