diff options
author | caryclark <caryclark@google.com> | 2015-10-21 04:02:51 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-21 04:02:51 -0700 |
commit | f428df1be3e96d3f8970d0f7f415b862f7da5404 (patch) | |
tree | f31420ca0e99b23383577dc8ebdce3167b637317 /src/pathops/SkPathOpsConic.cpp | |
parent | 74deb981d5e9c11c88fe431e78166d6cf8dacc1a (diff) |
Revert of path ops: fix conic weight and partial coincidence (patchset #5 id:80001 of https://codereview.chromium.org/1413763002/ )
Reason for revert:
path ops change breaks svg clipping layout tests -- conic is now more accurate, changing edge of circle in clip
These need to be rebaselined
svg/clip-path/clip-path-child-clipped.svg
svg/clip-path/clip-path-nonzero.svg
svg/clip-path/clip-path-evenodd-nonzero.svg
svg/clip-path/clip-path-nonzero-evenodd.svg
Original issue's description:
> The remaining 1m skp bugs are asserts that can be harmlessly
> suppressed and bugs around conics.
>
> The conic calculation for a subdivided w was just wrong.
>
> Also added debugging to template intersection to initialize
> reused structures and dump additional data.
>
> TBR=reed@google.com
>
> Committed: https://skia.googlesource.com/skia/+/ef33b1e739b23a1201100ff17a572da85b03d9af
TBR=
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Review URL: https://codereview.chromium.org/1408923003
Diffstat (limited to 'src/pathops/SkPathOpsConic.cpp')
-rw-r--r-- | src/pathops/SkPathOpsConic.cpp | 34 |
1 files changed, 6 insertions, 28 deletions
diff --git a/src/pathops/SkPathOpsConic.cpp b/src/pathops/SkPathOpsConic.cpp index f80af036ee..013136bd82 100644 --- a/src/pathops/SkPathOpsConic.cpp +++ b/src/pathops/SkPathOpsConic.cpp @@ -96,27 +96,7 @@ SkDPoint SkDConic::ptAtT(double t) const { return result; } -/* see quad subdivide for point rationale */ -/* w rationale : the mid point between t1 and t2 could be determined from the computed a/b/c - values if the computed w was known. Since we know the mid point at (t1+t2)/2, we'll assume - that it is the same as the point on the new curve t==(0+1)/2. - - d / dz == conic_poly(dst, unknownW, .5) / conic_weight(unknownW, .5); - - conic_poly(dst, unknownW, .5) - = a / 4 + (b * unknownW) / 2 + c / 4 - = (a + c) / 4 + (bx * unknownW) / 2 - - conic_weight(unknownW, .5) - = unknownW / 2 + 1 / 2 - - d / dz == ((a + c) / 2 + b * unknownW) / (unknownW + 1) - d / dz * (unknownW + 1) == (a + c) / 2 + b * unknownW - unknownW = ((a + c) / 2 - d / dz) / (d / dz - b) - - Thus, w is the ratio of the distance from the mid of end points to the on-curve point, and the - distance of the on-curve point to the control point. - */ +/* see quad subdivide for rationale */ SkDConic SkDConic::subDivide(double t1, double t2) const { double ax, ay, az; if (t1 == 0) { @@ -153,13 +133,11 @@ SkDConic SkDConic::subDivide(double t1, double t2) const { double bx = 2 * dx - (ax + cx) / 2; double by = 2 * dy - (ay + cy) / 2; double bz = 2 * dz - (az + cz) / 2; - SkDConic dst = {{{{ax / az, ay / az}, {bx / bz, by / bz}, {cx / cz, cy / cz}}}, 0 }; - SkDPoint dMidAC = { (dst.fPts[0].fX + dst.fPts[2].fX) / 2, - (dst.fPts[0].fY + dst.fPts[2].fY) / 2 }; - SkDPoint dMid = { dx / dz, dy / dz }; - SkDVector dWNumer = dMidAC - dMid; - SkDVector dWDenom = dMid - dst.fPts[1]; - dst.fWeight = dWNumer.length() / dWDenom.length(); + double dt = t2 - t1; + double dt_1 = 1 - dt; + SkScalar w = SkDoubleToScalar((1 + dt * (fWeight - 1)) + / sqrt(dt * dt + 2 * dt * dt_1 * fWeight + dt_1 * dt_1)); + SkDConic dst = {{{{ax / az, ay / az}, {bx / bz, by / bz}, {cx / cz, cy / cz}}}, w }; return dst; } |