From 0bccd8749bdce79b2d71518fe65783b1a9b06445 Mon Sep 17 00:00:00 2001 From: caryclark Date: Tue, 20 Oct 2015 10:04:03 -0700 Subject: Revert of Update feSpotLight to match spec (patchset #2 id:20001 of https://codereview.chromium.org/1403403003/ ) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reason for revert: re-land once layout test have been disabled (so they can be rebased) Original issue's description: > Update feSpotLight to match spec > > This change updates feSpotLight to match the spec via two changes: > > 1) specularExponent is ignored if the spotlight has no coneAngle (GPU > bug only). This change updates the GPU path so that it matches the > CPU path and the spec in this regard. > > 2) specularExponent is clamped to the 1-128 range. The spec does not > specify a clamp for the specularExponent attribute of feSpotLight. > Note that the spec *does* specify this clamp for the > specularExponent attribute of feSpecularLighting. It looks like we > incorrectly applied this to both specularExponent attributes. > > This change (along with a parallel change in Blink) allows us to pass > the SVG filter effects conformance test here: > http://www.w3.org/Graphics/SVG/Test/20110816/harness/htmlObject/filters-light-01-f.html > > Additionally, this brings our behavior in line with Safari and Edge’s > behavior on this filter. > > Two new cases were added to gm/lighting.cpp to catch these issues: > - The existing spotlight case exercised the path where our specular > exponent was between 1-128 and had a limiting cone angle. > - The first new spotlight case exercises the path where our specular > exponent is between 1-128 and we do not have a limiting cone angle. > - The second new spotlight case exercises the path where the specular > exponent is not within the 1-128 range, to ensure that we don’t > incorrectly clip to this range. > > BUG=472849 > > Committed: https://skia.googlesource.com/skia/+/c84ccb070258db2803a9e8f532bfe7239a737063 TBR=senorblanco@google.com,senorblanco@chromium.org,bsalomon@google.com,ericrk@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=472849 Review URL: https://codereview.chromium.org/1417463006 --- gm/lighting.cpp | 62 +++++++-------------------------------------------------- 1 file changed, 7 insertions(+), 55 deletions(-) (limited to 'gm/lighting.cpp') diff --git a/gm/lighting.cpp b/gm/lighting.cpp index 0ce9599bc1..af102d7d03 100644 --- a/gm/lighting.cpp +++ b/gm/lighting.cpp @@ -10,7 +10,7 @@ #include "SkOffsetImageFilter.h" #include "SkPoint3.h" -#define WIDTH 550 +#define WIDTH 330 #define HEIGHT 660 namespace skiagm { @@ -69,10 +69,8 @@ protected: SkIntToScalar(-10), SkIntToScalar(20)); SkPoint3 spotTarget = SkPoint3::Make(SkIntToScalar(40), SkIntToScalar(40), 0); - SkScalar spotExponent1 = SK_Scalar1; - SkScalar spotExponent0 = SkIntToScalar(0); - SkScalar cutoffAngleSmall = SkIntToScalar(15); - SkScalar cutoffAngleNone = SkIntToScalar(180); + SkScalar spotExponent = SK_Scalar1; + SkScalar cutoffAngle = SkIntToScalar(15); SkScalar kd = SkIntToScalar(2); SkScalar ks = SkIntToScalar(1); SkScalar shininess = SkIntToScalar(8); @@ -106,8 +104,8 @@ protected: paint.setImageFilter(SkLightingImageFilter::CreateSpotLitDiffuse(spotLocation, spotTarget, - spotExponent1, - cutoffAngleSmall, + spotExponent, + cutoffAngle, white, surfaceScale, kd, @@ -115,28 +113,6 @@ protected: cr))->unref(); drawClippedBitmap(canvas, paint, 220, y); - paint.setImageFilter(SkLightingImageFilter::CreateSpotLitDiffuse(spotLocation, - spotTarget, - spotExponent1, - cutoffAngleNone, - white, - surfaceScale, - kd, - input, - cr))->unref(); - drawClippedBitmap(canvas, paint, 330, y); - - paint.setImageFilter(SkLightingImageFilter::CreateSpotLitDiffuse(spotLocation, - spotTarget, - spotExponent0, - cutoffAngleNone, - white, - surfaceScale, - kd, - input, - cr))->unref(); - drawClippedBitmap(canvas, paint, 440, y); - y += 110; paint.setImageFilter(SkLightingImageFilter::CreatePointLitSpecular(pointLocation, @@ -159,8 +135,8 @@ protected: paint.setImageFilter(SkLightingImageFilter::CreateSpotLitSpecular(spotLocation, spotTarget, - spotExponent1, - cutoffAngleSmall, + spotExponent, + cutoffAngle, white, surfaceScale, ks, @@ -169,30 +145,6 @@ protected: cr))->unref(); drawClippedBitmap(canvas, paint, 220, y); - paint.setImageFilter(SkLightingImageFilter::CreateSpotLitSpecular(spotLocation, - spotTarget, - spotExponent1, - cutoffAngleNone, - white, - surfaceScale, - ks, - shininess, - input, - cr))->unref(); - drawClippedBitmap(canvas, paint, 330, y); - - paint.setImageFilter(SkLightingImageFilter::CreateSpotLitSpecular(spotLocation, - spotTarget, - spotExponent0, - cutoffAngleNone, - white, - surfaceScale, - ks, - shininess, - input, - cr))->unref(); - drawClippedBitmap(canvas, paint, 440, y); - y += 110; } } -- cgit v1.2.3