aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-09-19 17:26:47 +0000
committerGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-09-19 17:26:47 +0000
commit962c8864e4cf0cfbaf8ea3d17eda83261733362a (patch)
tree0aaf8dea1549a613047b5ed0b9a5131ef4a7ce1c /src
parenteb95d6a59176e350777a991d4fa9073f6c774b40 (diff)
Implement crop rect support for the merge image filter.
Note: this will require rebaselining of the imagefilterscropped and testimagefilters GMs. R=reed@google.com Review URL: https://codereview.chromium.org/23600047 git-svn-id: http://skia.googlecode.com/svn/trunk@11387 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rwxr-xr-xsrc/effects/SkMergeImageFilter.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/effects/SkMergeImageFilter.cpp b/src/effects/SkMergeImageFilter.cpp
index 0c47c91aff..020533046d 100755
--- a/src/effects/SkMergeImageFilter.cpp
+++ b/src/effects/SkMergeImageFilter.cpp
@@ -39,7 +39,8 @@ void SkMergeImageFilter::initModes(const SkXfermode::Mode modes[]) {
}
SkMergeImageFilter::SkMergeImageFilter(SkImageFilter* first, SkImageFilter* second,
- SkXfermode::Mode mode) : INHERITED(first, second) {
+ SkXfermode::Mode mode,
+ const SkIRect* cropRect) : INHERITED(first, second, cropRect) {
if (SkXfermode::kSrcOver_Mode != mode) {
SkXfermode::Mode modes[] = { mode, mode };
this->initModes(modes);
@@ -49,7 +50,8 @@ SkMergeImageFilter::SkMergeImageFilter(SkImageFilter* first, SkImageFilter* seco
}
SkMergeImageFilter::SkMergeImageFilter(SkImageFilter* filters[], int count,
- const SkXfermode::Mode modes[]) : INHERITED(count, filters) {
+ const SkXfermode::Mode modes[],
+ const SkIRect* cropRect) : INHERITED(count, filters, cropRect) {
this->initModes(modes);
}
@@ -99,10 +101,9 @@ bool SkMergeImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src,
return false;
}
- const SkIRect srcBounds = SkIRect::MakeXYWH(loc->x(), loc->y(),
- src.width(), src.height());
SkIRect bounds;
- if (!this->filterBounds(srcBounds, ctm, &bounds)) {
+ src.getBounds(&bounds);
+ if (!this->applyCropRect(&bounds, ctm)) {
return false;
}
@@ -120,7 +121,7 @@ bool SkMergeImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src,
for (int i = 0; i < inputCount; ++i) {
SkBitmap tmp;
const SkBitmap* srcPtr;
- SkIPoint pos = *loc;
+ SkIPoint pos = SkIPoint::Make(0, 0);
SkImageFilter* filter = getInput(i);
if (filter) {
if (!filter->filterImage(proxy, src, ctm, &tmp, &pos)) {
@@ -139,7 +140,8 @@ bool SkMergeImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src,
canvas.drawSprite(*srcPtr, pos.x() - x0, pos.y() - y0, &paint);
}
- loc->set(bounds.left(), bounds.top());
+ loc->fX += bounds.left();
+ loc->fY += bounds.top();
*result = dst->accessBitmap(false);
return true;
}