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

Unified Diff: samplecode/SampleCamera.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 | « include/effects/SkPerlinNoiseShader.h ('k') | samplecode/SampleEmboss.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleCamera.cpp
diff --git a/samplecode/SampleCamera.cpp b/samplecode/SampleCamera.cpp
index ed6cc528293536f534555053dd45c8da3d87b907..85b854eced17c69c2673b2349a40a227193c756f 100644
--- a/samplecode/SampleCamera.cpp
+++ b/samplecode/SampleCamera.cpp
@@ -20,7 +20,7 @@
#include "SkRandom.h"
class CameraView : public SampleView {
- SkTDArray<SkShader*> fShaders;
+ SkTArray<sk_sp<SkShader>> fShaders;
int fShaderIndex;
bool fFrontFace;
public:
@@ -39,11 +39,10 @@ public:
SkMatrix matrix;
matrix.setRectToRect(src, dst, SkMatrix::kFill_ScaleToFit);
- SkShader* s = SkShader::MakeBitmapShader(bm,
+ fShaders.push_back(SkShader::MakeBitmapShader(bm,
SkShader::kClamp_TileMode,
SkShader::kClamp_TileMode,
- &matrix).release();
- *fShaders.append() = s;
+ &matrix));
} else {
break;
}
@@ -51,10 +50,6 @@ public:
this->setBGColor(0xFFDDDDDD);
}
- virtual ~CameraView() {
- fShaders.unrefAll();
- }
-
protected:
// overrides from SkEventSink
bool onQuery(SkEvent* evt) override {
« no previous file with comments | « include/effects/SkPerlinNoiseShader.h ('k') | samplecode/SampleEmboss.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698