OLD | NEW |
1 | |
2 /* | 1 /* |
3 * Copyright 2007 The Android Open Source Project | 2 * Copyright 2007 The Android Open Source Project |
4 * | 3 * |
5 * 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 |
6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
7 */ | 6 */ |
8 | 7 |
9 | |
10 #ifndef SkColorShader_DEFINED | 8 #ifndef SkColorShader_DEFINED |
11 #define SkColorShader_DEFINED | 9 #define SkColorShader_DEFINED |
12 | 10 |
13 #include "SkShader.h" | 11 #include "SkShader.h" |
14 | 12 |
15 /** \class SkColorShader | 13 /** \class SkColorShader |
16 A Shader that represents a single color. In general, this effect can be | 14 A Shader that represents a single color. In general, this effect can be |
17 accomplished by just using the color field on the paint, but if an | 15 accomplished by just using the color field on the paint, but if an |
18 actual shader object is needed, this provides that feature. | 16 actual shader object is needed, this provides that feature. |
19 */ | 17 */ |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 const SkMatrix* localMatrix, GrColor* paintColor, | 58 const SkMatrix* localMatrix, GrColor* paintColor, |
61 GrEffect** effect) const SK_OVERRIDE; | 59 GrEffect** effect) const SK_OVERRIDE; |
62 | 60 |
63 SK_TO_STRING_OVERRIDE() | 61 SK_TO_STRING_OVERRIDE() |
64 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorShader) | 62 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkColorShader) |
65 | 63 |
66 protected: | 64 protected: |
67 SkColorShader(SkReadBuffer&); | 65 SkColorShader(SkReadBuffer&); |
68 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 66 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
69 virtual Context* onCreateContext(const ContextRec&, void* storage) const SK_
OVERRIDE; | 67 virtual Context* onCreateContext(const ContextRec&, void* storage) const SK_
OVERRIDE; |
| 68 virtual bool onAsLuminanceColor(SkColor* lum) const SK_OVERRIDE { |
| 69 *lum = fColor; |
| 70 return true; |
| 71 } |
70 | 72 |
71 private: | 73 private: |
72 SkColor fColor; // ignored if fInheritColor is true | 74 SkColor fColor; |
73 | 75 |
74 typedef SkShader INHERITED; | 76 typedef SkShader INHERITED; |
75 }; | 77 }; |
76 | 78 |
77 #endif | 79 #endif |
OLD | NEW |