blob: a7885895ee10c7de509b6ae0c6d17def5b43b555 [file] [log] [blame]
fmalitabc590c02016-02-22 09:12:33 -08001/*
2 * Copyright 2016 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 Sk4fLinearGradient_DEFINED
9#define Sk4fLinearGradient_DEFINED
10
Mike Kleinc0bd9f92019-04-23 12:05:21 -050011#include "src/shaders/gradients/Sk4fGradientBase.h"
12#include "src/shaders/gradients/SkLinearGradient.h"
fmalitabc590c02016-02-22 09:12:33 -080013
14class SkLinearGradient::
fmalita7e6fcf82016-03-10 11:18:43 -080015LinearGradient4fContext final : public GradientShaderBase4fContext {
fmalitabc590c02016-02-22 09:12:33 -080016public:
17 LinearGradient4fContext(const SkLinearGradient&, const ContextRec&);
18
Florin Malitaaa0ce822017-08-28 12:50:26 -040019 void shadeSpan(int x, int y, SkPMColor dst[], int count) override;
fmalitabc590c02016-02-22 09:12:33 -080020
21private:
22 using INHERITED = GradientShaderBase4fContext;
23
Mike Reedfae8fce2019-04-03 10:27:45 -040024 template<ApplyPremul, SkTileMode>
fmalitabc590c02016-02-22 09:12:33 -080025 class LinearIntervalProcessor;
26
Mike Klein541cbd42019-01-30 13:11:33 -050027 template <ApplyPremul premul>
28 void shadePremulSpan(int x, int y, SkPMColor dst[], int count,
29 float bias0, float bias1) const;
fmalitabc590c02016-02-22 09:12:33 -080030
Mike Reedfae8fce2019-04-03 10:27:45 -040031 template <ApplyPremul premul, SkTileMode tileMode>
Mike Klein541cbd42019-01-30 13:11:33 -050032 void shadeSpanInternal(int x, int y, SkPMColor dst[], int count,
33 float bias0, float bias1) const;
fmalita7520fc42016-03-04 11:01:24 -080034
Florin Malitada4545b2017-03-23 17:04:54 -040035 const Sk4fGradientInterval* findInterval(SkScalar fx) const;
fmalita7520fc42016-03-04 11:01:24 -080036
Florin Malitada4545b2017-03-23 17:04:54 -040037 mutable const Sk4fGradientInterval* fCachedInterval;
fmalitabc590c02016-02-22 09:12:33 -080038};
39
40#endif // Sk4fLinearGradient_DEFINED