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

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

Issue 2233683004: Revert 386ba54 and 4ab47e0 : perf debug assert. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « no previous file | src/utils/SkCurveMeasure.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 SkCurveMeasure_DEFINED 8 #ifndef SkCurveMeasure_DEFINED
9 #define SkCurveMeasure_DEFINED 9 #define SkCurveMeasure_DEFINED
10 10
(...skipping 26 matching lines...) Expand all
37 SkSegType fSegType; 37 SkSegType fSegType;
38 38
39 // precomputed coefficients for derivatives in Horner form 39 // precomputed coefficients for derivatives in Horner form
40 Sk8f xCoeff[3]; 40 Sk8f xCoeff[3];
41 Sk8f yCoeff[3]; 41 Sk8f yCoeff[3];
42 }; 42 };
43 43
44 class SkCurveMeasure { 44 class SkCurveMeasure {
45 public: 45 public:
46 SkCurveMeasure() {} 46 SkCurveMeasure() {}
47
48 // Almost exactly the same as in SkPath::Iter:
49 // kLine_SegType -> 2 points: start end
50 // kQuad_SegType -> 3 points: start control end
51 // kCubic_SegType -> 4 points: start control1 control2 end
52 // kConic_SegType -> 4 points: start control end (w, w)
53 //
54 // i.e. the only difference is that the conic's last point is a point
55 // consisting of the w value twice
56 SkCurveMeasure(const SkPoint* pts, SkSegType segType); 47 SkCurveMeasure(const SkPoint* pts, SkSegType segType);
57 48
58 SkScalar getTime(SkScalar targetLength); 49 SkScalar getTime(SkScalar targetLength);
59 void getPosTanTime(SkScalar distance, SkPoint* pos, SkVector* tan, SkScalar* time); 50 void getPosTanTime(SkScalar distance, SkPoint* pos, SkVector* tan, SkScalar* time);
60 SkScalar getLength(); 51 SkScalar getLength();
61 52
62 private: 53 private:
54 SkPoint evaluateQuad(SkScalar t);
55 SkVector evaluateQuadDerivative(SkScalar t);
56 //SkPoint evaluate_cubic(SkScalar t);
57 //SkVector evaluate_cubic_derivative(SkScalar t);
58 //SkPoint evaluate_conic(SkScalar t);
59 //SkVector evaluate_conic_derivative(SkScalar t);
60
63 const SkScalar kTolerance = 0.0001f; 61 const SkScalar kTolerance = 0.0001f;
64 const int kNewtonIters = 5; 62 const int kNewtonIters = 5;
65 const int kBisectIters = 5; 63 const int kBisectIters = 5;
66 64
67 SkSegType fSegType; 65 SkSegType fSegType;
68 SkPoint fPts[4]; 66 SkPoint fPts[4];
69 SkScalar fLength = -1.0f; 67 SkScalar fLength = -1.0f;
70 ArcLengthIntegrator fIntegrator; 68 ArcLengthIntegrator fIntegrator;
71 69
72 // for debug purposes 70 // for debug purposes
73 int fIters; 71 int fIters;
74 }; 72 };
75 73
76 #endif // SkCurveMeasure_DEFINED 74 #endif // SkCurveMeasure_DEFINED
OLDNEW
« no previous file with comments | « no previous file | src/utils/SkCurveMeasure.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698