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 SkSweepGradient_DEFINED
      9 #define SkSweepGradient_DEFINED
     10 
     11 #include "SkGradientShaderPriv.h"
     12 
     13 class SkSweepGradient final : public SkGradientShaderBase {
     14 public:
     15     SkSweepGradient(const SkPoint& center, SkScalar t0, SkScalar t1, const Descriptor&);
     16 
     17     GradientType asAGradient(GradientInfo* info) const override;
     18 
     19 #if SK_SUPPORT_GPU
     20     std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override;
     21 #endif
     22 
     23     SkScalar getTBias() const { return fTBias; }
     24 
     25     SkScalar getTScale() const { return fTScale; }
     26 
     27 protected:
     28     void flatten(SkWriteBuffer& buffer) const override;
     29     sk_sp<SkShader> onMakeColorSpace(SkColorSpaceXformer* xformer) const override;
     30 
     31     void appendGradientStages(SkArenaAlloc* alloc, SkRasterPipeline* tPipeline,
     32                               SkRasterPipeline* postPipeline) const override;
     33 
     34 private:
     35     SK_FLATTENABLE_HOOKS(SkSweepGradient)
     36 
     37     const SkPoint  fCenter;
     38     const SkScalar fTBias,
     39                    fTScale;
     40 
     41     friend class SkGradientShader;
     42     typedef SkGradientShaderBase INHERITED;
     43 };
     44 
     45 #endif
     46