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

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: Updated to ToT 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
« no previous file with comments | « src/effects/SkDropShadowImageFilter.cpp ('k') | src/effects/SkMatrixConvolutionImageFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkLightingImageFilter.cpp
diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp
index 50cca07dfdb7e24f4fcbc425e46b7789954eba31..b24a91eb44ed355e6501a1fa25d29544103dd7b2 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;
}
@@ -958,6 +960,9 @@ bool SkDiffuseLightingImageFilter::onFilterImage(Proxy* proxy,
SkAutoTUnref<SkLight> transformedLight(light()->transform(ctm));
DiffuseLightingType lightingType(fKD);
+ offset->fX = bounds.left();
+ offset->fY = bounds.top();
+ bounds.offset(-srcOffset);
switch (transformedLight->type()) {
case SkLight::kDistant_LightType:
lightBitmap<DiffuseLightingType, SkDistantLight>(lightingType, transformedLight, src, dst, surfaceScale(), bounds);
@@ -970,8 +975,6 @@ bool SkDiffuseLightingImageFilter::onFilterImage(Proxy* proxy,
break;
}
- offset->fX += bounds.left();
- offset->fY += bounds.top();
return true;
}
@@ -1018,7 +1021,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 +1036,7 @@ bool SkSpecularLightingImageFilter::onFilterImage(Proxy* proxy,
SkIRect bounds;
src.getBounds(&bounds);
+ bounds.offset(srcOffset);
if (!this->applyCropRect(&bounds, ctm)) {
return false;
}
@@ -1047,6 +1052,9 @@ bool SkSpecularLightingImageFilter::onFilterImage(Proxy* proxy,
}
SpecularLightingType lightingType(fKS, fShininess);
+ offset->fX = bounds.left();
+ offset->fY = bounds.top();
+ bounds.offset(-srcOffset);
SkAutoTUnref<SkLight> transformedLight(light()->transform(ctm));
switch (transformedLight->type()) {
case SkLight::kDistant_LightType:
@@ -1059,8 +1067,6 @@ bool SkSpecularLightingImageFilter::onFilterImage(Proxy* proxy,
lightBitmap<SpecularLightingType, SkSpotLight>(lightingType, transformedLight, src, dst, surfaceScale(), bounds);
break;
}
- offset->fX += bounds.left();
- offset->fY += bounds.top();
return true;
}
« no previous file with comments | « src/effects/SkDropShadowImageFilter.cpp ('k') | src/effects/SkMatrixConvolutionImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698