| 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 |
| 11 | 11 |
| 12 #include "math.h" |
| 13 |
| 12 #include "SkGradientShaderPriv.h" | 14 #include "SkGradientShaderPriv.h" |
| 13 | 15 |
| 14 // TODO(dominikg): Worth making it truly immutable (i.e. set values in construct
or)? | 16 // TODO(dominikg): Worth making it truly immutable (i.e. set values in construct
or)? |
| 15 // Should only be initialized once via init(). Immutable afterwards. | 17 // Should only be initialized once via init(). Immutable afterwards. |
| 16 struct TwoPtRadial { | 18 struct TwoPtRadial { |
| 17 enum { | 19 static const float kDontDrawT; |
| 18 // This value is outside the range SK_FixedMin to SK_FixedMax. | |
| 19 kDontDrawT = 0x80000000 | |
| 20 }; | |
| 21 | 20 |
| 22 float fCenterX, fCenterY; | 21 float fCenterX, fCenterY; |
| 23 float fDCenterX, fDCenterY; | 22 float fDCenterX, fDCenterY; |
| 24 float fRadius; | 23 float fRadius; |
| 25 float fDRadius; | 24 float fDRadius; |
| 26 float fA; | 25 float fA; |
| 27 float fRadius2; | 26 float fRadius2; |
| 28 float fRDR; | 27 float fRDR; |
| 29 bool fFlipped; | 28 bool fFlipped; |
| 30 | 29 |
| 31 void init(const SkPoint& center0, SkScalar rad0, | 30 void init(const SkPoint& center0, SkScalar rad0, |
| 32 const SkPoint& center1, SkScalar rad1, | 31 const SkPoint& center1, SkScalar rad1, |
| 33 bool flipped); | 32 bool flipped); |
| 34 | 33 |
| 35 static bool DontDrawT(SkFixed t) { | 34 static bool DontDrawT(float t) { |
| 36 return kDontDrawT == (uint32_t)t; | 35 return isnan(t); |
| 37 } | 36 } |
| 38 }; | 37 }; |
| 39 | 38 |
| 40 | 39 |
| 41 class SkTwoPointConicalGradient : public SkGradientShaderBase { | 40 class SkTwoPointConicalGradient : public SkGradientShaderBase { |
| 42 TwoPtRadial fRec; | 41 TwoPtRadial fRec; |
| 43 public: | 42 public: |
| 44 SkTwoPointConicalGradient(const SkPoint& start, SkScalar startRadius, | 43 SkTwoPointConicalGradient(const SkPoint& start, SkScalar startRadius, |
| 45 const SkPoint& end, SkScalar endRadius, | 44 const SkPoint& end, SkScalar endRadius, |
| 46 bool flippedGrad, const Descriptor&); | 45 bool flippedGrad, const Descriptor&); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 SkPoint fCenter2; | 86 SkPoint fCenter2; |
| 88 SkScalar fRadius1; | 87 SkScalar fRadius1; |
| 89 SkScalar fRadius2; | 88 SkScalar fRadius2; |
| 90 bool fFlippedGrad; | 89 bool fFlippedGrad; |
| 91 | 90 |
| 92 friend class SkGradientShader; | 91 friend class SkGradientShader; |
| 93 typedef SkGradientShaderBase INHERITED; | 92 typedef SkGradientShaderBase INHERITED; |
| 94 }; | 93 }; |
| 95 | 94 |
| 96 #endif | 95 #endif |
| OLD | NEW |