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 |
28 SK_TO_STRING_OVERRIDE() | 30 SK_TO_STRING_OVERRIDE() |
29 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPictureShader) | 31 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPictureShader) |
30 | 32 |
31 #if SK_SUPPORT_GPU | 33 #if SK_SUPPORT_GPU |
32 const GrFragmentProcessor* asFragmentProcessor(GrContext*, | 34 const GrFragmentProcessor* asFragmentProcessor(GrContext*, |
33 const SkMatrix& viewM, | 35 const SkMatrix& viewM, |
34 const SkMatrix*, | 36 const SkMatrix*, |
35 SkFilterQuality) const overri
de; | 37 SkFilterQuality) const overri
de; |
36 #endif | 38 #endif |
37 | 39 |
38 protected: | 40 protected: |
39 SkPictureShader(SkReadBuffer&); | 41 SkPictureShader(SkReadBuffer&); |
40 void flatten(SkWriteBuffer&) const override; | 42 void flatten(SkWriteBuffer&) const override; |
41 size_t onContextSize(const ContextRec&) const override; | |
42 Context* onCreateContext(const ContextRec&, void* storage) const override; | 43 Context* onCreateContext(const ContextRec&, void* storage) const override; |
43 | 44 |
44 private: | 45 private: |
45 SkPictureShader(const SkPicture*, TileMode, TileMode, const SkMatrix*, const
SkRect*); | 46 SkPictureShader(const SkPicture*, TileMode, TileMode, const SkMatrix*, const
SkRect*); |
46 | 47 |
47 SkShader* refBitmapShader(const SkMatrix&, const SkMatrix* localMatrix, cons
t int maxTextureSize = 0) const; | 48 SkShader* refBitmapShader(const SkMatrix&, const SkMatrix* localMatrix, cons
t int maxTextureSize = 0) const; |
48 | 49 |
49 SkAutoTUnref<const SkPicture> fPicture; | 50 SkAutoTUnref<const SkPicture> fPicture; |
50 SkRect fTile; | 51 SkRect fTile; |
51 TileMode fTmx, fTmy; | 52 TileMode fTmx, fTmy; |
(...skipping 17 matching lines...) Expand all Loading... |
69 SkShader::Context* fBitmapShaderContext; | 70 SkShader::Context* fBitmapShaderContext; |
70 void* fBitmapShaderContextStorage; | 71 void* fBitmapShaderContextStorage; |
71 | 72 |
72 typedef SkShader::Context INHERITED; | 73 typedef SkShader::Context INHERITED; |
73 }; | 74 }; |
74 | 75 |
75 typedef SkShader INHERITED; | 76 typedef SkShader INHERITED; |
76 }; | 77 }; |
77 | 78 |
78 #endif // SkPictureShader_DEFINED | 79 #endif // SkPictureShader_DEFINED |
OLD | NEW |