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

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

Issue 1688543002: Initial linear gradient 4f impl (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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 | « gyp/gmslides.gypi ('k') | src/effects/gradients/Sk4fGradientBase.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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 Sk4fGradientBase_DEFINED
9 #define Sk4fGradientBase_DEFINED
10
11 #include "SkColor.h"
12 #include "SkGradientShaderPriv.h"
13 #include "SkMatrix.h"
14 #include "SkNx.h"
15 #include "SkPM4f.h"
16 #include "SkShader.h"
17 #include "SkTArray.h"
18
19 class SkGradientShaderBase::
20 GradientShaderBase4fContext : public SkShader::Context {
21 public:
22 GradientShaderBase4fContext(const SkGradientShaderBase&,
23 const ContextRec&);
24
25 uint32_t getFlags() const override { return fFlags; }
26
27 protected:
28 struct Interval {
29 Interval(SkPMColor c0, SkScalar p0,
30 SkPMColor c1, SkScalar p1,
31 const Sk4f& componentScale);
32 Interval(const Sk4f& c0, const Sk4f& dc,
33 SkScalar p0, SkScalar p1);
34
35 bool isZeroRamp() const { return fZeroRamp; }
36
37 // true when fx is in [p0,p1)
38 bool contains(SkScalar fx) const;
39
40 SkPM4f fC0, fDc;
41 SkScalar fP0, fP1;
42 bool fZeroRamp;
43 };
44
45 const Interval* findInterval(SkScalar fx) const;
46
47 SkSTArray<8, Interval, true> fIntervals;
48 SkMatrix fDstToPos;
49 SkMatrix::MapXYProc fDstToPosProc;
50 uint8_t fDstToPosClass;
51 uint8_t fFlags;
52 bool fDither;
53 bool fColorsArePremul;
54
55 private:
56 using INHERITED = SkShader::Context;
57
58 mutable const Interval* fCachedInterval;
59 };
60
61 #endif // Sk4fGradientBase_DEFINED
OLDNEW
« no previous file with comments | « gyp/gmslides.gypi ('k') | src/effects/gradients/Sk4fGradientBase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698