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 #ifndef SkPictureShader_DEFINED | 8 #ifndef SkPictureShader_DEFINED |
9 #define SkPictureShader_DEFINED | 9 #define SkPictureShader_DEFINED |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 protected: | 36 protected: |
37 SkPictureShader(SkReadBuffer&); | 37 SkPictureShader(SkReadBuffer&); |
38 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 38 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
39 virtual Context* onCreateContext(const ContextRec&, void* storage) const SK_
OVERRIDE; | 39 virtual Context* onCreateContext(const ContextRec&, void* storage) const SK_
OVERRIDE; |
40 | 40 |
41 private: | 41 private: |
42 SkPictureShader(const SkPicture*, TileMode, TileMode, const SkMatrix*, const
SkRect*); | 42 SkPictureShader(const SkPicture*, TileMode, TileMode, const SkMatrix*, const
SkRect*); |
43 | 43 |
44 SkShader* refBitmapShader(const SkMatrix&, const SkMatrix* localMatrix) cons
t; | 44 SkShader* refBitmapShader(const SkMatrix&, const SkMatrix* localMatrix) cons
t; |
45 | 45 |
46 const SkPicture* fPicture; | 46 const SkPicture* fPicture; |
47 SkRect fTile; | 47 SkRect fTile; |
48 TileMode fTmx, fTmy; | 48 TileMode fTmx, fTmy; |
49 | |
50 mutable SkMutex fCachedBitmapShaderMutex; | |
51 mutable SkAutoTUnref<SkShader> fCachedBitmapShader; | |
52 mutable SkSize fCachedTileScale; | |
53 | 49 |
54 class PictureShaderContext : public SkShader::Context { | 50 class PictureShaderContext : public SkShader::Context { |
55 public: | 51 public: |
56 static Context* Create(void* storage, const SkPictureShader&, const Cont
extRec&, | 52 static Context* Create(void* storage, const SkPictureShader&, const Cont
extRec&, |
57 SkShader* bitmapShader); | 53 SkShader* bitmapShader); |
58 | 54 |
59 virtual ~PictureShaderContext(); | 55 virtual ~PictureShaderContext(); |
60 | 56 |
61 virtual uint32_t getFlags() const SK_OVERRIDE; | 57 virtual uint32_t getFlags() const SK_OVERRIDE; |
62 | 58 |
63 virtual ShadeProc asAShadeProc(void** ctx) SK_OVERRIDE; | 59 virtual ShadeProc asAShadeProc(void** ctx) SK_OVERRIDE; |
64 virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count) SK_OVE
RRIDE; | 60 virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count) SK_OVE
RRIDE; |
65 virtual void shadeSpan16(int x, int y, uint16_t dstC[], int count) SK_OV
ERRIDE; | 61 virtual void shadeSpan16(int x, int y, uint16_t dstC[], int count) SK_OV
ERRIDE; |
66 | 62 |
67 private: | 63 private: |
68 PictureShaderContext(const SkPictureShader&, const ContextRec&, SkShader
* bitmapShader); | 64 PictureShaderContext(const SkPictureShader&, const ContextRec&, SkShader
* bitmapShader); |
69 | 65 |
70 SkAutoTUnref<SkShader> fBitmapShader; | 66 SkAutoTUnref<SkShader> fBitmapShader; |
71 SkShader::Context* fBitmapShaderContext; | 67 SkShader::Context* fBitmapShaderContext; |
72 void* fBitmapShaderContextStorage; | 68 void* fBitmapShaderContextStorage; |
73 | 69 |
74 typedef SkShader::Context INHERITED; | 70 typedef SkShader::Context INHERITED; |
75 }; | 71 }; |
76 | 72 |
77 typedef SkShader INHERITED; | 73 typedef SkShader INHERITED; |
78 }; | 74 }; |
79 | 75 |
80 #endif // SkPictureShader_DEFINED | 76 #endif // SkPictureShader_DEFINED |
OLD | NEW |