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 "src/shaders/gradients/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 | |
30 | void appendGradientStages(SkArenaAlloc* alloc, SkRasterPipeline* tPipeline, |
31 | SkRasterPipeline* postPipeline) const override; |
32 | |
33 | skvm::F32 transformT(skvm::Builder*, skvm::Uniforms*, |
34 | skvm::F32 x, skvm::F32 y, skvm::I32* mask) const final; |
35 | private: |
36 | SK_FLATTENABLE_HOOKS(SkSweepGradient) |
37 | |
38 | const SkPoint fCenter; |
39 | const SkScalar fTBias, |
40 | fTScale; |
41 | |
42 | friend class SkGradientShader; |
43 | typedef SkGradientShaderBase INHERITED; |
44 | }; |
45 | |
46 | #endif |
47 | |