diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2011-09-16 14:32:58 +0000 |
|---|---|---|
| committer | Krzysztof KosiĆski <tweenk.pl@gmail.com> | 2011-09-16 14:32:58 +0000 |
| commit | 17f63b09c2f8746e1b65d470567eac2a18d7b2ca (patch) | |
| tree | 2d885bc02b588034fdb1f2d900ff3e4c2943774f /src | |
| parent | Remove left over debug g_warning... and the cause of compilation problems. (diff) | |
| download | inkscape-17f63b09c2f8746e1b65d470567eac2a18d7b2ca.tar.gz inkscape-17f63b09c2f8746e1b65d470567eac2a18d7b2ca.zip | |
Correct the formula of the displacement map so that zero alpha value
means maximum negative displacement rather than zero displacement.
Fixes artifacts in filters.
Fixed bugs:
- https://launchpad.net/bugs/849064
(bzr r10632)
Diffstat (limited to 'src')
| -rw-r--r-- | src/display/nr-filter-displacement-map.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/display/nr-filter-displacement-map.cpp b/src/display/nr-filter-displacement-map.cpp index 01c644bc1..9b44c2302 100644 --- a/src/display/nr-filter-displacement-map.cpp +++ b/src/display/nr-filter-displacement-map.cpp @@ -43,15 +43,16 @@ struct Displace { guint32 a = (mappx & 0xff000000) >> 24; guint32 xpx = 0, ypx = 0; double xtex = x, ytex = y; + + guint32 xshift = _xch * 8, yshift = _ych * 8; + xpx = (mappx & (0xff << xshift)) >> xshift; + ypx = (mappx & (0xff << yshift)) >> yshift; if (a) { - guint32 xshift = _xch * 8, yshift = _ych * 8; - xpx = (mappx & (0xff << xshift)) >> xshift; - ypx = (mappx & (0xff << yshift)) >> yshift; if (_xch != 3) xpx = unpremul_alpha(xpx, a); if (_ych != 3) ypx = unpremul_alpha(ypx, a); - xtex += _scalex * (xpx - 127.5); - ytex += _scaley * (ypx - 127.5); } + xtex += _scalex * (xpx - 127.5); + ytex += _scaley * (ypx - 127.5); if (xtex >= 0 && xtex < (_texture._w - 1) && ytex >= 0 && ytex < (_texture._h - 1)) |
