| 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 SkTwoPointRadialGradient_DEFINED | 9 #ifndef SkTwoPointRadialGradient_DEFINED |
| 10 #define SkTwoPointRadialGradient_DEFINED | 10 #define SkTwoPointRadialGradient_DEFINED |
| 11 | 11 |
| 12 #include "SkGradientShaderPriv.h" | 12 #include "SkGradientShaderPriv.h" |
| 13 | 13 |
| 14 class SkTwoPointRadialGradient : public SkGradientShaderBase { | 14 class SkTwoPointRadialGradient : public SkGradientShaderBase { |
| 15 public: | 15 public: |
| 16 SkTwoPointRadialGradient(const SkPoint& start, SkScalar startRadius, | 16 SkTwoPointRadialGradient(const SkPoint& start, SkScalar startRadius, |
| 17 const SkPoint& end, SkScalar endRadius, | 17 const SkPoint& end, SkScalar endRadius, |
| 18 const Descriptor&); | 18 const Descriptor&); |
| 19 | 19 |
| 20 virtual BitmapType asABitmap(SkBitmap* bitmap, | 20 virtual BitmapType asABitmap(SkBitmap* bitmap, |
| 21 SkMatrix* matrix, | 21 SkMatrix* matrix, |
| 22 TileMode* xy) const SK_OVERRIDE; | 22 TileMode* xy) const SK_OVERRIDE; |
| 23 virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE; | 23 virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE; |
| 24 virtual GrEffectRef* asNewEffect(GrContext* context, const SkPaint&) const S
K_OVERRIDE; | 24 virtual GrEffectRef* asNewEffect(GrContext* context, const SkPaint&) const S
K_OVERRIDE; |
| 25 | 25 |
| 26 #if 0 |
| 26 virtual void shadeSpan(int x, int y, SkPMColor* dstCParam, | 27 virtual void shadeSpan(int x, int y, SkPMColor* dstCParam, |
| 27 int count) SK_OVERRIDE; | 28 int count) SK_OVERRIDE; |
| 28 virtual bool setContext(const SkBitmap& device, | 29 virtual bool setContext(const SkBitmap& device, |
| 29 const SkPaint& paint, | 30 const SkPaint& paint, |
| 30 const SkMatrix& matrix) SK_OVERRIDE; | 31 const SkMatrix& matrix) SK_OVERRIDE; |
| 32 #endif |
| 31 | 33 |
| 32 SkScalar getCenterX1() const { return fDiff.length(); } | 34 SkScalar getCenterX1() const { return fDiff.length(); } |
| 33 SkScalar getStartRadius() const { return fStartRadius; } | 35 SkScalar getStartRadius() const { return fStartRadius; } |
| 34 SkScalar getDiffRadius() const { return fDiffRadius; } | 36 SkScalar getDiffRadius() const { return fDiffRadius; } |
| 35 | 37 |
| 36 SK_DEVELOPER_TO_STRING() | 38 SK_DEVELOPER_TO_STRING() |
| 37 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTwoPointRadialGradient
) | 39 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTwoPointRadialGradient
) |
| 38 | 40 |
| 39 protected: | 41 protected: |
| 40 SkTwoPointRadialGradient(SkReadBuffer& buffer); | 42 SkTwoPointRadialGradient(SkReadBuffer& buffer); |
| 41 virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE; | 43 virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE; |
| 42 | 44 |
| 43 private: | 45 private: |
| 44 typedef SkGradientShaderBase INHERITED; | 46 typedef SkGradientShaderBase INHERITED; |
| 45 const SkPoint fCenter1; | 47 const SkPoint fCenter1; |
| 46 const SkPoint fCenter2; | 48 const SkPoint fCenter2; |
| 47 const SkScalar fRadius1; | 49 const SkScalar fRadius1; |
| 48 const SkScalar fRadius2; | 50 const SkScalar fRadius2; |
| 49 SkPoint fDiff; | 51 SkPoint fDiff; |
| 50 SkScalar fStartRadius, fDiffRadius, fSr2D2, fA, fOneOverTwoA; | 52 SkScalar fStartRadius, fDiffRadius, fSr2D2, fA, fOneOverTwoA; |
| 51 | 53 |
| 52 void init(); | 54 void init(); |
| 53 }; | 55 }; |
| 54 | 56 |
| 55 #endif | 57 #endif |
| OLD | NEW |