Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(965)

Unified Diff: src/effects/SkMergeImageFilter.cpp

Issue 1133523006: Don't fail SkMergeImageFilter if one of the inputs are empty (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/ImageFilterTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkMergeImageFilter.cpp
diff --git a/src/effects/SkMergeImageFilter.cpp b/src/effects/SkMergeImageFilter.cpp
index f68d9133782ea25ad70b1019ef09e158cbd33506..4c5404d5fb8bc9baf4de46374d1a86012b268c9f 100755
--- a/src/effects/SkMergeImageFilter.cpp
+++ b/src/effects/SkMergeImageFilter.cpp
@@ -77,6 +77,7 @@ bool SkMergeImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src,
SkCanvas canvas(dst);
SkPaint paint;
+ bool didProduceResult = false;
int inputCount = countInputs();
for (int i = 0; i < inputCount; ++i) {
SkBitmap tmp;
@@ -85,7 +86,7 @@ bool SkMergeImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src,
SkImageFilter* filter = getInput(i);
if (filter) {
if (!filter->filterImage(proxy, src, ctx, &tmp, &pos)) {
- return false;
+ continue;
}
srcPtr = &tmp;
} else {
@@ -98,8 +99,12 @@ bool SkMergeImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src,
paint.setXfermode(NULL);
}
canvas.drawSprite(*srcPtr, pos.x() - x0, pos.y() - y0, &paint);
+ didProduceResult = true;
}
+ if (!didProduceResult)
+ return false;
+
offset->fX = bounds.left();
offset->fY = bounds.top();
*result = dst->accessBitmap(false);
« no previous file with comments | « no previous file | tests/ImageFilterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698