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

Side by Side Diff: src/effects/gradients/SkLinearGradient.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
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 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 SkLinearGradient_DEFINED 8 #ifndef SkLinearGradient_DEFINED
9 #define SkLinearGradient_DEFINED 9 #define SkLinearGradient_DEFINED
10 10
11 #include "SkGradientShaderPriv.h" 11 #include "SkGradientShaderPriv.h"
12 #include "SkNx.h" 12 #include "SkNx.h"
13 13
14 struct Sk4fStorage { 14 struct Sk4fStorage {
15 float fArray[4]; 15 float fArray[4];
16 16
17 operator Sk4f() const { 17 operator Sk4f() const {
18 return Sk4f::Load(fArray); 18 return Sk4f::Load(fArray);
19 } 19 }
20 20
21 Sk4fStorage& operator=(const Sk4f& src) { 21 Sk4fStorage& operator=(const Sk4f& src) {
22 src.store(fArray); 22 src.store(fArray);
23 return *this; 23 return *this;
24 } 24 }
25 }; 25 };
26 26
27 class SkLinearGradient : public SkGradientShaderBase { 27 class SkLinearGradient : public SkGradientShaderBase {
28 public: 28 public:
29 enum {
30 // Temp flag for testing the 4f impl.
31 kForce4fContext_PrivateFlag = 1 << 7,
32 };
33
29 SkLinearGradient(const SkPoint pts[2], const Descriptor&); 34 SkLinearGradient(const SkPoint pts[2], const Descriptor&);
30 35
31 size_t contextSize() const override; 36 size_t contextSize() const override;
32 37
33 class LinearGradientContext : public SkGradientShaderBase::GradientShaderBas eContext { 38 class LinearGradientContext : public SkGradientShaderBase::GradientShaderBas eContext {
34 public: 39 public:
35 LinearGradientContext(const SkLinearGradient&, const ContextRec&); 40 LinearGradientContext(const SkLinearGradient&, const ContextRec&);
36 41
37 void shadeSpan(int x, int y, SkPMColor dstC[], int count) override; 42 void shadeSpan(int x, int y, SkPMColor dstC[], int count) override;
38 43
(...skipping 23 matching lines...) Expand all
62 67
63 SK_TO_STRING_OVERRIDE() 68 SK_TO_STRING_OVERRIDE()
64 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLinearGradient) 69 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLinearGradient)
65 70
66 protected: 71 protected:
67 SkLinearGradient(SkReadBuffer& buffer); 72 SkLinearGradient(SkReadBuffer& buffer);
68 void flatten(SkWriteBuffer& buffer) const override; 73 void flatten(SkWriteBuffer& buffer) const override;
69 Context* onCreateContext(const ContextRec&, void* storage) const override; 74 Context* onCreateContext(const ContextRec&, void* storage) const override;
70 75
71 private: 76 private:
77 class LinearGradient4fContext;
78
72 friend class SkGradientShader; 79 friend class SkGradientShader;
73 typedef SkGradientShaderBase INHERITED; 80 typedef SkGradientShaderBase INHERITED;
74 const SkPoint fStart; 81 const SkPoint fStart;
75 const SkPoint fEnd; 82 const SkPoint fEnd;
76 }; 83 };
77 84
78 #endif 85 #endif
OLDNEW
« no previous file with comments | « src/effects/gradients/SkGradientShaderPriv.h ('k') | src/effects/gradients/SkLinearGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698