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: |
reed | addf2ed | 2014-08-11 08:28:24 -0700 | [diff] [blame^] | 16 | SkSweepGradient(SkScalar cx, SkScalar cy, const Descriptor&); |
commit-bot@chromium.org | 87fcd95 | 2014-04-23 19:10:51 +0000 | [diff] [blame] | 17 | |
commit-bot@chromium.org | 87fcd95 | 2014-04-23 19:10:51 +0000 | [diff] [blame] | 18 | virtual size_t contextSize() const SK_OVERRIDE; |
| 19 | |
| 20 | class SweepGradientContext : public SkGradientShaderBase::GradientShaderBaseContext { |
| 21 | public: |
commit-bot@chromium.org | e901b6d | 2014-05-01 19:31:31 +0000 | [diff] [blame] | 22 | SweepGradientContext(const SkSweepGradient& shader, const ContextRec&); |
commit-bot@chromium.org | 87fcd95 | 2014-04-23 19:10:51 +0000 | [diff] [blame] | 23 | |
| 24 | virtual void shadeSpan(int x, int y, SkPMColor dstC[], int count) SK_OVERRIDE; |
| 25 | virtual void shadeSpan16(int x, int y, uint16_t dstC[], int count) SK_OVERRIDE; |
| 26 | |
| 27 | private: |
| 28 | typedef SkGradientShaderBase::GradientShaderBaseContext INHERITED; |
| 29 | }; |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 30 | |
| 31 | virtual BitmapType asABitmap(SkBitmap* bitmap, |
| 32 | SkMatrix* matrix, |
| 33 | TileMode* xy) const SK_OVERRIDE; |
| 34 | |
| 35 | virtual GradientType asAGradient(GradientInfo* info) const SK_OVERRIDE; |
| 36 | |
bsalomon | 97b9ab7 | 2014-07-08 06:52:35 -0700 | [diff] [blame] | 37 | virtual bool asNewEffect(GrContext*, const SkPaint&, const SkMatrix*, GrColor*, GrEffect**) |
dandov | 9de5b51 | 2014-06-10 14:38:28 -0700 | [diff] [blame] | 38 | const SK_OVERRIDE; |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 39 | |
commit-bot@chromium.org | 0f10f7b | 2014-03-13 18:02:17 +0000 | [diff] [blame] | 40 | SK_TO_STRING_OVERRIDE() |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 41 | SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSweepGradient) |
| 42 | |
| 43 | protected: |
commit-bot@chromium.org | 8b0e8ac | 2014-01-30 18:58:24 +0000 | [diff] [blame] | 44 | SkSweepGradient(SkReadBuffer& buffer); |
| 45 | virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE; |
commit-bot@chromium.org | ce56d96 | 2014-05-05 18:39:18 +0000 | [diff] [blame] | 46 | virtual Context* onCreateContext(const ContextRec&, void* storage) const SK_OVERRIDE; |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 47 | |
| 48 | private: |
commit-bot@chromium.org | 6e5671d | 2014-04-23 16:16:55 +0000 | [diff] [blame] | 49 | const SkPoint fCenter; |
commit-bot@chromium.org | 87fcd95 | 2014-04-23 19:10:51 +0000 | [diff] [blame] | 50 | |
| 51 | typedef SkGradientShaderBase INHERITED; |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 52 | }; |
| 53 | |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 54 | #endif |