aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects
diff options
context:
space:
mode:
authorGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-01 14:03:41 +0000
committerGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-01 14:03:41 +0000
commit9195743aac79a4fa82059ab614b9795f215475f7 (patch)
treea4c2e016ad9245438a0d9cf7a663941ca51a6b4e /src/effects
parent64baf926eaea1d74879e6efef9df6da41a697db6 (diff)
Add a fix for a spurious assert in SkMatrixConvolutionImageFilter.
When matrix convolution processes border pixels with zero width, it asserts in getAddr32() with an invalid x coordinate. The assert is harmless, since the returned pointer is never accessed (the next line is a loop from left to right, which does nothing, since left == right). However, the fix is simple: early out on an empty rect before entering the outer loop. R=sugoi@chromium.org Review URL: https://codereview.chromium.org/265693005 git-svn-id: http://skia.googlecode.com/svn/trunk@14497 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/effects')
-rw-r--r--src/effects/SkMatrixConvolutionImageFilter.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/effects/SkMatrixConvolutionImageFilter.cpp b/src/effects/SkMatrixConvolutionImageFilter.cpp
index 3c9fc87787..be1dcb4ce9 100644
--- a/src/effects/SkMatrixConvolutionImageFilter.cpp
+++ b/src/effects/SkMatrixConvolutionImageFilter.cpp
@@ -153,6 +153,9 @@ void SkMatrixConvolutionImageFilter::filterPixels(const SkBitmap& src,
SkBitmap* result,
const SkIRect& rect,
const SkIRect& bounds) const {
+ if (rect.isEmpty()) {
+ return;
+ }
for (int y = rect.fTop; y < rect.fBottom; ++y) {
SkPMColor* dptr = result->getAddr32(rect.fLeft - bounds.fLeft, y - bounds.fTop);
for (int x = rect.fLeft; x < rect.fRight; ++x) {