rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * Copyright 2012 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
| 7 | */ |
| 8 | |
| 9 | #ifndef SkSweepGradient_DEFINED |
| 10 | #define SkSweepGradient_DEFINED |
| 11 | |
| 12 | #include "SkGradientShaderPriv.h" |
| 13 | |
| 14 | class SkSweepGradient : public SkGradientShaderBase { |
| 15 | public: |
commit-bot@chromium.org | 9c9005a | 2014-04-28 14:55:39 +0000 | [diff] [blame^] | 16 | SkSweepGradient(SkScalar cx, SkScalar cy, const Descriptor&, |
| 17 | const SkMatrix* localMatrix); |
commit-bot@chromium.org | 87fcd95 | 2014-04-23 19:10:51 +0000 | [diff] [blame] | 18 | |
| 19 | virtual SkShader::Context* createContext(const SkBitmap&, const SkPaint&, const SkMatrix&, |
| 20 | void* storage) const SK_OVERRIDE; |
| 21 | virtual size_t contextSize() const SK_OVERRIDE; |
| 22 | |
| 23 | class SweepGradientContext : public SkGradientShaderBase::GradientShaderBaseContext { |
| 24 | public: |
| 25 | SweepGradientContext(const SkSweepGradient& shader, const SkBitmap& device, |
| 26 | const SkPaint& paint, const SkMatrix& matrix); |
| 27 | ~SweepGradientContext() {} |
| 28 | |
| 29 | virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count) SK_OVERRIDE; |
| 30 | virtual void shadeSpan16(int x, int y, uint16_t dstC[], int count) SK_OVERRIDE; |
| 31 | |
| 32 | private: |
| 33 | typedef SkGradientShaderBase::GradientShaderBaseContext INHERITED; |
| 34 | }; |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 35 | |
| 36 | virtual BitmapType asABitmap(SkBitmap* bitmap, |
| 37 | SkMatrix* matrix, |
| 38 | TileMode* xy) const SK_OVERRIDE; |
| 39 | |
| 40 | virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE; |
| 41 | |
bsalomon@google.com | 0ac6af4 | 2013-01-16 15:16:18 +0000 | [diff] [blame] | 42 | virtual GrEffectRef* asNewEffect(GrContext* context, const SkPaint&) const SK_OVERRIDE; |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 43 | |
commit-bot@chromium.org | 0f10f7b | 2014-03-13 18:02:17 +0000 | [diff] [blame] | 44 | SK_TO_STRING_OVERRIDE() |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 45 | SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSweepGradient) |
| 46 | |
| 47 | protected: |
commit-bot@chromium.org | 8b0e8ac | 2014-01-30 18:58:24 +0000 | [diff] [blame] | 48 | SkSweepGradient(SkReadBuffer& buffer); |
| 49 | virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE; |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 50 | |
| 51 | private: |
commit-bot@chromium.org | 6e5671d | 2014-04-23 16:16:55 +0000 | [diff] [blame] | 52 | const SkPoint fCenter; |
commit-bot@chromium.org | 87fcd95 | 2014-04-23 19:10:51 +0000 | [diff] [blame] | 53 | |
| 54 | typedef SkGradientShaderBase INHERITED; |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 55 | }; |
| 56 | |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 57 | #endif |