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

Unified Diff: src/effects/SkDisplacementMapEffect.cpp

Issue 15995026: Image filters: implement offsets in GPU path. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Wrap lines at 100 chars. Created 7 years, 5 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/SkBlurImageFilter.cpp ('k') | src/effects/SkMorphologyImageFilter.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 7c99c023f8adb4cd58ed5e9869c0a2691d5b8dad..8d287b270462bee06ae14546cb8869c1e6db205b 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -275,14 +275,19 @@ private:
typedef GrEffect INHERITED;
};
-bool SkDisplacementMapEffect::filterImageGPU(Proxy* proxy, const SkBitmap& src, SkBitmap* result) {
+bool SkDisplacementMapEffect::filterImageGPU(Proxy* proxy, const SkBitmap& src, SkBitmap* result,
+ SkIPoint* offset) {
SkBitmap colorBM;
- if (!SkImageFilterUtils::GetInputResultGPU(getColorInput(), proxy, src, &colorBM)) {
+ SkIPoint colorOffset = SkIPoint::Make(0, 0);
+ if (!SkImageFilterUtils::GetInputResultGPU(getColorInput(), proxy, src, &colorBM,
+ &colorOffset)) {
return false;
}
GrTexture* color = colorBM.getTexture();
SkBitmap displacementBM;
- if (!SkImageFilterUtils::GetInputResultGPU(getDisplacementInput(), proxy, src, &displacementBM)) {
+ SkIPoint displacementOffset = SkIPoint::Make(0, 0);
+ if (!SkImageFilterUtils::GetInputResultGPU(getDisplacementInput(), proxy, src, &displacementBM,
+ &displacementOffset)) {
return false;
}
GrTexture* displacement = displacementBM.getTexture();
@@ -308,7 +313,9 @@ bool SkDisplacementMapEffect::filterImageGPU(Proxy* proxy, const SkBitmap& src,
color))->unref();
SkRect srcRect;
src.getBounds(&srcRect);
- context->drawRect(paint, srcRect);
+ SkRect dstRect = srcRect;
+ dstRect.offset(SkIntToScalar(colorOffset.fX), SkIntToScalar(colorOffset.fY));
+ context->drawRectToRect(paint, srcRect, dstRect);
return SkImageFilterUtils::WrapTexture(dst, src.width(), src.height(), result);
}
« no previous file with comments | « src/effects/SkBlurImageFilter.cpp ('k') | src/effects/SkMorphologyImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698