Add an SkPath conic conversion utility.

Expose SkConic::chopIntoQuadsPOW2() as SkPath::ConvertConicToQuads().

BUG=chromium:315277
R=reed@google.com

Review URL: https://codereview.chromium.org/1484373002
This commit is contained in:
fmalita 2015-12-01 09:13:23 -08:00 committed by Commit bot
parent 0cbe7ee765
commit aa0df4e98d
2 changed files with 13 additions and 0 deletions

View File

@ -539,6 +539,13 @@ public:
return (FillType)(fill & 1);
}
/**
* Chop a conic into N quads, stored continguously in pts[], where
* N = 1 << pow2. The amount of storage needed is (1 + 2 * N)
*/
static int ConvertConicToQuads(const SkPoint& p0, const SkPoint& p1, const SkPoint& p2,
SkScalar w, SkPoint pts[], int pow2);
/**
* Returns true if the path specifies a rectangle.
*

View File

@ -2837,3 +2837,9 @@ bool SkPath::contains(SkScalar x, SkScalar y) const {
}
return SkToBool(w);
}
int SkPath::ConvertConicToQuads(const SkPoint& p0, const SkPoint& p1, const SkPoint& p2,
SkScalar w, SkPoint pts[], int pow2) {
const SkConic conic(p0, p1, p2, w);
return conic.chopIntoQuadsPOW2(pts, pow2);
}