Home | History | Annotate | Download | only in gradients
      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 "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     sk_sp<SkShader> onMakeColorSpace(SkColorSpaceXformer* xformer) const override;
     26 
     27     void appendGradientStages(SkArenaAlloc* alloc, SkRasterPipeline* tPipeline,
     28                               SkRasterPipeline* postPipeline) const override;
     29 
     30 private:
     31     SK_FLATTENABLE_HOOKS(SkRadialGradient)
     32 
     33     const SkPoint fCenter;
     34     const SkScalar fRadius;
     35 
     36     friend class SkGradientShader;
     37     typedef SkGradientShaderBase INHERITED;
     38 };
     39 
     40 #endif
     41