| 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&, const SkMatrix* localMatrix); | 18 const Descriptor&, const SkMatrix* localMatrix); |
| 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 | |
| 27 virtual size_t contextSize() const SK_OVERRIDE; | 26 virtual size_t contextSize() const SK_OVERRIDE; |
| 28 virtual bool validContext(const SkBitmap&, const SkPaint&, | 27 virtual bool validContext(const ContextRec&, SkMatrix* totalInverse) const S
K_OVERRIDE; |
| 29 const SkMatrix&, SkMatrix* totalInverse = NULL) co
nst SK_OVERRIDE; | 28 virtual SkShader::Context* createContext(const ContextRec&, void* storage) c
onst SK_OVERRIDE; |
| 30 virtual SkShader::Context* createContext(const SkBitmap&, const SkPaint&, co
nst SkMatrix&, | |
| 31 void* storage) const SK_OVERRIDE; | |
| 32 | 29 |
| 33 class TwoPointRadialGradientContext : public SkGradientShaderBase::GradientS
haderBaseContext { | 30 class TwoPointRadialGradientContext : public SkGradientShaderBase::GradientS
haderBaseContext { |
| 34 public: | 31 public: |
| 35 TwoPointRadialGradientContext(const SkTwoPointRadialGradient& shader, | 32 TwoPointRadialGradientContext(const SkTwoPointRadialGradient&, const Con
textRec&); |
| 36 const SkBitmap& device, | |
| 37 const SkPaint& paint, | |
| 38 const SkMatrix& matrix); | |
| 39 ~TwoPointRadialGradientContext() {} | |
| 40 | 33 |
| 41 virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count) SK_OVE
RRIDE; | 34 virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count) SK_OVE
RRIDE; |
| 42 | 35 |
| 43 private: | 36 private: |
| 44 typedef SkGradientShaderBase::GradientShaderBaseContext INHERITED; | 37 typedef SkGradientShaderBase::GradientShaderBaseContext INHERITED; |
| 45 }; | 38 }; |
| 46 | 39 |
| 47 SkScalar getCenterX1() const { return fDiff.length(); } | 40 SkScalar getCenterX1() const { return fDiff.length(); } |
| 48 SkScalar getStartRadius() const { return fStartRadius; } | 41 SkScalar getStartRadius() const { return fStartRadius; } |
| 49 SkScalar getDiffRadius() const { return fDiffRadius; } | 42 SkScalar getDiffRadius() const { return fDiffRadius; } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 62 const SkScalar fRadius2; | 55 const SkScalar fRadius2; |
| 63 SkPoint fDiff; | 56 SkPoint fDiff; |
| 64 SkScalar fStartRadius, fDiffRadius, fSr2D2, fA, fOneOverTwoA; | 57 SkScalar fStartRadius, fDiffRadius, fSr2D2, fA, fOneOverTwoA; |
| 65 | 58 |
| 66 void init(); | 59 void init(); |
| 67 | 60 |
| 68 typedef SkGradientShaderBase INHERITED; | 61 typedef SkGradientShaderBase INHERITED; |
| 69 }; | 62 }; |
| 70 | 63 |
| 71 #endif | 64 #endif |
| OLD | NEW |