diff options
author | 2014-03-14 15:44:01 +0000 | |
---|---|---|
committer | 2014-03-14 15:44:01 +0000 | |
commit | 4cb543d6057b692e1099e9f115155f0bf323a0c8 (patch) | |
tree | 66f8cbe4e7ef74221766ade874096f934c8b2031 /src/effects/SkOffsetImageFilter.cpp | |
parent | 0d30c51c6cf45b3a08a3000b6d348c16bdec7f05 (diff) |
Implement support for a Context parameter in image filters
Some upcoming work (support for expanding crop rects) requires
the clip bounds to be available during filter traversal. This change
replaces the SkMatrix parameter in the onFilterImage() traversals
with a Context parameter. It contains the CTM, as well as the clip
bounds.
BUG=skia:
R=reed@google.com
Review URL: https://codereview.chromium.org/189913021
git-svn-id: http://skia.googlecode.com/svn/trunk@13803 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/effects/SkOffsetImageFilter.cpp')
-rw-r--r-- | src/effects/SkOffsetImageFilter.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/effects/SkOffsetImageFilter.cpp b/src/effects/SkOffsetImageFilter.cpp index 12c5af6649..98eb05bf1d 100644 --- a/src/effects/SkOffsetImageFilter.cpp +++ b/src/effects/SkOffsetImageFilter.cpp @@ -15,7 +15,7 @@ #include "SkPaint.h" bool SkOffsetImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& source, - const SkMatrix& matrix, + const Context& ctx, SkBitmap* result, SkIPoint* offset) const { SkImageFilter* input = getInput(0); @@ -26,18 +26,18 @@ bool SkOffsetImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& source, #else if (!cropRectIsSet()) { #endif - if (input && !input->filterImage(proxy, source, matrix, &src, &srcOffset)) { + if (input && !input->filterImage(proxy, source, ctx, &src, &srcOffset)) { return false; } SkVector vec; - matrix.mapVectors(&vec, &fOffset, 1); + ctx.ctm().mapVectors(&vec, &fOffset, 1); offset->fX = srcOffset.fX + SkScalarRoundToInt(vec.fX); offset->fY = srcOffset.fY + SkScalarRoundToInt(vec.fY); *result = src; } else { - if (input && !input->filterImage(proxy, source, matrix, &src, &srcOffset)) { + if (input && !input->filterImage(proxy, source, ctx, &src, &srcOffset)) { return false; } @@ -45,7 +45,7 @@ bool SkOffsetImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& source, src.getBounds(&bounds); bounds.offset(srcOffset); - if (!applyCropRect(&bounds, matrix)) { + if (!applyCropRect(&bounds, ctx.ctm())) { return false; } @@ -59,7 +59,7 @@ bool SkOffsetImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& source, canvas.translate(SkIntToScalar(srcOffset.fX - bounds.fLeft), SkIntToScalar(srcOffset.fY - bounds.fTop)); SkVector vec; - matrix.mapVectors(&vec, &fOffset, 1); + ctx.ctm().mapVectors(&vec, &fOffset, 1); canvas.drawBitmap(src, vec.x(), vec.y(), &paint); *result = device->accessBitmap(false); offset->fX = bounds.fLeft; |