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

Side by Side Diff: gm/dcshader.cpp

Issue 1855733002: change flattenable factory to return sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp ('k') | gm/imagefiltersbase.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "gm.h" 8 #include "gm.h"
9 #if SK_SUPPORT_GPU 9 #if SK_SUPPORT_GPU
10 #include "GrFragmentProcessor.h" 10 #include "GrFragmentProcessor.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #ifndef SK_IGNORE_TO_STRING 43 #ifndef SK_IGNORE_TO_STRING
44 void toString(SkString* str) const override { 44 void toString(SkString* str) const override {
45 str->appendf("DCShader: ()"); 45 str->appendf("DCShader: ()");
46 } 46 }
47 #endif 47 #endif
48 48
49 private: 49 private:
50 const SkMatrix fDeviceMatrix; 50 const SkMatrix fDeviceMatrix;
51 }; 51 };
52 52
53 SkFlattenable* DCShader::CreateProc(SkReadBuffer& buf) { 53 sk_sp<SkFlattenable> DCShader::CreateProc(SkReadBuffer& buf) {
54 SkMatrix matrix; 54 SkMatrix matrix;
55 buf.readMatrix(&matrix); 55 buf.readMatrix(&matrix);
56 return new DCShader(matrix); 56 return sk_make_sp<DCShader>(matrix);
57 } 57 }
58 58
59 class DCFP : public GrFragmentProcessor { 59 class DCFP : public GrFragmentProcessor {
60 public: 60 public:
61 DCFP(const SkMatrix& m) : fDeviceTransform(kDevice_GrCoordSet, m) { 61 DCFP(const SkMatrix& m) : fDeviceTransform(kDevice_GrCoordSet, m) {
62 this->addCoordTransform(&fDeviceTransform); 62 this->addCoordTransform(&fDeviceTransform);
63 this->initClassID<DCFP>(); 63 this->initClassID<DCFP>();
64 } 64 }
65 65
66 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override { 66 GrGLSLFragmentProcessor* onCreateGLSLInstance() const override {
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 }; 290 };
291 291
292 SkTArray<Prim*> fPrims; 292 SkTArray<Prim*> fPrims;
293 293
294 typedef GM INHERITED; 294 typedef GM INHERITED;
295 }; 295 };
296 296
297 DEF_GM(return new DCShaderGM;) 297 DEF_GM(return new DCShaderGM;)
298 } 298 }
299 #endif 299 #endif
OLDNEW
« no previous file with comments | « experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp ('k') | gm/imagefiltersbase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698