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

Unified Diff: gm/lighting.cpp

Issue 1403403003: Update feSpotLight to match spec (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Remove unused constant Created 5 years, 2 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 | « no previous file | src/effects/SkLightingImageFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/lighting.cpp
diff --git a/gm/lighting.cpp b/gm/lighting.cpp
index af102d7d03950f712c0a285b9303f7f3dc381ded..0ce9599bc12c01b01b3d4815b6e21354b956eba4 100644
--- a/gm/lighting.cpp
+++ b/gm/lighting.cpp
@@ -10,7 +10,7 @@
#include "SkOffsetImageFilter.h"
#include "SkPoint3.h"
-#define WIDTH 330
+#define WIDTH 550
#define HEIGHT 660
namespace skiagm {
@@ -69,8 +69,10 @@ protected:
SkIntToScalar(-10),
SkIntToScalar(20));
SkPoint3 spotTarget = SkPoint3::Make(SkIntToScalar(40), SkIntToScalar(40), 0);
- SkScalar spotExponent = SK_Scalar1;
- SkScalar cutoffAngle = SkIntToScalar(15);
+ SkScalar spotExponent1 = SK_Scalar1;
+ SkScalar spotExponent0 = SkIntToScalar(0);
+ SkScalar cutoffAngleSmall = SkIntToScalar(15);
+ SkScalar cutoffAngleNone = SkIntToScalar(180);
SkScalar kd = SkIntToScalar(2);
SkScalar ks = SkIntToScalar(1);
SkScalar shininess = SkIntToScalar(8);
@@ -104,8 +106,8 @@ protected:
paint.setImageFilter(SkLightingImageFilter::CreateSpotLitDiffuse(spotLocation,
spotTarget,
- spotExponent,
- cutoffAngle,
+ spotExponent1,
+ cutoffAngleSmall,
white,
surfaceScale,
kd,
@@ -113,6 +115,28 @@ 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,
@@ -135,8 +159,8 @@ protected:
paint.setImageFilter(SkLightingImageFilter::CreateSpotLitSpecular(spotLocation,
spotTarget,
- spotExponent,
- cutoffAngle,
+ spotExponent1,
+ cutoffAngleSmall,
white,
surfaceScale,
ks,
@@ -145,6 +169,30 @@ 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;
}
}
« no previous file with comments | « no previous file | src/effects/SkLightingImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698