diff options
author | 2016-01-21 07:07:02 -0800 | |
---|---|---|
committer | 2016-01-21 07:07:02 -0800 | |
commit | 1a7eb266644d2e1b0968dbca606ca0a91903419d (patch) | |
tree | 94db877ef4ed5be86f57163c26a997e6f76ca9d3 /include/core/SkPathMeasure.h | |
parent | 46895be9189f9d43f10fe5d57be6ca1eb1a795d2 (diff) |
resolution dependent path measure
When a dash is drawn through a canvas with a scaled up
matrix, path measure needs the pixel resolution through
the matrix to construct the dash with sufficient
resolution.
Pass the resolution through to path measure.
Replicate chrome bug in skia GM.
R=reed@google.com
BUG=530095
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1608353002
Review URL: https://codereview.chromium.org/1608353002
Diffstat (limited to 'include/core/SkPathMeasure.h')
-rw-r--r-- | include/core/SkPathMeasure.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/include/core/SkPathMeasure.h b/include/core/SkPathMeasure.h index 415ee2709c..c6bf288db2 100644 --- a/include/core/SkPathMeasure.h +++ b/include/core/SkPathMeasure.h @@ -20,8 +20,11 @@ public: for the lifetime of the measure object, or until setPath() is called with a different path (or null), since the measure object keeps a pointer to the path object (does not copy its data). + + resScale controls the precision of the measure. values > 1 increase the + precision (and possible slow down the computation). */ - SkPathMeasure(const SkPath& path, bool forceClosed); + SkPathMeasure(const SkPath& path, bool forceClosed, SkScalar resScale = 1); ~SkPathMeasure(); /** Reset the pathmeasure with the specified path. The path must remain valid @@ -82,6 +85,7 @@ public: private: SkPath::Iter fIter; const SkPath* fPath; + SkScalar fTolerance; SkScalar fLength; // relative to the current contour int fFirstPtIndex; // relative to the current contour bool fIsClosed; // relative to the current contour @@ -117,6 +121,12 @@ private: SkScalar compute_cubic_segs(const SkPoint pts[3], SkScalar distance, int mint, int maxt, int ptIndex); const Segment* distanceToSegment(SkScalar distance, SkScalar* t); + bool quad_too_curvy(const SkPoint pts[3]); +#ifndef SK_SUPPORT_LEGACY_CONIC_MEASURE + bool conic_too_curvy(const SkPoint& firstPt, const SkPoint& midTPt,const SkPoint& lastPt); +#endif + bool cheap_dist_exceeds_limit(const SkPoint& pt, SkScalar x, SkScalar y); + bool cubic_too_curvy(const SkPoint pts[4]); }; #endif |