blob: dce9a3561b216e3deb4adf497db235753ea2cb1c [file] [log] [blame]
rileya@google.com589708b2012-07-26 20:04:23 +00001/*
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
Florin Malita5769dd22017-07-12 13:31:25 -040013class SkSweepGradient final : public SkGradientShaderBase {
rileya@google.com589708b2012-07-26 20:04:23 +000014public:
Florin Malita5a9a9812017-08-01 16:38:08 -040015 SkSweepGradient(const SkPoint& center, SkScalar t0, SkScalar t1, const Descriptor&);
commit-bot@chromium.org87fcd952014-04-23 19:10:51 +000016
mtklein36352bf2015-03-25 18:17:31 -070017 GradientType asAGradient(GradientInfo* info) const override;
rileya@google.com589708b2012-07-26 20:04:23 +000018
bsalomonc21b09e2015-08-28 18:46:56 -070019#if SK_SUPPORT_GPU
Mike Reede3429e62018-01-19 11:43:34 -050020 std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs&) const override;
bsalomonc21b09e2015-08-28 18:46:56 -070021#endif
rileya@google.com589708b2012-07-26 20:04:23 +000022
Cary Clark99885412018-04-05 13:09:58 -040023 void toString(SkString* str) const override;
rileya@google.com589708b2012-07-26 20:04:23 +000024 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSweepGradient)
25
26protected:
mtklein36352bf2015-03-25 18:17:31 -070027 void flatten(SkWriteBuffer& buffer) const override;
Matt Sarett6cc6ae72017-04-18 18:29:12 -040028 sk_sp<SkShader> onMakeColorSpace(SkColorSpaceXformer* xformer) const override;
rileya@google.com589708b2012-07-26 20:04:23 +000029
Florin Malita50b20842017-07-29 19:08:28 -040030 void appendGradientStages(SkArenaAlloc* alloc, SkRasterPipeline* tPipeline,
31 SkRasterPipeline* postPipeline) const override;
Herb Derby7eb86982017-05-02 19:04:39 -040032
rileya@google.com589708b2012-07-26 20:04:23 +000033private:
Florin Malita5a9a9812017-08-01 16:38:08 -040034 const SkPoint fCenter;
35 const SkScalar fTBias,
36 fTScale;
commit-bot@chromium.org87fcd952014-04-23 19:10:51 +000037
reed9fa60da2014-08-21 07:59:51 -070038 friend class SkGradientShader;
commit-bot@chromium.org87fcd952014-04-23 19:10:51 +000039 typedef SkGradientShaderBase INHERITED;
rileya@google.com589708b2012-07-26 20:04:23 +000040};
41
rileya@google.com589708b2012-07-26 20:04:23 +000042#endif