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

Unified Diff: src/effects/SkLightingImageFilter.cpp

Issue 112803004: Make SkImageFilter crop rects relative to the primitive origin, instead of relative to their parent (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Remove a useless zero. Created 6 years, 12 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
Index: src/effects/SkLightingImageFilter.cpp
diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp
index 50cca07dfdb7e24f4fcbc425e46b7789954eba31..67d268143f3be53cb0e34efb3b6954947bb0d338 100644
--- a/src/effects/SkLightingImageFilter.cpp
+++ b/src/effects/SkLightingImageFilter.cpp
@@ -927,7 +927,8 @@ bool SkDiffuseLightingImageFilter::onFilterImage(Proxy* proxy,
SkIPoint* offset) {
SkImageFilter* input = getInput(0);
SkBitmap src = source;
- if (input && !input->filterImage(proxy, source, ctm, &src, offset)) {
+ SkIPoint srcOffset = SkIPoint::Make(0, 0);
+ if (input && !input->filterImage(proxy, source, ctm, &src, &srcOffset)) {
return false;
}
@@ -941,6 +942,7 @@ bool SkDiffuseLightingImageFilter::onFilterImage(Proxy* proxy,
SkIRect bounds;
src.getBounds(&bounds);
+ bounds.offset(srcOffset);
if (!this->applyCropRect(&bounds, ctm)) {
return false;
}
@@ -970,8 +972,8 @@ bool SkDiffuseLightingImageFilter::onFilterImage(Proxy* proxy,
break;
}
- offset->fX += bounds.left();
- offset->fY += bounds.top();
+ offset->fX = bounds.left();
+ offset->fY = bounds.top();
return true;
}
@@ -1018,7 +1020,8 @@ bool SkSpecularLightingImageFilter::onFilterImage(Proxy* proxy,
SkIPoint* offset) {
SkImageFilter* input = getInput(0);
SkBitmap src = source;
- if (input && !input->filterImage(proxy, source, ctm, &src, offset)) {
+ SkIPoint srcOffset = SkIPoint::Make(0, 0);
+ if (input && !input->filterImage(proxy, source, ctm, &src, &srcOffset)) {
return false;
}
@@ -1032,6 +1035,7 @@ bool SkSpecularLightingImageFilter::onFilterImage(Proxy* proxy,
SkIRect bounds;
src.getBounds(&bounds);
+ bounds.offset(srcOffset);
if (!this->applyCropRect(&bounds, ctm)) {
return false;
}
@@ -1059,8 +1063,8 @@ bool SkSpecularLightingImageFilter::onFilterImage(Proxy* proxy,
lightBitmap<SpecularLightingType, SkSpotLight>(lightingType, transformedLight, src, dst, surfaceScale(), bounds);
break;
}
- offset->fX += bounds.left();
- offset->fY += bounds.top();
+ offset->fX = bounds.left();
+ offset->fY = bounds.top();
return true;
}

Powered by Google App Engine
This is Rietveld 408576698