• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2012 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef SkRadialGradient_DEFINED
9 #define SkRadialGradient_DEFINED
10 
11 #include "src/shaders/gradients/SkGradientShaderPriv.h"
12 
13 class SkRadialGradient final : public SkGradientShaderBase {
14 public:
15     SkRadialGradient(const SkPoint& center, SkScalar radius, const Descriptor&);
16 
17     GradientType asAGradient(GradientInfo* info) const override;
18 #if SK_SUPPORT_GPU
19     std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override;
20 #endif
21 
22 protected:
23     SkRadialGradient(SkReadBuffer& buffer);
24     void flatten(SkWriteBuffer& buffer) const override;
25 
26     void appendGradientStages(SkArenaAlloc* alloc, SkRasterPipeline* tPipeline,
27                               SkRasterPipeline* postPipeline) const override;
28 
29     skvm::F32 transformT(skvm::Builder*, skvm::Uniforms*,
30                          skvm::Coord coord, skvm::I32* mask) const final;
31 
32 private:
33     SK_FLATTENABLE_HOOKS(SkRadialGradient)
34 
35     const SkPoint fCenter;
36     const SkScalar fRadius;
37 
38     friend class SkGradientShader;
39     using INHERITED = SkGradientShaderBase;
40 };
41 
42 #endif
43