Make use of new SkLights class
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2026763002
Review-Url: https://codereview.chromium.org/2026763002
diff --git a/samplecode/SampleLighting.cpp b/samplecode/SampleLighting.cpp
index 5171579..a27aa9d 100755
--- a/samplecode/SampleLighting.cpp
+++ b/samplecode/SampleLighting.cpp
@@ -12,16 +12,16 @@
#include "SkLightingShader.h"
#include "SkPoint3.h"
-static const SkLightingShader::Lights* create_lights(SkScalar angle, SkScalar blue) {
+static sk_sp<SkLights> create_lights(SkScalar angle, SkScalar blue) {
const SkVector3 dir = SkVector3::Make(SkScalarSin(angle)*SkScalarSin(SK_ScalarPI*0.25f),
SkScalarCos(angle)*SkScalarSin(SK_ScalarPI*0.25f),
SkScalarCos(SK_ScalarPI*0.25f));
- SkLightingShader::Lights::Builder builder;
+ SkLights::Builder builder;
- builder.add(SkLight(SkColor3f::Make(1.0f, 1.0f, blue), dir));
- builder.add(SkLight(SkColor3f::Make(0.1f, 0.1f, 0.1f)));
+ builder.add(SkLights::Light(SkColor3f::Make(1.0f, 1.0f, blue), dir));
+ builder.add(SkLights::Light(SkColor3f::Make(0.1f, 0.1f, 0.1f)));
return builder.finish();
}
@@ -62,11 +62,10 @@
fColorFactor = 0.0f;
}
- SkAutoTUnref<const SkLightingShader::Lights> lights(create_lights(fLightAngle,
- fColorFactor));
+ sk_sp<SkLights> lights(create_lights(fLightAngle, fColorFactor));
SkPaint paint;
paint.setShader(SkLightingShader::Make(fDiffuseBitmap, fNormalBitmap,
- lights, SkVector::Make(1.0f, 0.0f),
+ std::move(lights), SkVector::Make(1.0f, 0.0f),
nullptr, nullptr));
paint.setColor(SK_ColorBLACK);