OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 SkLinearGradient_DEFINED | 8 #ifndef SkLinearGradient_DEFINED |
9 #define SkLinearGradient_DEFINED | 9 #define SkLinearGradient_DEFINED |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 class SkLinearGradient : public SkGradientShaderBase { | 27 class SkLinearGradient : public SkGradientShaderBase { |
28 public: | 28 public: |
29 enum { | 29 enum { |
30 // Temp flag for testing the 4f impl. | 30 // Temp flag for testing the 4f impl. |
31 kForce4fContext_PrivateFlag = 1 << 7, | 31 kForce4fContext_PrivateFlag = 1 << 7, |
32 }; | 32 }; |
33 | 33 |
34 SkLinearGradient(const SkPoint pts[2], const Descriptor&); | 34 SkLinearGradient(const SkPoint pts[2], const Descriptor&); |
35 | 35 |
36 size_t contextSize(const ContextRec&) const override; | |
37 | |
38 class LinearGradientContext : public SkGradientShaderBase::GradientShaderBas
eContext { | 36 class LinearGradientContext : public SkGradientShaderBase::GradientShaderBas
eContext { |
39 public: | 37 public: |
40 LinearGradientContext(const SkLinearGradient&, const ContextRec&); | 38 LinearGradientContext(const SkLinearGradient&, const ContextRec&); |
41 | 39 |
42 void shadeSpan(int x, int y, SkPMColor dstC[], int count) override; | 40 void shadeSpan(int x, int y, SkPMColor dstC[], int count) override; |
43 | 41 |
44 struct Rec { | 42 struct Rec { |
45 Sk4fStorage fColor; | 43 Sk4fStorage fColor; |
46 float fPos; | 44 float fPos; |
47 float fPosScale; | 45 float fPosScale; |
(...skipping 16 matching lines...) Expand all Loading... |
64 const SkMatrix*, | 62 const SkMatrix*, |
65 SkFilterQuality) const overri
de; | 63 SkFilterQuality) const overri
de; |
66 #endif | 64 #endif |
67 | 65 |
68 SK_TO_STRING_OVERRIDE() | 66 SK_TO_STRING_OVERRIDE() |
69 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLinearGradient) | 67 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLinearGradient) |
70 | 68 |
71 protected: | 69 protected: |
72 SkLinearGradient(SkReadBuffer& buffer); | 70 SkLinearGradient(SkReadBuffer& buffer); |
73 void flatten(SkWriteBuffer& buffer) const override; | 71 void flatten(SkWriteBuffer& buffer) const override; |
| 72 size_t onContextSize(const ContextRec&) const override; |
74 Context* onCreateContext(const ContextRec&, void* storage) const override; | 73 Context* onCreateContext(const ContextRec&, void* storage) const override; |
75 | 74 |
76 private: | 75 private: |
77 class LinearGradient4fContext; | 76 class LinearGradient4fContext; |
78 | 77 |
79 friend class SkGradientShader; | 78 friend class SkGradientShader; |
80 typedef SkGradientShaderBase INHERITED; | 79 typedef SkGradientShaderBase INHERITED; |
81 const SkPoint fStart; | 80 const SkPoint fStart; |
82 const SkPoint fEnd; | 81 const SkPoint fEnd; |
83 }; | 82 }; |
84 | 83 |
85 #endif | 84 #endif |
OLD | NEW |