Line data Source code
1 : /*
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 :
11 : #include "Sk4fGradientBase.h"
12 : #include "SkLinearGradient.h"
13 :
14 : class SkLinearGradient::
15 0 : LinearGradient4fContext final : public GradientShaderBase4fContext {
16 : public:
17 : LinearGradient4fContext(const SkLinearGradient&, const ContextRec&);
18 :
19 : void shadeSpan(int x, int y, SkPMColor dst[], int count) override;
20 : void shadeSpan4f(int x, int y, SkPM4f dst[], int count) override;
21 :
22 : protected:
23 : void mapTs(int x, int y, SkScalar ts[], int count) const override;
24 :
25 : bool onChooseBlitProcs(const SkImageInfo&, BlitState*) override;
26 :
27 : private:
28 : using INHERITED = GradientShaderBase4fContext;
29 :
30 : template<DstType, ApplyPremul, TileMode>
31 : class LinearIntervalProcessor;
32 :
33 : template <DstType dstType, ApplyPremul premul>
34 : void shadePremulSpan(int x, int y, typename DstTraits<dstType, premul>::Type[],
35 : int count) const;
36 :
37 : template <DstType dstType, ApplyPremul premul, SkShader::TileMode tileMode>
38 : void shadeSpanInternal(int x, int y, typename DstTraits<dstType, premul>::Type[],
39 : int count) const;
40 :
41 : const Sk4fGradientInterval* findInterval(SkScalar fx) const;
42 :
43 0 : bool isFast() const { return fDstToPosClass == kLinear_MatrixClass; }
44 :
45 : static void D32_BlitBW(BlitState*, int x, int y, const SkPixmap& dst, int count);
46 : static void D64_BlitBW(BlitState*, int x, int y, const SkPixmap& dst, int count);
47 :
48 : mutable const Sk4fGradientInterval* fCachedInterval;
49 : };
50 :
51 : #endif // Sk4fLinearGradient_DEFINED
|