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

Side by Side Diff: src/utils/SkCurveMeasure.h

Issue 2221203002: Move seg_to to a new header, define SkSegType enum there (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rename addSegmentToPath to SkPathMeasure_segTo Created 4 years, 4 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/core/SkPathMeasurePriv.h ('k') | no next file » | 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 SkCurveMeasure_DEFINED 8 #ifndef SkCurveMeasure_DEFINED
9 #define SkCurveMeasure_DEFINED 9 #define SkCurveMeasure_DEFINED
10 10
11 #include "SkPathMeasurePriv.h"
11 #include "SkPoint.h" 12 #include "SkPoint.h"
12 #include "SkNx.h" 13 #include "SkNx.h"
13 14
14 // These are weights and abscissae for gaussian quadrature with weight function 15 // These are weights and abscissae for gaussian quadrature with weight function
15 // w(x) = 1 16 // w(x) = 1
16 static SkScalar weights8[8] = {0.3626837833783620f, 0.3626837833783620f, 17 static SkScalar weights8[8] = {0.3626837833783620f, 0.3626837833783620f,
17 0.3137066458778873f, 0.3137066458778873f, 18 0.3137066458778873f, 0.3137066458778873f,
18 0.2223810344533745f, 0.2223810344533745f, 19 0.2223810344533745f, 0.2223810344533745f,
19 0.1012285362903763f, 0.1012285362903763f}; 20 0.1012285362903763f, 0.1012285362903763f};
20 static SkScalar absc8[8] = {-0.1834346424956498f, 0.1834346424956498f, 21 static SkScalar absc8[8] = {-0.1834346424956498f, 0.1834346424956498f,
21 -0.5255324099163290f, 0.5255324099163290f, 22 -0.5255324099163290f, 0.5255324099163290f,
22 -0.7966664774136267f, 0.7966664774136267f, 23 -0.7966664774136267f, 0.7966664774136267f,
23 -0.9602898564975363f, 0.9602898564975363f}; 24 -0.9602898564975363f, 0.9602898564975363f};
24 25
25 static Sk8f weights = Sk8f::Load(weights8); 26 static Sk8f weights = Sk8f::Load(weights8);
26 static Sk8f absc = 0.5f*(Sk8f::Load(absc8) + 1.0f); 27 static Sk8f absc = 0.5f*(Sk8f::Load(absc8) + 1.0f);
27 28
28 29
29 // this is the same enum as in SkPathMeasure but it doesn't have a name there
30 enum SkSegType {
31 kLine_SegType,
32 kQuad_SegType,
33 kCubic_SegType,
34 kConic_SegType,
35 };
36
37 class ArcLengthIntegrator { 30 class ArcLengthIntegrator {
38 public: 31 public:
39 ArcLengthIntegrator() {} 32 ArcLengthIntegrator() {}
40 ArcLengthIntegrator(const SkPoint* pts, SkSegType segType); 33 ArcLengthIntegrator(const SkPoint* pts, SkSegType segType);
41 SkScalar computeLength(SkScalar t); 34 SkScalar computeLength(SkScalar t);
42 35
43 private: 36 private:
44 SkSegType fSegType; 37 SkSegType fSegType;
45 38
46 // precomputed coefficients for derivatives in Horner form 39 // precomputed coefficients for derivatives in Horner form
(...skipping 25 matching lines...) Expand all
72 SkSegType fSegType; 65 SkSegType fSegType;
73 SkPoint fPts[4]; 66 SkPoint fPts[4];
74 SkScalar fLength = -1.0f; 67 SkScalar fLength = -1.0f;
75 ArcLengthIntegrator fIntegrator; 68 ArcLengthIntegrator fIntegrator;
76 69
77 // for debug purposes 70 // for debug purposes
78 int fIters; 71 int fIters;
79 }; 72 };
80 73
81 #endif // SkCurveMeasure_DEFINED 74 #endif // SkCurveMeasure_DEFINED
OLDNEW
« no previous file with comments | « src/core/SkPathMeasurePriv.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698