diff options
author | 2016-05-31 12:08:25 -0700 | |
---|---|---|
committer | 2016-05-31 12:08:25 -0700 | |
commit | 71e055279336096f92d63c5c855641b4b31d6a54 (patch) | |
tree | 4606c66902fcc7b7b392379eba01881e5d4e4e04 /samplecode | |
parent | 4b421344561cef5a8747361768a99024691cc542 (diff) |
Make use of new SkLights class
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2026763002
Review-Url: https://codereview.chromium.org/2026763002
Diffstat (limited to 'samplecode')
-rwxr-xr-x | samplecode/SampleLighting.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/samplecode/SampleLighting.cpp b/samplecode/SampleLighting.cpp index 5171579f64..a27aa9de41 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 @@ protected: 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); |