diff options
author | 2012-04-10 17:25:44 +0000 | |
---|---|---|
committer | 2012-04-10 17:25:44 +0000 | |
commit | 56dd630c41d662bcf2a3f08100f2c6accda05ba9 (patch) | |
tree | 94f1d1ea22e58dd214af8fb97d8ba6947e3ecc17 /src | |
parent | 0e5104c1570de4709e04720e62d80a0ca8970260 (diff) |
Clamp dilate and erode radius to image width and height.
NOTE: This will require new baselines for the morphology GM.
git-svn-id: http://skia.googlecode.com/svn/trunk@3641 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r-- | src/effects/SkMorphologyImageFilter.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp index 09610cd145..aac6f846ea 100644 --- a/src/effects/SkMorphologyImageFilter.cpp +++ b/src/effects/SkMorphologyImageFilter.cpp @@ -30,7 +30,8 @@ static void erode(const SkPMColor* src, SkPMColor* dst, int srcStrideX, int srcStrideY, int dstStrideX, int dstStrideY) { - const SkPMColor* upperSrc = src + SkMin32(radius, width - 1) * srcStrideX; + radius = SkMin32(radius, width - 1); + const SkPMColor* upperSrc = src + radius * srcStrideX; for (int x = 0; x < width; ++x) { const SkPMColor* lp = src; const SkPMColor* up = upperSrc; @@ -77,7 +78,8 @@ static void dilate(const SkPMColor* src, SkPMColor* dst, int srcStrideX, int srcStrideY, int dstStrideX, int dstStrideY) { - const SkPMColor* upperSrc = src + SkMin32(radius, width - 1) * srcStrideX; + radius = SkMin32(radius, width - 1); + const SkPMColor* upperSrc = src + radius * srcStrideX; for (int x = 0; x < width; ++x) { const SkPMColor* lp = src; const SkPMColor* up = upperSrc; |