OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 SkEmptyShader_DEFINED | 8 #ifndef SkEmptyShader_DEFINED |
9 #define SkEmptyShader_DEFINED | 9 #define SkEmptyShader_DEFINED |
10 | 10 |
11 #include "SkShader.h" | 11 #include "SkShader.h" |
12 | 12 |
13 // TODO: move this to private, as there is a public factory on SkShader | 13 // TODO: move this to private, as there is a public factory on SkShader |
14 | 14 |
15 /** | 15 /** |
16 * \class SkEmptyShader | 16 * \class SkEmptyShader |
17 * A Shader that always draws nothing. Its createContext always returns NULL. | 17 * A Shader that always draws nothing. Its createContext always returns NULL. |
18 */ | 18 */ |
19 class SK_API SkEmptyShader : public SkShader { | 19 class SK_API SkEmptyShader : public SkShader { |
20 public: | 20 public: |
21 SkEmptyShader() {} | 21 SkEmptyShader() {} |
22 | 22 |
23 virtual size_t contextSize() const SK_OVERRIDE { | 23 size_t contextSize() const SK_OVERRIDE { |
24 // Even though createContext returns NULL we have to return a value of a
t least | 24 // Even though createContext returns NULL we have to return a value of a
t least |
25 // sizeof(SkShader::Context) to satisfy SkSmallAllocator. | 25 // sizeof(SkShader::Context) to satisfy SkSmallAllocator. |
26 return sizeof(SkShader::Context); | 26 return sizeof(SkShader::Context); |
27 } | 27 } |
28 | 28 |
29 SK_TO_STRING_OVERRIDE() | 29 SK_TO_STRING_OVERRIDE() |
30 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkEmptyShader) | 30 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkEmptyShader) |
31 | 31 |
32 protected: | 32 protected: |
33 virtual SkShader::Context* onCreateContext(const ContextRec&, void*) const S
K_OVERRIDE { | 33 SkShader::Context* onCreateContext(const ContextRec&, void*) const SK_OVERRI
DE { |
34 return NULL; | 34 return NULL; |
35 } | 35 } |
36 | 36 |
37 private: | 37 private: |
38 typedef SkShader INHERITED; | 38 typedef SkShader INHERITED; |
39 }; | 39 }; |
40 | 40 |
41 #endif | 41 #endif |
OLD | NEW |