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

Unified Diff: src/core/SkLights.cpp

Issue 2301173004: added radial lights to SkLights (Closed)
Patch Set: made req comment fix Created 4 years, 3 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 | « include/core/SkLights.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkLights.cpp
diff --git a/src/core/SkLights.cpp b/src/core/SkLights.cpp
index 962997fc31436c4a3b4428a194210b227d9cef24..56c9299437a2b9479be85633e016cd7085e67363 100644
--- a/src/core/SkLights.cpp
+++ b/src/core/SkLights.cpp
@@ -42,14 +42,15 @@ sk_sp<SkLights> SkLights::MakeFromBuffer(SkReadBuffer& buf) {
}
}
+ bool isRadial = buf.readBool();
if (isPoint) {
- SkScalar intensity = 0.0f;
+ SkScalar intensity;
intensity = buf.readScalar();
- Light light = Light::MakePoint(color, dirOrPos, intensity);
+ Light light = Light::MakePoint(color, dirOrPos, intensity, isRadial);
light.setShadowMap(depthMap);
builder.add(light);
} else {
- Light light = Light::MakeDirectional(color, dirOrPos);
+ Light light = Light::MakeDirectional(color, dirOrPos, isRadial);
light.setShadowMap(depthMap);
builder.add(light);
}
@@ -70,8 +71,13 @@ void SkLights::flatten(SkWriteBuffer& buf) const {
buf.writeBool(isPoint);
buf.writeScalarArray(&light.color().fX, 3);
buf.writeScalarArray(&light.dir().fX, 3);
+
bool hasShadowMap = light.getShadowMap() != nullptr;
buf.writeBool(hasShadowMap);
+
+ bool isRadial = light.isRadial();
+ buf.writeBool(isRadial);
+
if (hasShadowMap) {
buf.writeImage(light.getShadowMap());
}
« no previous file with comments | « include/core/SkLights.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698