OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 #ifndef SkImageShader_DEFINED | 8 #ifndef SkImageShader_DEFINED |
9 #define SkImageShader_DEFINED | 9 #define SkImageShader_DEFINED |
10 | 10 |
11 #include "SkImage.h" | 11 #include "SkImage.h" |
12 #include "SkShader.h" | 12 #include "SkShader.h" |
13 | 13 |
14 class SkImageShader : public SkShader { | 14 class SkImageShader : public SkShader { |
15 public: | 15 public: |
16 static SkShader* Create(const SkImage*, TileMode tx, TileMode ty, const SkMa
trix* localMatrix); | 16 static sk_sp<SkShader> Make(const SkImage*, TileMode tx, TileMode ty, |
| 17 const SkMatrix* localMatrix); |
17 | 18 |
18 bool isOpaque() const override; | 19 bool isOpaque() const override; |
19 | 20 |
20 SK_TO_STRING_OVERRIDE() | 21 SK_TO_STRING_OVERRIDE() |
21 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkImageShader) | 22 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkImageShader) |
22 | 23 |
23 #if SK_SUPPORT_GPU | 24 #if SK_SUPPORT_GPU |
24 const GrFragmentProcessor* asFragmentProcessor(GrContext*, const SkMatrix& v
iewM, | 25 const GrFragmentProcessor* asFragmentProcessor(GrContext*, const SkMatrix& v
iewM, |
25 const SkMatrix*, SkFilterQual
ity) const override; | 26 const SkMatrix*, SkFilterQual
ity) const override; |
26 #endif | 27 #endif |
27 | 28 |
28 protected: | 29 protected: |
29 void flatten(SkWriteBuffer&) const override; | 30 void flatten(SkWriteBuffer&) const override; |
30 size_t onContextSize(const ContextRec&) const override; | 31 size_t onContextSize(const ContextRec&) const override; |
31 Context* onCreateContext(const ContextRec&, void* storage) const override; | 32 Context* onCreateContext(const ContextRec&, void* storage) const override; |
32 | 33 |
33 SkAutoTUnref<const SkImage> fImage; | 34 SkAutoTUnref<const SkImage> fImage; |
34 const TileMode fTileModeX; | 35 const TileMode fTileModeX; |
35 const TileMode fTileModeY; | 36 const TileMode fTileModeY; |
36 | 37 |
37 private: | 38 private: |
38 SkImageShader(const SkImage*, TileMode tx, TileMode ty, const SkMatrix* loca
lMatrix); | 39 SkImageShader(const SkImage*, TileMode tx, TileMode ty, const SkMatrix* loca
lMatrix); |
39 | 40 |
40 typedef SkShader INHERITED; | 41 typedef SkShader INHERITED; |
41 }; | 42 }; |
42 | 43 |
43 #endif | 44 #endif |
OLD | NEW |