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

Unified Diff: samplecode/SampleLighting.cpp

Issue 1829303002: move setshader to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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
Index: samplecode/SampleLighting.cpp
diff --git a/samplecode/SampleLighting.cpp b/samplecode/SampleLighting.cpp
index fa88e3ecd6ef5ad830416763fb909e3b6e735d70..8bde23e6c585b05136a45fb3eb452f7b5f0b5940 100755
--- a/samplecode/SampleLighting.cpp
+++ b/samplecode/SampleLighting.cpp
@@ -31,11 +31,11 @@ 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;
+ sk_sp<SkShader> fShader;
+ SkBitmap fDiffuseBitmap;
+ SkBitmap fNormalBitmap;
+ SkScalar fLightAngle;
+ SkScalar fColorFactor;
LightingView() {
SkString diffusePath = GetResourcePath("brickwork-texture.jpg");
@@ -48,13 +48,11 @@ public:
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));
+ fShader = SkLightingShader::Make(fDiffuseBitmap, fNormalBitmap,
+ lights, SkVector::Make(1.0f, 0.0f),
+ nullptr, nullptr);
}
- virtual ~LightingView() {}
-
protected:
// overrides from SkEventSink
bool onQuery(SkEvent* evt) override {
@@ -75,9 +73,9 @@ protected:
SkAutoTUnref<const SkLightingShader::Lights> lights(create_lights(fLightAngle,
fColorFactor));
- fShader.reset(SkLightingShader::Create(fDiffuseBitmap, fNormalBitmap,
- lights, SkVector::Make(1.0f, 0.0f),
- nullptr, nullptr));
+ fShader = SkLightingShader::Make(fDiffuseBitmap, fNormalBitmap,
+ lights, SkVector::Make(1.0f, 0.0f),
+ nullptr, nullptr);
tomhudson 2016/03/25 14:28:07 We have to regenerate this every time the lights c
reed1 2016/03/25 15:04:31 The lights are animating, so we have to regenerate
SkPaint paint;
paint.setShader(fShader);

Powered by Google App Engine
This is Rietveld 408576698