blob: bd6fb3542fba59af97b39b6c5c905080df65ea74 [file] [log] [blame]
rileya@google.com589708b2012-07-26 20:04:23 +00001
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
14class SkRadialGradient : public SkGradientShaderBase {
15public:
reedaddf2ed2014-08-11 08:28:24 -070016 SkRadialGradient(const SkPoint& center, SkScalar radius, const Descriptor&);
commit-bot@chromium.org87fcd952014-04-23 19:10:51 +000017
mtklein36352bf2015-03-25 18:17:31 -070018 size_t contextSize() const override;
commit-bot@chromium.org87fcd952014-04-23 19:10:51 +000019
20 class RadialGradientContext : public SkGradientShaderBase::GradientShaderBaseContext {
21 public:
commit-bot@chromium.orge901b6d2014-05-01 19:31:31 +000022 RadialGradientContext(const SkRadialGradient&, const ContextRec&);
commit-bot@chromium.org87fcd952014-04-23 19:10:51 +000023
mtklein36352bf2015-03-25 18:17:31 -070024 void shadeSpan(int x, int y, SkPMColor dstC[], int count) override;
commit-bot@chromium.org87fcd952014-04-23 19:10:51 +000025
26 private:
27 typedef SkGradientShaderBase::GradientShaderBaseContext INHERITED;
28 };
29
mtklein36352bf2015-03-25 18:17:31 -070030 GradientType asAGradient(GradientInfo* info) const override;
bsalomonc21b09e2015-08-28 18:46:56 -070031#if SK_SUPPORT_GPU
32 const GrFragmentProcessor* asFragmentProcessor(GrContext*,
33 const SkMatrix& viewM,
34 const SkMatrix*,
bsalomon4a339522015-10-06 08:40:50 -070035 SkFilterQuality) const override;
bsalomonc21b09e2015-08-28 18:46:56 -070036#endif
rileya@google.com589708b2012-07-26 20:04:23 +000037
commit-bot@chromium.org0f10f7b2014-03-13 18:02:17 +000038 SK_TO_STRING_OVERRIDE()
rileya@google.com589708b2012-07-26 20:04:23 +000039 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkRadialGradient)
40
41protected:
commit-bot@chromium.org8b0e8ac2014-01-30 18:58:24 +000042 SkRadialGradient(SkReadBuffer& buffer);
mtklein36352bf2015-03-25 18:17:31 -070043 void flatten(SkWriteBuffer& buffer) const override;
44 Context* onCreateContext(const ContextRec&, void* storage) const override;
rileya@google.com589708b2012-07-26 20:04:23 +000045
46private:
rileya@google.com589708b2012-07-26 20:04:23 +000047 const SkPoint fCenter;
48 const SkScalar fRadius;
robertphillips31dc1b22015-07-07 10:05:18 -070049
50 friend class SkGradientShader;
51 typedef SkGradientShaderBase INHERITED;
rileya@google.com589708b2012-07-26 20:04:23 +000052};
53
rileya@google.com589708b2012-07-26 20:04:23 +000054#endif