diff options
author | reed <reed@google.com> | 2016-03-25 09:08:00 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-25 09:08:00 -0700 |
commit | fe63045f075165b1be5d3e7fc5c710021d85f53b (patch) | |
tree | c60f764504ba1d622613a432c88e43f7f65c0fec /samplecode/SampleLighting.cpp | |
parent | cce49271124ff75c880dc0dfed1489f02c82890b (diff) |
move setshader to sk_sp, re-using SK_SUPPORT_LEGACY_CREATESHADER_PTR
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1829303002
Review URL: https://codereview.chromium.org/1829303002
Diffstat (limited to 'samplecode/SampleLighting.cpp')
-rwxr-xr-x | samplecode/SampleLighting.cpp | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/samplecode/SampleLighting.cpp b/samplecode/SampleLighting.cpp index fa88e3ecd6..1da888f5bd 100755 --- a/samplecode/SampleLighting.cpp +++ b/samplecode/SampleLighting.cpp @@ -31,11 +31,10 @@ static const SkLightingShader::Lights* create_lights(SkScalar angle, SkScalar bl class LightingView : public SampleView { public: - SkAutoTUnref<SkShader> fShader; - SkBitmap fDiffuseBitmap; - SkBitmap fNormalBitmap; - SkScalar fLightAngle; - SkScalar fColorFactor; + SkBitmap fDiffuseBitmap; + SkBitmap fNormalBitmap; + SkScalar fLightAngle; + SkScalar fColorFactor; LightingView() { SkString diffusePath = GetResourcePath("brickwork-texture.jpg"); @@ -45,16 +44,8 @@ public: fLightAngle = 0.0f; fColorFactor = 0.0f; - - SkAutoTUnref<const SkLightingShader::Lights> lights(create_lights(fLightAngle, 1.0f)); - - fShader.reset(SkLightingShader::Create(fDiffuseBitmap, fNormalBitmap, - lights, SkVector::Make(1.0f, 0.0f), - nullptr, nullptr)); } - virtual ~LightingView() {} - protected: // overrides from SkEventSink bool onQuery(SkEvent* evt) override { @@ -74,13 +65,10 @@ protected: SkAutoTUnref<const SkLightingShader::Lights> lights(create_lights(fLightAngle, fColorFactor)); - - fShader.reset(SkLightingShader::Create(fDiffuseBitmap, fNormalBitmap, + SkPaint paint; + paint.setShader(SkLightingShader::Make(fDiffuseBitmap, fNormalBitmap, lights, SkVector::Make(1.0f, 0.0f), nullptr, nullptr)); - - SkPaint paint; - paint.setShader(fShader); paint.setColor(SK_ColorBLACK); SkRect r = SkRect::MakeWH((SkScalar)fDiffuseBitmap.width(), |