diff options
author | senorblanco <senorblanco@chromium.org> | 2015-08-26 14:26:40 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-26 14:26:40 -0700 |
commit | 7b7ecfc046f7ec810482266db3430d1358b7a5bf (patch) | |
tree | e286aa97d1a283811b6d533e92e771310bba3c28 /src/effects/SkLightingImageFilter.cpp | |
parent | d5c448fd857a77a375886bc1a8da83a7f1bf32fe (diff) |
Fix clipped lighting image filters.
The CPU path for lighting image filters was not adjusting the filter
matrix to accommodate srcOffset, resulting in incorrectly-positioned
lights. (The GPU path was doing this correctly.)
This change adds a new test case to the imagefiltersclipped GM,
so it will need new baselines.
BUG=skia:
Review URL: https://codereview.chromium.org/1310053004
Diffstat (limited to 'src/effects/SkLightingImageFilter.cpp')
-rw-r--r-- | src/effects/SkLightingImageFilter.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp index 2e25cbf502..58978b78ce 100644 --- a/src/effects/SkLightingImageFilter.cpp +++ b/src/effects/SkLightingImageFilter.cpp @@ -1207,7 +1207,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(); @@ -1351,8 +1353,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, |