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

Unified Diff: samplecode/SampleShadowing.cpp

Issue 2237493002: Added PointLights to SkLights::Light (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: fixed serialization bug Created 4 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 | « samplecode/SampleLitAtlas.cpp ('k') | src/core/SkCanvas.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleShadowing.cpp
diff --git a/samplecode/SampleShadowing.cpp b/samplecode/SampleShadowing.cpp
index 7b434bca80a5fc5a5be323c4b54f84594e7bc2e4..d0b37fb15ab7921f259a93f2ed2c236f3fb124cf 100644
--- a/samplecode/SampleShadowing.cpp
+++ b/samplecode/SampleShadowing.cpp
@@ -19,11 +19,11 @@ public:
this->setBGColor(0xFFCCCCCC);
SkLights::Builder builder;
- builder.add(SkLights::Light(SkColor3f::Make(0.2f, 0.3f, 0.4f),
- SkVector3::Make(0.2f, 0.05f, 1.0f)));
- builder.add(SkLights::Light(SkColor3f::Make(0.4f, 0.3f, 0.2f),
- SkVector3::Make(0.05f, 0.2f, 1.0f)));
- builder.add(SkLights::Light(SkColor3f::Make(0.4f, 0.4f, 0.4f)));
+ builder.add(SkLights::Light::MakeDirectional(SkColor3f::Make(0.2f, 0.3f, 0.4f),
+ SkVector3::Make(0.2f, 0.05f, 1.0f)));
+ builder.add(SkLights::Light::MakeDirectional(SkColor3f::Make(0.4f, 0.3f, 0.2f),
+ SkVector3::Make(0.05f, 0.2f, 1.0f)));
+ builder.add(SkLights::Light::MakeAmbient(SkColor3f::Make(0.4f, 0.4f, 0.4f)));
fLights = builder.finish();
fTestRects[0].fColor = 0xFFEE8888;
@@ -139,15 +139,18 @@ protected:
float recipY = 1.0f / kHeight;
SkLights::Builder builder;
- builder.add(SkLights::Light(SkColor3f::Make(0.2f, 0.3f, 0.4f),
- SkVector3::Make(0.2f + (200.0f - x) * recipX,
- 0.05f + (200.0f - y) * recipY,
- 1.0f)));
- builder.add(SkLights::Light(SkColor3f::Make(0.4f, 0.3f, 0.2f),
- SkVector3::Make(0.05f + (200.0f - x) * recipX,
- 0.2f + (200.0f - y) * recipY,
- 1.0f)));
- builder.add(SkLights::Light(SkColor3f::Make(0.4f, 0.4f, 0.4f)));
+ builder.add(SkLights::Light::MakeDirectional(
+ SkColor3f::Make(0.2f, 0.3f, 0.4f),
+ SkVector3::Make(0.2f + (200.0f - x) * recipX,
+ 0.05f + (200.0f - y) * recipY,
+ 1.0f)));
+ builder.add(SkLights::Light::MakeDirectional(
+ SkColor3f::Make(0.4f, 0.3f, 0.2f),
+ SkVector3::Make(0.05f + (200.0f - x) * recipX,
+ 0.2f + (200.0f - y) * recipY,
+ 1.0f)));
+ builder.add(SkLights::Light::MakeAmbient(
+ SkColor3f::Make(0.4f, 0.4f, 0.4f)));
fLights = builder.finish();
fLightsChanged = true;
« no previous file with comments | « samplecode/SampleLitAtlas.cpp ('k') | src/core/SkCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698