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

Unified Diff: samplecode/SampleLighting.cpp

Issue 1829303002: move setshader to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: addressing comments from #8 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
« no previous file with comments | « samplecode/SampleFilterFuzz.cpp ('k') | src/animator/SkDrawPaint.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleLighting.cpp
diff --git a/samplecode/SampleLighting.cpp b/samplecode/SampleLighting.cpp
index fa88e3ecd6ef5ad830416763fb909e3b6e735d70..1da888f5bd32551cf88651563d87b4049e451e97 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(),
« no previous file with comments | « samplecode/SampleFilterFuzz.cpp ('k') | src/animator/SkDrawPaint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698