rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 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 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 11 | #include "src/shaders/gradients/SkGradientShaderPriv.h" |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 12 | |
Florin Malita | 5769dd2 | 2017-07-12 13:31:25 -0400 | [diff] [blame] | 13 | class SkSweepGradient final : public SkGradientShaderBase { |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 14 | public: |
Florin Malita | 5a9a981 | 2017-08-01 16:38:08 -0400 | [diff] [blame] | 15 | SkSweepGradient(const SkPoint& center, SkScalar t0, SkScalar t1, const Descriptor&); |
commit-bot@chromium.org | 87fcd95 | 2014-04-23 19:10:51 +0000 | [diff] [blame] | 16 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 17 | GradientType asAGradient(GradientInfo* info) const override; |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 18 | |
bsalomon | c21b09e | 2015-08-28 18:46:56 -0700 | [diff] [blame] | 19 | #if SK_SUPPORT_GPU |
Mike Reed | e3429e6 | 2018-01-19 11:43:34 -0500 | [diff] [blame] | 20 | std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override; |
bsalomon | c21b09e | 2015-08-28 18:46:56 -0700 | [diff] [blame] | 21 | #endif |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 22 | |
Michael Ludwig | 24d438b | 2018-09-12 15:22:50 -0400 | [diff] [blame] | 23 | SkScalar getTBias() const { return fTBias; } |
| 24 | |
| 25 | SkScalar getTScale() const { return fTScale; } |
| 26 | |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 27 | protected: |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 28 | void flatten(SkWriteBuffer& buffer) const override; |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 29 | |
Florin Malita | 50b2084 | 2017-07-29 19:08:28 -0400 | [diff] [blame] | 30 | void appendGradientStages(SkArenaAlloc* alloc, SkRasterPipeline* tPipeline, |
| 31 | SkRasterPipeline* postPipeline) const override; |
Mike Klein | caf5ee4 | 2020-01-28 16:11:34 -0600 | [diff] [blame] | 32 | |
Mike Klein | ce9e060 | 2020-01-29 09:47:44 -0600 | [diff] [blame] | 33 | skvm::F32 transformT(skvm::Builder*, skvm::Uniforms*, |
Brian Osman | 5aaaeea | 2020-06-22 14:26:03 -0400 | [diff] [blame^] | 34 | skvm::Coord coord, skvm::I32* mask) const final; |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 35 | private: |
Mike Klein | 4fee323 | 2018-10-18 17:27:16 -0400 | [diff] [blame] | 36 | SK_FLATTENABLE_HOOKS(SkSweepGradient) |
| 37 | |
Florin Malita | 5a9a981 | 2017-08-01 16:38:08 -0400 | [diff] [blame] | 38 | const SkPoint fCenter; |
| 39 | const SkScalar fTBias, |
| 40 | fTScale; |
commit-bot@chromium.org | 87fcd95 | 2014-04-23 19:10:51 +0000 | [diff] [blame] | 41 | |
reed | 9fa60da | 2014-08-21 07:59:51 -0700 | [diff] [blame] | 42 | friend class SkGradientShader; |
commit-bot@chromium.org | 87fcd95 | 2014-04-23 19:10:51 +0000 | [diff] [blame] | 43 | typedef SkGradientShaderBase INHERITED; |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 44 | }; |
| 45 | |
rileya@google.com | 589708b | 2012-07-26 20:04:23 +0000 | [diff] [blame] | 46 | #endif |