| 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 virtual void shadeSpan(int x, int y, SkPMColor* dstCParam, | 26 |
| 27 int count) SK_OVERRIDE; | 27 virtual size_t contextSize() const SK_OVERRIDE; |
| 28 virtual bool setContext(const SkBitmap& device, | 28 bool validContext(const SkBitmap&, const SkPaint&, const SkMatrix&) const SK
_OVERRIDE; |
| 29 const SkPaint& paint, | 29 virtual SkShader::Context* createContext(const SkBitmap&, const SkPaint&, co
nst SkMatrix&, |
| 30 const SkMatrix& matrix) SK_OVERRIDE; | 30 void* storage) const SK_OVERRIDE; |
| 31 |
| 32 class TwoPointRadialGradientContext : public SkGradientShaderBase::GradientS
haderBaseContext { |
| 33 public: |
| 34 TwoPointRadialGradientContext(const SkTwoPointRadialGradient& shader, |
| 35 const SkBitmap& device, |
| 36 const SkPaint& paint, |
| 37 const SkMatrix& matrix); |
| 38 ~TwoPointRadialGradientContext() {} |
| 39 |
| 40 virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count) SK_OVE
RRIDE; |
| 41 |
| 42 private: |
| 43 typedef SkGradientShaderBase::GradientShaderBaseContext INHERITED; |
| 44 }; |
| 31 | 45 |
| 32 SkScalar getCenterX1() const { return fDiff.length(); } | 46 SkScalar getCenterX1() const { return fDiff.length(); } |
| 33 SkScalar getStartRadius() const { return fStartRadius; } | 47 SkScalar getStartRadius() const { return fStartRadius; } |
| 34 SkScalar getDiffRadius() const { return fDiffRadius; } | 48 SkScalar getDiffRadius() const { return fDiffRadius; } |
| 35 | 49 |
| 36 SK_TO_STRING_OVERRIDE() | 50 SK_TO_STRING_OVERRIDE() |
| 37 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTwoPointRadialGradient
) | 51 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkTwoPointRadialGradient
) |
| 38 | 52 |
| 39 protected: | 53 protected: |
| 40 SkTwoPointRadialGradient(SkReadBuffer& buffer); | 54 SkTwoPointRadialGradient(SkReadBuffer& buffer); |
| 41 virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE; | 55 virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE; |
| 42 | 56 |
| 43 private: | 57 private: |
| 44 typedef SkGradientShaderBase INHERITED; | |
| 45 const SkPoint fCenter1; | 58 const SkPoint fCenter1; |
| 46 const SkPoint fCenter2; | 59 const SkPoint fCenter2; |
| 47 const SkScalar fRadius1; | 60 const SkScalar fRadius1; |
| 48 const SkScalar fRadius2; | 61 const SkScalar fRadius2; |
| 49 SkPoint fDiff; | 62 SkPoint fDiff; |
| 50 SkScalar fStartRadius, fDiffRadius, fSr2D2, fA, fOneOverTwoA; | 63 SkScalar fStartRadius, fDiffRadius, fSr2D2, fA, fOneOverTwoA; |
| 51 | 64 |
| 52 void init(); | 65 void init(); |
| 66 |
| 67 typedef SkGradientShaderBase INHERITED; |
| 53 }; | 68 }; |
| 54 | 69 |
| 55 #endif | 70 #endif |
| OLD | NEW |