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

Unified Diff: src/effects/SkLightingImageFilter.cpp

Issue 1310053004: Fix clipped lighting image filters. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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 | « gm/imagefiltersclipped.cpp ('k') | no next file » | 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 c63b2ebe50b81a7eb67f606713e57c3621b2e015..59479212311af483f7424252641f9089a6028b01 100644
--- a/src/effects/SkLightingImageFilter.cpp
+++ b/src/effects/SkLightingImageFilter.cpp
@@ -1217,7 +1217,9 @@ bool SkDiffuseLightingImageFilter::onFilterImage(Proxy* proxy,
return false;
}
- SkAutoTUnref<SkImageFilterLight> transformedLight(light()->transform(ctx.ctm()));
+ SkMatrix matrix(ctx.ctm());
+ matrix.postTranslate(SkIntToScalar(-srcOffset.x()), SkIntToScalar(-srcOffset.y()));
+ SkAutoTUnref<SkImageFilterLight> transformedLight(light()->transform(matrix));
DiffuseLightingType lightingType(fKD);
offset->fX = bounds.left();
@@ -1362,8 +1364,10 @@ bool SkSpecularLightingImageFilter::onFilterImage(Proxy* proxy,
SpecularLightingType lightingType(fKS, fShininess);
offset->fX = bounds.left();
offset->fY = bounds.top();
+ SkMatrix matrix(ctx.ctm());
+ matrix.postTranslate(SkIntToScalar(-srcOffset.x()), SkIntToScalar(-srcOffset.y()));
+ SkAutoTUnref<SkImageFilterLight> transformedLight(light()->transform(matrix));
bounds.offset(-srcOffset);
- SkAutoTUnref<SkImageFilterLight> transformedLight(light()->transform(ctx.ctm()));
switch (transformedLight->type()) {
case SkImageFilterLight::kDistant_LightType:
lightBitmap<SpecularLightingType, SkDistantLight>(lightingType,
« no previous file with comments | « gm/imagefiltersclipped.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698