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

Side by Side Diff: include/core/SkPathMeasure.h

Issue 1608353002: resolution dependent path measure (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix gpu path for dashing Created 4 years, 11 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/SkDraw.h ('k') | include/core/SkStrokeRec.h » ('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 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 SkPathMeasure_DEFINED 8 #ifndef SkPathMeasure_DEFINED
9 #define SkPathMeasure_DEFINED 9 #define SkPathMeasure_DEFINED
10 10
11 #include "SkPath.h" 11 #include "SkPath.h"
12 #include "SkTDArray.h" 12 #include "SkTDArray.h"
13 13
14 struct SkConic; 14 struct SkConic;
15 15
16 class SK_API SkPathMeasure : SkNoncopyable { 16 class SK_API SkPathMeasure : SkNoncopyable {
17 public: 17 public:
18 SkPathMeasure(); 18 SkPathMeasure();
19 /** Initialize the pathmeasure with the specified path. The path must remain valid 19 /** Initialize the pathmeasure with the specified path. The path must remain valid
20 for the lifetime of the measure object, or until setPath() is called wit h 20 for the lifetime of the measure object, or until setPath() is called wit h
21 a different path (or null), since the measure object keeps a pointer to the 21 a different path (or null), since the measure object keeps a pointer to the
22 path object (does not copy its data). 22 path object (does not copy its data).
23 */ 23 */
24 SkPathMeasure(const SkPath& path, bool forceClosed); 24 SkPathMeasure(const SkPath& path, bool forceClosed, SkScalar resScale = 1);
reed1 2016/01/21 14:33:59 // resScale controls the precision of the measure.
caryclark 2016/01/21 14:52:57 Done.
25 ~SkPathMeasure(); 25 ~SkPathMeasure();
26 26
27 /** Reset the pathmeasure with the specified path. The path must remain vali d 27 /** Reset the pathmeasure with the specified path. The path must remain vali d
28 for the lifetime of the measure object, or until setPath() is called wit h 28 for the lifetime of the measure object, or until setPath() is called wit h
29 a different path (or null), since the measure object keeps a pointer to the 29 a different path (or null), since the measure object keeps a pointer to the
30 path object (does not copy its data). 30 path object (does not copy its data).
31 */ 31 */
32 void setPath(const SkPath*, bool forceClosed); 32 void setPath(const SkPath*, bool forceClosed);
33 33
34 /** Return the total length of the current contour, or 0 if no path 34 /** Return the total length of the current contour, or 0 if no path
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 */ 75 */
76 bool nextContour(); 76 bool nextContour();
77 77
78 #ifdef SK_DEBUG 78 #ifdef SK_DEBUG
79 void dump(); 79 void dump();
80 #endif 80 #endif
81 81
82 private: 82 private:
83 SkPath::Iter fIter; 83 SkPath::Iter fIter;
84 const SkPath* fPath; 84 const SkPath* fPath;
85 SkScalar fInvResScale;
reed1 2016/01/21 14:33:59 nit: rename to fTolerance?
caryclark 2016/01/21 14:52:57 Done.
85 SkScalar fLength; // relative to the current contour 86 SkScalar fLength; // relative to the current contour
86 int fFirstPtIndex; // relative to the current contour 87 int fFirstPtIndex; // relative to the current contour
87 bool fIsClosed; // relative to the current contour 88 bool fIsClosed; // relative to the current contour
88 bool fForceClosed; 89 bool fForceClosed;
89 90
90 struct Segment { 91 struct Segment {
91 SkScalar fDistance; // total distance up to this point 92 SkScalar fDistance; // total distance up to this point
92 unsigned fPtIndex; // index into the fPts array 93 unsigned fPtIndex; // index into the fPts array
93 #ifdef SK_SUPPORT_LEGACY_PATH_MEASURE_TVALUE 94 #ifdef SK_SUPPORT_LEGACY_PATH_MEASURE_TVALUE
94 unsigned fTValue : 15; 95 unsigned fTValue : 15;
(...skipping 15 matching lines...) Expand all
110 #ifdef SK_SUPPORT_LEGACY_CONIC_MEASURE 111 #ifdef SK_SUPPORT_LEGACY_CONIC_MEASURE
111 SkScalar compute_conic_segs(const SkConic&, SkScalar distance, int mint, int maxt, int ptIndex); 112 SkScalar compute_conic_segs(const SkConic&, SkScalar distance, int mint, int maxt, int ptIndex);
112 #else 113 #else
113 SkScalar compute_conic_segs(const SkConic&, SkScalar distance, 114 SkScalar compute_conic_segs(const SkConic&, SkScalar distance,
114 int mint, const SkPoint& minPt, 115 int mint, const SkPoint& minPt,
115 int maxt, const SkPoint& maxPt, int ptIndex); 116 int maxt, const SkPoint& maxPt, int ptIndex);
116 #endif 117 #endif
117 SkScalar compute_cubic_segs(const SkPoint pts[3], SkScalar distance, 118 SkScalar compute_cubic_segs(const SkPoint pts[3], SkScalar distance,
118 int mint, int maxt, int ptIndex); 119 int mint, int maxt, int ptIndex);
119 const Segment* distanceToSegment(SkScalar distance, SkScalar* t); 120 const Segment* distanceToSegment(SkScalar distance, SkScalar* t);
121 bool quad_too_curvy(const SkPoint pts[3]);
122 #ifndef SK_SUPPORT_LEGACY_CONIC_MEASURE
123 bool conic_too_curvy(const SkPoint& firstPt, const SkPoint& midTPt,const SkP oint& lastPt);
124 #endif
125 bool cheap_dist_exceeds_limit(const SkPoint& pt, SkScalar x, SkScalar y);
126 bool cubic_too_curvy(const SkPoint pts[4]);
120 }; 127 };
121 128
122 #endif 129 #endif
OLDNEW
« no previous file with comments | « include/core/SkDraw.h ('k') | include/core/SkStrokeRec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698