Chromium Code Reviews| Index: src/core/SkLightingShader.cpp |
| diff --git a/src/core/SkLightingShader.cpp b/src/core/SkLightingShader.cpp |
| index e8280b1267439e5405e835adb0e279742d00c12a..f42bb756d4c7f5d0c3594ed25351db13a868ec05 100644 |
| --- a/src/core/SkLightingShader.cpp |
| +++ b/src/core/SkLightingShader.cpp |
| @@ -422,6 +422,7 @@ sk_sp<SkFlattenable> SkLightingShaderImpl::CreateProc(SkReadBuffer& buf) { |
| for (int l = 0; l < numLights; ++l) { |
| bool isAmbient = buf.readBool(); |
| + bool isPoint = buf.readBool(); |
| SkColor3f color; |
| if (!buf.readScalarArray(&color.fX, 3)) { |
| @@ -429,13 +430,17 @@ sk_sp<SkFlattenable> SkLightingShaderImpl::CreateProc(SkReadBuffer& buf) { |
| } |
| if (isAmbient) { |
| - builder.add(SkLights::Light(color)); |
| + builder.add(SkLights::Light::MakeAmbient(color)); |
| } else { |
|
robertphillips
2016/08/10 17:48:39
dir -> dirOrPos
vjiaoblack
2016/08/11 14:27:23
Done.
|
| SkVector3 dir; |
| if (!buf.readScalarArray(&dir.fX, 3)) { |
| return nullptr; |
| } |
| - builder.add(SkLights::Light(color, dir)); |
| + if (isPoint) { |
| + builder.add(SkLights::Light::MakePoint(color, dir)); |
| + } else { |
| + builder.add(SkLights::Light::MakeDirectional(color, dir)); |
| + } |
| } |
| } |
| @@ -461,8 +466,10 @@ void SkLightingShaderImpl::flatten(SkWriteBuffer& buf) const { |
| const SkLights::Light& light = fLights->light(l); |
| bool isAmbient = SkLights::Light::kAmbient_LightType == light.type(); |
| + bool isPoint = SkLights::Light::kPoint_LightType == light.type(); |
| buf.writeBool(isAmbient); |
| + buf.writeBool(isPoint); |
| buf.writeScalarArray(&light.color().fX, 3); |
| if (!isAmbient) { |
| buf.writeScalarArray(&light.dir().fX, 3); |