OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 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 #ifndef SkTwoPointConicalGradient_DEFINED | 9 #ifndef SkTwoPointConicalGradient_DEFINED |
10 #define SkTwoPointConicalGradient_DEFINED | 10 #define SkTwoPointConicalGradient_DEFINED |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 | 39 |
40 class SkTwoPointConicalGradient : public SkGradientShaderBase { | 40 class SkTwoPointConicalGradient : public SkGradientShaderBase { |
41 TwoPtRadial fRec; | 41 TwoPtRadial fRec; |
42 public: | 42 public: |
43 SkTwoPointConicalGradient(const SkPoint& start, SkScalar startRadius, | 43 SkTwoPointConicalGradient(const SkPoint& start, SkScalar startRadius, |
44 const SkPoint& end, SkScalar endRadius, | 44 const SkPoint& end, SkScalar endRadius, |
45 bool flippedGrad, const Descriptor&); | 45 bool flippedGrad, const Descriptor&); |
46 | 46 |
47 | 47 |
48 virtual size_t contextSize() const SK_OVERRIDE; | 48 size_t contextSize() const SK_OVERRIDE; |
49 | 49 |
50 class TwoPointConicalGradientContext : public SkGradientShaderBase::Gradient
ShaderBaseContext { | 50 class TwoPointConicalGradientContext : public SkGradientShaderBase::Gradient
ShaderBaseContext { |
51 public: | 51 public: |
52 TwoPointConicalGradientContext(const SkTwoPointConicalGradient&, const C
ontextRec&); | 52 TwoPointConicalGradientContext(const SkTwoPointConicalGradient&, const C
ontextRec&); |
53 ~TwoPointConicalGradientContext() {} | 53 ~TwoPointConicalGradientContext() {} |
54 | 54 |
55 virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count) SK_OVE
RRIDE; | 55 void shadeSpan(int x, int y, SkPMColor dstC[], int count) SK_OVERRIDE; |
56 | 56 |
57 private: | 57 private: |
58 typedef SkGradientShaderBase::GradientShaderBaseContext INHERITED; | 58 typedef SkGradientShaderBase::GradientShaderBaseContext INHERITED; |
59 }; | 59 }; |
60 | 60 |
61 virtual BitmapType asABitmap(SkBitmap* bitmap, | 61 virtual BitmapType asABitmap(SkBitmap* bitmap, |
62 SkMatrix* matrix, | 62 SkMatrix* matrix, |
63 TileMode* xy) const SK_OVERRIDE; | 63 TileMode* xy) const SK_OVERRIDE; |
64 virtual SkShader::GradientType asAGradient(GradientInfo* info) const SK_OVE
RRIDE; | 64 SkShader::GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE; |
65 virtual bool asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix&
, const SkMatrix*, | 65 virtual bool asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix&
, const SkMatrix*, |
66 GrColor*, GrFragmentProcessor**) const SK_O
VERRIDE; | 66 GrColor*, GrFragmentProcessor**) const SK_O
VERRIDE; |
67 virtual bool isOpaque() const SK_OVERRIDE; | 67 bool isOpaque() const SK_OVERRIDE; |
68 | 68 |
69 SkScalar getCenterX1() const { return SkPoint::Distance(fCenter1, fCenter2);
} | 69 SkScalar getCenterX1() const { return SkPoint::Distance(fCenter1, fCenter2);
} |
70 SkScalar getStartRadius() const { return fRadius1; } | 70 SkScalar getStartRadius() const { return fRadius1; } |
71 SkScalar getDiffRadius() const { return fRadius2 - fRadius1; } | 71 SkScalar getDiffRadius() const { return fRadius2 - fRadius1; } |
72 const SkPoint& getStartCenter() const { return fCenter1; } | 72 const SkPoint& getStartCenter() const { return fCenter1; } |
73 const SkPoint& getEndCenter() const { return fCenter2; } | 73 const SkPoint& getEndCenter() const { return fCenter2; } |
74 SkScalar getEndRadius() const { return fRadius2; } | 74 SkScalar getEndRadius() const { return fRadius2; } |
75 bool isFlippedGrad() const { return fFlippedGrad; } | 75 bool isFlippedGrad() const { return fFlippedGrad; } |
76 | 76 |
77 SK_TO_STRING_OVERRIDE() | 77 SK_TO_STRING_OVERRIDE() |
78 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTwoPointConicalGradien
t) | 78 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTwoPointConicalGradien
t) |
79 | 79 |
80 protected: | 80 protected: |
81 SkTwoPointConicalGradient(SkReadBuffer& buffer); | 81 SkTwoPointConicalGradient(SkReadBuffer& buffer); |
82 virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE; | 82 void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE; |
83 virtual Context* onCreateContext(const ContextRec&, void* storage) const SK_
OVERRIDE; | 83 Context* onCreateContext(const ContextRec&, void* storage) const SK_OVERRIDE
; |
84 | 84 |
85 private: | 85 private: |
86 SkPoint fCenter1; | 86 SkPoint fCenter1; |
87 SkPoint fCenter2; | 87 SkPoint fCenter2; |
88 SkScalar fRadius1; | 88 SkScalar fRadius1; |
89 SkScalar fRadius2; | 89 SkScalar fRadius2; |
90 bool fFlippedGrad; | 90 bool fFlippedGrad; |
91 | 91 |
92 friend class SkGradientShader; | 92 friend class SkGradientShader; |
93 typedef SkGradientShaderBase INHERITED; | 93 typedef SkGradientShaderBase INHERITED; |
94 }; | 94 }; |
95 | 95 |
96 #endif | 96 #endif |
OLD | NEW |