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

Unified Diff: src/effects/SkMergeImageFilter.cpp

Issue 23600047: Implement crop rect support for the merge image filter. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Remove useless #include. Created 7 years, 3 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 | « include/effects/SkMergeImageFilter.h ('k') | no next file » | 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 0c47c91aff21d73e4da6738682da3d2f7d044657..020533046df7500e4fd2923cb51ed7230bce1a55 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;
}
« no previous file with comments | « include/effects/SkMergeImageFilter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698