Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: src/effects/gradients/Sk4fLinearGradient.h

Issue 1816883002: Refactor 4f gradients using trait templates (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/effects/gradients/Sk4fGradientPriv.h ('k') | src/effects/gradients/Sk4fLinearGradient.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef Sk4fLinearGradient_DEFINED 8 #ifndef Sk4fLinearGradient_DEFINED
9 #define Sk4fLinearGradient_DEFINED 9 #define Sk4fLinearGradient_DEFINED
10 10
11 #include "Sk4fGradientBase.h" 11 #include "Sk4fGradientBase.h"
12 #include "SkLinearGradient.h" 12 #include "SkLinearGradient.h"
13 13
14 class SkLinearGradient:: 14 class SkLinearGradient::
15 LinearGradient4fContext final : public GradientShaderBase4fContext { 15 LinearGradient4fContext final : public GradientShaderBase4fContext {
16 public: 16 public:
17 LinearGradient4fContext(const SkLinearGradient&, const ContextRec&); 17 LinearGradient4fContext(const SkLinearGradient&, const ContextRec&);
18 18
19 void shadeSpan(int x, int y, SkPMColor dst[], int count) override; 19 void shadeSpan(int x, int y, SkPMColor dst[], int count) override;
20 void shadeSpan4f(int x, int y, SkPM4f dst[], int count) override; 20 void shadeSpan4f(int x, int y, SkPM4f dst[], int count) override;
21 21
22 protected: 22 protected:
23 void mapTs(int x, int y, SkScalar ts[], int count) const override; 23 void mapTs(int x, int y, SkScalar ts[], int count) const override;
24 24
25 bool onChooseBlitProcs(const SkImageInfo&, BlitState*) override; 25 bool onChooseBlitProcs(const SkImageInfo&, BlitState*) override;
26 26
27 private: 27 private:
28 using INHERITED = GradientShaderBase4fContext; 28 using INHERITED = GradientShaderBase4fContext;
29 29
30 template<typename DstType, SkColorProfileType, TileMode> 30 template<DstType, TileMode>
31 class LinearIntervalProcessor; 31 class LinearIntervalProcessor;
32 32
33 template <typename DstType, SkColorProfileType, ApplyPremul> 33 template <DstType dstType, ApplyPremul premul>
34 void shadePremulSpan(int x, int y, DstType[], int count) const; 34 void shadePremulSpan(int x, int y, typename DstTraits<dstType, premul>::Type [],
35 int count) const;
35 36
36 template <typename DstType, SkColorProfileType, ApplyPremul, SkShader::TileM ode tileMode> 37 template <DstType dstType, ApplyPremul premul, SkShader::TileMode tileMode>
37 void shadeSpanInternal(int x, int y, DstType[], int count) const; 38 void shadeSpanInternal(int x, int y, typename DstTraits<dstType, premul>::Ty pe[],
39 int count) const;
38 40
39 const Interval* findInterval(SkScalar fx) const; 41 const Interval* findInterval(SkScalar fx) const;
40 42
41 bool isFast() const { return fDstToPosClass == kLinear_MatrixClass; } 43 bool isFast() const { return fDstToPosClass == kLinear_MatrixClass; }
42 44
43 static void D32_BlitBW(BlitState*, int x, int y, const SkPixmap& dst, int co unt); 45 static void D32_BlitBW(BlitState*, int x, int y, const SkPixmap& dst, int co unt);
44 static void D64_BlitBW(BlitState*, int x, int y, const SkPixmap& dst, int co unt); 46 static void D64_BlitBW(BlitState*, int x, int y, const SkPixmap& dst, int co unt);
45 47
46 mutable const Interval* fCachedInterval; 48 mutable const Interval* fCachedInterval;
47 }; 49 };
48 50
49 #endif // Sk4fLinearGradient_DEFINED 51 #endif // Sk4fLinearGradient_DEFINED
OLDNEW
« no previous file with comments | « src/effects/gradients/Sk4fGradientPriv.h ('k') | src/effects/gradients/Sk4fLinearGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698