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 |
36 class LinearGradientContext : public SkGradientShaderBase::GradientShaderBas
eContext { | 38 class LinearGradientContext : public SkGradientShaderBase::GradientShaderBas
eContext { |
37 public: | 39 public: |
38 LinearGradientContext(const SkLinearGradient&, const ContextRec&); | 40 LinearGradientContext(const SkLinearGradient&, const ContextRec&); |
39 | 41 |
40 void shadeSpan(int x, int y, SkPMColor dstC[], int count) override; | 42 void shadeSpan(int x, int y, SkPMColor dstC[], int count) override; |
41 | 43 |
42 struct Rec { | 44 struct Rec { |
43 Sk4fStorage fColor; | 45 Sk4fStorage fColor; |
44 float fPos; | 46 float fPos; |
45 float fPosScale; | 47 float fPosScale; |
(...skipping 16 matching lines...) Expand all Loading... |
62 const SkMatrix*, | 64 const SkMatrix*, |
63 SkFilterQuality) const overri
de; | 65 SkFilterQuality) const overri
de; |
64 #endif | 66 #endif |
65 | 67 |
66 SK_TO_STRING_OVERRIDE() | 68 SK_TO_STRING_OVERRIDE() |
67 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLinearGradient) | 69 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLinearGradient) |
68 | 70 |
69 protected: | 71 protected: |
70 SkLinearGradient(SkReadBuffer& buffer); | 72 SkLinearGradient(SkReadBuffer& buffer); |
71 void flatten(SkWriteBuffer& buffer) const override; | 73 void flatten(SkWriteBuffer& buffer) const override; |
72 size_t onContextSize(const ContextRec&) const override; | |
73 Context* onCreateContext(const ContextRec&, void* storage) const override; | 74 Context* onCreateContext(const ContextRec&, void* storage) const override; |
74 | 75 |
75 private: | 76 private: |
76 class LinearGradient4fContext; | 77 class LinearGradient4fContext; |
77 | 78 |
78 friend class SkGradientShader; | 79 friend class SkGradientShader; |
79 typedef SkGradientShaderBase INHERITED; | 80 typedef SkGradientShaderBase INHERITED; |
80 const SkPoint fStart; | 81 const SkPoint fStart; |
81 const SkPoint fEnd; | 82 const SkPoint fEnd; |
82 }; | 83 }; |
83 | 84 |
84 #endif | 85 #endif |
OLD | NEW |