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 SkLinearGradient_DEFINED |
9 | #define SkLinearGradient_DEFINED |
10 | |
11 | #include "src/shaders/gradients/SkGradientShaderPriv.h" |
12 | |
13 | class SkLinearGradient : public SkGradientShaderBase { |
14 | public: |
15 | SkLinearGradient(const SkPoint pts[2], 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 | SkLinearGradient(SkReadBuffer& buffer); |
24 | void flatten(SkWriteBuffer& buffer) const override; |
25 | #ifdef SK_ENABLE_LEGACY_SHADERCONTEXT |
26 | Context* onMakeContext(const ContextRec&, SkArenaAlloc*) const override; |
27 | #endif |
28 | |
29 | void appendGradientStages(SkArenaAlloc* alloc, SkRasterPipeline* tPipeline, |
30 | SkRasterPipeline* postPipeline) const final; |
31 | |
32 | skvm::F32 transformT(skvm::Builder*, skvm::Uniforms*, |
33 | skvm::F32 x, skvm::F32 y, skvm::I32* mask) const final; |
34 | |
35 | private: |
36 | SK_FLATTENABLE_HOOKS(SkLinearGradient) |
37 | |
38 | class LinearGradient4fContext; |
39 | |
40 | friend class SkGradientShader; |
41 | typedef SkGradientShaderBase INHERITED; |
42 | const SkPoint fStart; |
43 | const SkPoint fEnd; |
44 | }; |
45 | |
46 | #endif |
47 |