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

Unified Diff: src/effects/SkDisplacementMapEffect.cpp

Issue 189913021: Implement support for a Context parameter in image filters (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Revert all but the Context changes. Created 6 years, 9 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 | « src/effects/SkComposeImageFilter.cpp ('k') | src/effects/SkDropShadowImageFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkDisplacementMapEffect.cpp
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index 15e93c11cdd336d0b76420e3222bcf8e8490b603..a1c18c647ef6c168b222ead68bf321a872e8cdee 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -194,15 +194,15 @@ void SkDisplacementMapEffect::flatten(SkWriteBuffer& buffer) const {
bool SkDisplacementMapEffect::onFilterImage(Proxy* proxy,
const SkBitmap& src,
- const SkMatrix& ctm,
+ const Context& ctx,
SkBitmap* dst,
SkIPoint* offset) const {
SkBitmap displ = src, color = src;
const SkImageFilter* colorInput = getColorInput();
const SkImageFilter* displInput = getDisplacementInput();
SkIPoint colorOffset = SkIPoint::Make(0, 0), displOffset = SkIPoint::Make(0, 0);
- if ((colorInput && !colorInput->filterImage(proxy, src, ctm, &color, &colorOffset)) ||
- (displInput && !displInput->filterImage(proxy, src, ctm, &displ, &displOffset))) {
+ if ((colorInput && !colorInput->filterImage(proxy, src, ctx, &color, &colorOffset)) ||
+ (displInput && !displInput->filterImage(proxy, src, ctx, &displ, &displOffset))) {
return false;
}
if ((displ.colorType() != kPMColor_SkColorType) ||
@@ -217,13 +217,13 @@ bool SkDisplacementMapEffect::onFilterImage(Proxy* proxy,
SkIRect bounds;
color.getBounds(&bounds);
bounds.offset(colorOffset);
- if (!this->applyCropRect(&bounds, ctm)) {
+ if (!this->applyCropRect(&bounds, ctx.ctm())) {
return false;
}
SkIRect displBounds;
displ.getBounds(&displBounds);
displBounds.offset(displOffset);
- if (!this->applyCropRect(&displBounds, ctm)) {
+ if (!this->applyCropRect(&displBounds, ctx.ctm())) {
return false;
}
if (!bounds.intersect(displBounds)) {
@@ -236,7 +236,7 @@ bool SkDisplacementMapEffect::onFilterImage(Proxy* proxy,
}
SkVector scale = SkVector::Make(fScale, fScale);
- ctm.mapVectors(&scale, 1);
+ ctx.ctm().mapVectors(&scale, 1);
SkIRect colorBounds = bounds;
colorBounds.offset(-colorOffset);
@@ -348,11 +348,11 @@ private:
typedef GrEffect INHERITED;
};
-bool SkDisplacementMapEffect::filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatrix& ctm,
+bool SkDisplacementMapEffect::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx,
SkBitmap* result, SkIPoint* offset) const {
SkBitmap colorBM = src;
SkIPoint colorOffset = SkIPoint::Make(0, 0);
- if (getColorInput() && !getColorInput()->getInputResultGPU(proxy, src, ctm, &colorBM,
+ if (getColorInput() && !getColorInput()->getInputResultGPU(proxy, src, ctx, &colorBM,
&colorOffset)) {
return false;
}
@@ -360,7 +360,7 @@ bool SkDisplacementMapEffect::filterImageGPU(Proxy* proxy, const SkBitmap& src,
SkBitmap displacementBM = src;
SkIPoint displacementOffset = SkIPoint::Make(0, 0);
if (getDisplacementInput() &&
- !getDisplacementInput()->getInputResultGPU(proxy, src, ctm, &displacementBM,
+ !getDisplacementInput()->getInputResultGPU(proxy, src, ctx, &displacementBM,
&displacementOffset)) {
return false;
}
@@ -379,17 +379,17 @@ bool SkDisplacementMapEffect::filterImageGPU(Proxy* proxy, const SkBitmap& src,
GrContext::AutoRenderTarget art(context, dst->asRenderTarget());
SkVector scale = SkVector::Make(fScale, fScale);
- ctm.mapVectors(&scale, 1);
+ ctx.ctm().mapVectors(&scale, 1);
SkIRect bounds;
colorBM.getBounds(&bounds);
bounds.offset(colorOffset);
- if (!this->applyCropRect(&bounds, ctm)) {
+ if (!this->applyCropRect(&bounds, ctx.ctm())) {
return false;
}
SkIRect displBounds;
displacementBM.getBounds(&displBounds);
displBounds.offset(displacementOffset);
- if (!this->applyCropRect(&displBounds, ctm)) {
+ if (!this->applyCropRect(&displBounds, ctx.ctm())) {
return false;
}
if (!bounds.intersect(displBounds)) {
« no previous file with comments | « src/effects/SkComposeImageFilter.cpp ('k') | src/effects/SkDropShadowImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698