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 SkRadialGradient_DEFINED |
| 10 | #define SkRadialGradient_DEFINED |
| 11 | |
| 12 | #include "SkGradientShaderPriv.h" |
| 13 | |
| 14 | class SkRadialGradient : public SkGradientShaderBase { |
| 15 | public: |
reed | addf2ed | 2014-08-11 08:28:24 -0700 | [diff] [blame] | 16 | SkRadialGradient(const SkPoint& center, SkScalar radius, const Descriptor&); |
commit-bot@chromium.org | 87fcd95 | 2014-04-23 19:10:51 +0000 | [diff] [blame] | 17 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 18 | size_t contextSize() const override; |
commit-bot@chromium.org | 87fcd95 | 2014-04-23 19:10:51 +0000 | [diff] [blame] | 19 | |
| 20 | class RadialGradientContext : public SkGradientShaderBase::GradientShaderBaseContext { |
| 21 | public: |
commit-bot@chromium.org | e901b6d | 2014-05-01 19:31:31 +0000 | [diff] [blame] | 22 | RadialGradientContext(const SkRadialGradient&, const ContextRec&); |
commit-bot@chromium.org | 87fcd95 | 2014-04-23 19:10:51 +0000 | [diff] [blame] | 23 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 24 | void shadeSpan(int x, int y, SkPMColor dstC[], int count) override; |
commit-bot@chromium.org | 87fcd95 | 2014-04-23 19:10:51 +0000 | [diff] [blame] | 25 | |
| 26 | private: |
| 27 | typedef SkGradientShaderBase::GradientShaderBaseContext INHERITED; |
| 28 | }; |
| 29 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 30 | GradientType asAGradient(GradientInfo* info) const override; |
bsalomon | c21b09e | 2015-08-28 18:46:56 -0700 | [diff] [blame] | 31 | #if SK_SUPPORT_GPU |
| 32 | const GrFragmentProcessor* asFragmentProcessor(GrContext*, |
| 33 | const SkMatrix& viewM, |
| 34 | const SkMatrix*, |
bsalomon | 4a33952 | 2015-10-06 08:40:50 -0700 | [diff] [blame] | 35 | SkFilterQuality) const override; |
bsalomon | c21b09e | 2015-08-28 18:46:56 -0700 | [diff] [blame] | 36 | #endif |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 37 | |
commit-bot@chromium.org | 0f10f7b | 2014-03-13 18:02:17 +0000 | [diff] [blame] | 38 | SK_TO_STRING_OVERRIDE() |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 39 | SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkRadialGradient) |
| 40 | |
| 41 | protected: |
commit-bot@chromium.org | 8b0e8ac | 2014-01-30 18:58:24 +0000 | [diff] [blame] | 42 | SkRadialGradient(SkReadBuffer& buffer); |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 43 | void flatten(SkWriteBuffer& buffer) const override; |
| 44 | Context* onCreateContext(const ContextRec&, void* storage) const override; |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 45 | |
| 46 | private: |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 47 | const SkPoint fCenter; |
| 48 | const SkScalar fRadius; |
robertphillips | 31dc1b2 | 2015-07-07 10:05:18 -0700 | [diff] [blame] | 49 | |
| 50 | friend class SkGradientShader; |
| 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 |