OLD | NEW |
---|---|
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 | 9 |
10 | 10 |
11 #ifndef SkEmptyShader_DEFINED | 11 #ifndef SkEmptyShader_DEFINED |
12 #define SkEmptyShader_DEFINED | 12 #define SkEmptyShader_DEFINED |
13 | 13 |
14 #include "SkShader.h" | 14 #include "SkShader.h" |
15 | 15 |
16 /** | 16 /** |
17 * \class SkEmptyShader | 17 * \class SkEmptyShader |
18 * A Shader that always draws nothing. Its setContext always returns false, | 18 * A Shader that always draws nothing. Its createContext always returns NULL. |
19 * so it never expects that its shadeSpan() methods will get called. | |
20 */ | 19 */ |
21 class SK_API SkEmptyShader : public SkShader { | 20 class SK_API SkEmptyShader : public SkShader { |
22 public: | 21 public: |
23 SkEmptyShader() {} | 22 SkEmptyShader() {} |
24 | 23 |
25 virtual uint32_t getFlags() SK_OVERRIDE; | 24 virtual size_t contextSize() const SK_OVERRIDE { return sizeof(SkShader::Con text); } |
scroggo
2014/03/24 21:24:46
It seems misleading to me that this returns a non-
Dominik Grewe
2014/03/26 17:22:22
I agree it's misleading but the problem is that we
scroggo
2014/03/26 23:13:09
Ah, that makes sense.
I'll see if I can find it,
Dominik Grewe
2014/03/27 14:27:20
Only for SkGradientShader which isn't implement ye
| |
26 virtual uint8_t getSpan16Alpha() const SK_OVERRIDE; | 25 |
27 virtual bool setContext(const SkBitmap&, const SkPaint&, | 26 virtual SkShader::Context* createContext(const SkBitmap&, const SkPaint&, |
28 const SkMatrix&) SK_OVERRIDE; | 27 const SkMatrix&, void*) const SK_OV ERRIDE { |
29 virtual void shadeSpan(int x, int y, SkPMColor span[], int count) SK_OVERRID E; | 28 // validContext returns false. |
30 virtual void shadeSpan16(int x, int y, uint16_t span[], int count) SK_OVERRI DE; | 29 return NULL; |
31 virtual void shadeSpanAlpha(int x, int y, uint8_t alpha[], int count) SK_OVE RRIDE; | 30 } |
32 | 31 |
33 SK_DEVELOPER_TO_STRING() | 32 SK_DEVELOPER_TO_STRING() |
34 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkEmptyShader) | 33 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkEmptyShader) |
35 | 34 |
36 protected: | 35 protected: |
37 SkEmptyShader(SkReadBuffer& buffer) : INHERITED(buffer) {} | 36 SkEmptyShader(SkReadBuffer& buffer) : INHERITED(buffer) {} |
38 | 37 |
38 virtual bool validContext(const SkBitmap&, const SkPaint&, | |
39 const SkMatrix&) SK_OVERRIDE { return false; } | |
39 private: | 40 private: |
40 typedef SkShader INHERITED; | 41 typedef SkShader INHERITED; |
41 }; | 42 }; |
42 | 43 |
43 #endif | 44 #endif |
OLD | NEW |