| OLD | NEW |
| 1 | |
| 2 /* | 1 /* |
| 3 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 4 * | 3 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 7 */ | 6 */ |
| 8 | 7 |
| 9 #ifndef SkLinearGradient_DEFINED | 8 #ifndef SkLinearGradient_DEFINED |
| 10 #define SkLinearGradient_DEFINED | 9 #define SkLinearGradient_DEFINED |
| 11 | 10 |
| 12 #include "SkGradientShaderPriv.h" | 11 #include "SkGradientShaderPriv.h" |
| 13 | 12 |
| 14 class SkLinearGradient : public SkGradientShaderBase { | 13 class SkLinearGradient : public SkGradientShaderBase { |
| 15 public: | 14 public: |
| 16 SkLinearGradient(const SkPoint pts[2], const Descriptor&, const SkMatrix* lo
calMatrix); | 15 SkLinearGradient(const SkPoint pts[2], const Descriptor&, const SkMatrix* lo
calMatrix); |
| 17 | 16 |
| 18 virtual SkShader::Context* createContext(const SkBitmap&, const SkPaint&, co
nst SkMatrix&, | 17 virtual SkShader::Context* createContext(const ContextRec&, void* storage) c
onst SK_OVERRIDE; |
| 19 void* storage) const SK_OVERRIDE; | |
| 20 virtual size_t contextSize() const SK_OVERRIDE; | 18 virtual size_t contextSize() const SK_OVERRIDE; |
| 21 | 19 |
| 22 class LinearGradientContext : public SkGradientShaderBase::GradientShaderBas
eContext { | 20 class LinearGradientContext : public SkGradientShaderBase::GradientShaderBas
eContext { |
| 23 public: | 21 public: |
| 24 LinearGradientContext(const SkLinearGradient& shader, const SkBitmap& de
vice, | 22 LinearGradientContext(const SkLinearGradient&, const ContextRec&); |
| 25 const SkPaint& paint, const SkMatrix& matrix); | |
| 26 ~LinearGradientContext() {} | 23 ~LinearGradientContext() {} |
| 27 | 24 |
| 28 virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count) SK_OVE
RRIDE; | 25 virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count) SK_OVE
RRIDE; |
| 29 virtual void shadeSpan16(int x, int y, uint16_t dstC[], int count) SK_OV
ERRIDE; | 26 virtual void shadeSpan16(int x, int y, uint16_t dstC[], int count) SK_OV
ERRIDE; |
| 30 | 27 |
| 31 private: | 28 private: |
| 32 typedef SkGradientShaderBase::GradientShaderBaseContext INHERITED; | 29 typedef SkGradientShaderBase::GradientShaderBaseContext INHERITED; |
| 33 }; | 30 }; |
| 34 | 31 |
| 35 virtual BitmapType asABitmap(SkBitmap*, SkMatrix*, TileMode*) const SK_OVERR
IDE; | 32 virtual BitmapType asABitmap(SkBitmap*, SkMatrix*, TileMode*) const SK_OVERR
IDE; |
| 36 virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE; | 33 virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE; |
| 37 virtual GrEffectRef* asNewEffect(GrContext* context, const SkPaint&) const S
K_OVERRIDE; | 34 virtual GrEffectRef* asNewEffect(GrContext* context, const SkPaint&) const S
K_OVERRIDE; |
| 38 | 35 |
| 39 SK_TO_STRING_OVERRIDE() | 36 SK_TO_STRING_OVERRIDE() |
| 40 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLinearGradient) | 37 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLinearGradient) |
| 41 | 38 |
| 42 protected: | 39 protected: |
| 43 SkLinearGradient(SkReadBuffer& buffer); | 40 SkLinearGradient(SkReadBuffer& buffer); |
| 44 virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE; | 41 virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE; |
| 45 | 42 |
| 46 private: | 43 private: |
| 47 typedef SkGradientShaderBase INHERITED; | 44 typedef SkGradientShaderBase INHERITED; |
| 48 const SkPoint fStart; | 45 const SkPoint fStart; |
| 49 const SkPoint fEnd; | 46 const SkPoint fEnd; |
| 50 }; | 47 }; |
| 51 | 48 |
| 52 #endif | 49 #endif |
| OLD | NEW |