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

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

Issue 2397473003: Harden degenerate gradient context handling (Closed)
Patch Set: Created 4 years, 2 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 | « include/core/SkMatrix.h ('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
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 Sk4fGradientBase_DEFINED 8 #ifndef Sk4fGradientBase_DEFINED
9 #define Sk4fGradientBase_DEFINED 9 #define Sk4fGradientBase_DEFINED
10 10
(...skipping 10 matching lines...) Expand all
21 GradientShaderBase4fContext : public SkShader::Context { 21 GradientShaderBase4fContext : public SkShader::Context {
22 public: 22 public:
23 GradientShaderBase4fContext(const SkGradientShaderBase&, 23 GradientShaderBase4fContext(const SkGradientShaderBase&,
24 const ContextRec&); 24 const ContextRec&);
25 25
26 uint32_t getFlags() const override { return fFlags; } 26 uint32_t getFlags() const override { return fFlags; }
27 27
28 void shadeSpan(int x, int y, SkPMColor dst[], int count) override; 28 void shadeSpan(int x, int y, SkPMColor dst[], int count) override;
29 void shadeSpan4f(int x, int y, SkPM4f dst[], int count) override; 29 void shadeSpan4f(int x, int y, SkPM4f dst[], int count) override;
30 30
31 bool isValid() const;
32
31 protected: 33 protected:
32 struct Interval { 34 struct Interval {
33 Interval(const Sk4f& c0, SkScalar p0, 35 Interval(const Sk4f& c0, SkScalar p0,
34 const Sk4f& c1, SkScalar p1); 36 const Sk4f& c1, SkScalar p1);
35 37
36 bool isZeroRamp() const { return fZeroRamp; } 38 bool isZeroRamp() const { return fZeroRamp; }
37 39
38 SkPM4f fC0, fDc; 40 SkPM4f fC0, fDc;
39 SkScalar fP0, fP1; 41 SkScalar fP0, fP1;
40 bool fZeroRamp; 42 bool fZeroRamp;
(...skipping 23 matching lines...) Expand all
64 template <DstType dstType, ApplyPremul premul> 66 template <DstType dstType, ApplyPremul premul>
65 void shadePremulSpan(int x, int y, typename DstTraits<dstType, premul>::Type [], 67 void shadePremulSpan(int x, int y, typename DstTraits<dstType, premul>::Type [],
66 int count) const; 68 int count) const;
67 69
68 template <DstType dstType, ApplyPremul premul, SkShader::TileMode tileMode> 70 template <DstType dstType, ApplyPremul premul, SkShader::TileMode tileMode>
69 void shadeSpanInternal(int x, int y, typename DstTraits<dstType, premul>::Ty pe[], 71 void shadeSpanInternal(int x, int y, typename DstTraits<dstType, premul>::Ty pe[],
70 int count) const; 72 int count) const;
71 }; 73 };
72 74
73 #endif // Sk4fGradientBase_DEFINED 75 #endif // Sk4fGradientBase_DEFINED
OLDNEW
« no previous file with comments | « include/core/SkMatrix.h ('k') | src/effects/gradients/Sk4fGradientBase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698