OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #ifndef SkPictureShader_DEFINED | 9 #ifndef SkPictureShader_DEFINED |
10 #define SkPictureShader_DEFINED | 10 #define SkPictureShader_DEFINED |
11 | 11 |
12 #include "SkShader.h" | 12 #include "SkShader.h" |
13 | 13 |
14 class SkBitmap; | 14 class SkBitmap; |
15 class SkPicture; | 15 class SkPicture; |
16 | 16 |
17 /* | 17 /* |
18 * An SkPictureShader can be used to draw SkPicture-based patterns. | 18 * An SkPictureShader can be used to draw SkPicture-based patterns. |
19 * | 19 * |
20 * The SkPicture is first rendered into a tile, which is then used to shade the
area according | 20 * The SkPicture is first rendered into a tile, which is then used to shade the
area according |
21 * to specified tiling rules. | 21 * to specified tiling rules. |
22 */ | 22 */ |
23 class SkPictureShader : public SkShader { | 23 class SkPictureShader : public SkShader { |
24 public: | 24 public: |
25 static SkShader* Create(const SkPicture*, TileMode, TileMode, const SkMatrix
*, | 25 static SkShader* Create(const SkPicture*, TileMode, TileMode, const SkMatrix
*, |
26 const SkRect*); | 26 const SkRect*); |
27 | 27 |
28 size_t contextSize(const ContextRec&) const override; | |
29 | |
30 SK_TO_STRING_OVERRIDE() | 28 SK_TO_STRING_OVERRIDE() |
31 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPictureShader) | 29 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPictureShader) |
32 | 30 |
33 #if SK_SUPPORT_GPU | 31 #if SK_SUPPORT_GPU |
34 const GrFragmentProcessor* asFragmentProcessor(GrContext*, | 32 const GrFragmentProcessor* asFragmentProcessor(GrContext*, |
35 const SkMatrix& viewM, | 33 const SkMatrix& viewM, |
36 const SkMatrix*, | 34 const SkMatrix*, |
37 SkFilterQuality) const overri
de; | 35 SkFilterQuality) const overri
de; |
38 #endif | 36 #endif |
39 | 37 |
40 protected: | 38 protected: |
41 SkPictureShader(SkReadBuffer&); | 39 SkPictureShader(SkReadBuffer&); |
42 void flatten(SkWriteBuffer&) const override; | 40 void flatten(SkWriteBuffer&) const override; |
| 41 size_t onContextSize(const ContextRec&) const override; |
43 Context* onCreateContext(const ContextRec&, void* storage) const override; | 42 Context* onCreateContext(const ContextRec&, void* storage) const override; |
44 | 43 |
45 private: | 44 private: |
46 SkPictureShader(const SkPicture*, TileMode, TileMode, const SkMatrix*, const
SkRect*); | 45 SkPictureShader(const SkPicture*, TileMode, TileMode, const SkMatrix*, const
SkRect*); |
47 | 46 |
48 SkShader* refBitmapShader(const SkMatrix&, const SkMatrix* localMatrix, cons
t int maxTextureSize = 0) const; | 47 SkShader* refBitmapShader(const SkMatrix&, const SkMatrix* localMatrix, cons
t int maxTextureSize = 0) const; |
49 | 48 |
50 SkAutoTUnref<const SkPicture> fPicture; | 49 SkAutoTUnref<const SkPicture> fPicture; |
51 SkRect fTile; | 50 SkRect fTile; |
52 TileMode fTmx, fTmy; | 51 TileMode fTmx, fTmy; |
(...skipping 17 matching lines...) Expand all Loading... |
70 SkShader::Context* fBitmapShaderContext; | 69 SkShader::Context* fBitmapShaderContext; |
71 void* fBitmapShaderContextStorage; | 70 void* fBitmapShaderContextStorage; |
72 | 71 |
73 typedef SkShader::Context INHERITED; | 72 typedef SkShader::Context INHERITED; |
74 }; | 73 }; |
75 | 74 |
76 typedef SkShader INHERITED; | 75 typedef SkShader INHERITED; |
77 }; | 76 }; |
78 | 77 |
79 #endif // SkPictureShader_DEFINED | 78 #endif // SkPictureShader_DEFINED |
OLD | NEW |