OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |