From 689d02d4b480289aacaeb2da83b93d733cdfcb0f Mon Sep 17 00:00:00 2001 From: Cary Clark Date: Fri, 9 Mar 2018 16:55:35 -0500 Subject: harden pathmeasure and fix empty case change int to unsigned (just make it uniform, part of it was already unsigned) change path by pointer to path by value since it will be copied on write; fixes bug where path changes from underneath measure Allow empty paths to still initialize measure state. This fixes the GM failure from the earlier check-in attempt in CL 113269. R=reed@google.com Bug: skia:7675 Change-Id: I6296bbf75296ead826e54662b025277dd226e2b8 Reviewed-on: https://skia-review.googlesource.com/113246 Commit-Queue: Mike Reed Reviewed-by: Mike Reed --- include/core/SkPathMeasure.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'include/core/SkPathMeasure.h') diff --git a/include/core/SkPathMeasure.h b/include/core/SkPathMeasure.h index 1044f7eeb0..287c292aeb 100644 --- a/include/core/SkPathMeasure.h +++ b/include/core/SkPathMeasure.h @@ -84,10 +84,10 @@ public: private: SkPath::Iter fIter; - const SkPath* fPath; + SkPath fPath; SkScalar fTolerance; SkScalar fLength; // relative to the current contour - int fFirstPtIndex; // relative to the current contour + unsigned fFirstPtIndex; // relative to the current contour bool fIsClosed; // relative to the current contour bool fForceClosed; @@ -107,12 +107,12 @@ private: void buildSegments(); SkScalar compute_quad_segs(const SkPoint pts[3], SkScalar distance, - int mint, int maxt, int ptIndex); + int mint, int maxt, unsigned ptIndex); SkScalar compute_conic_segs(const SkConic&, SkScalar distance, int mint, const SkPoint& minPt, - int maxt, const SkPoint& maxPt, int ptIndex); + int maxt, const SkPoint& maxPt, unsigned ptIndex); SkScalar compute_cubic_segs(const SkPoint pts[3], SkScalar distance, - int mint, int maxt, int ptIndex); + int mint, int maxt, unsigned ptIndex); const Segment* distanceToSegment(SkScalar distance, SkScalar* t); bool quad_too_curvy(const SkPoint pts[3]); bool conic_too_curvy(const SkPoint& firstPt, const SkPoint& midTPt,const SkPoint& lastPt); -- cgit v1.2.3