From 4af6280aa366a02540f34c48f89ea73ce3d27974 Mon Sep 17 00:00:00 2001 From: "mike@reedtribe.org" Date: Sat, 13 Apr 2013 10:51:51 +0000 Subject: [PATCH] compute new weight in standard-form git-svn-id: http://skia.googlecode.com/svn/trunk@8671 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/core/SkGeometry.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/core/SkGeometry.cpp b/src/core/SkGeometry.cpp index f6b7e5f6f2..511c34e1aa 100644 --- a/src/core/SkGeometry.cpp +++ b/src/core/SkGeometry.cpp @@ -1453,6 +1453,14 @@ void SkRationalQuad::chopAt(SkScalar t, SkRationalQuad dst[2]) const { tmp2[2].projectDown(&dst[1].fPts[1]); dst[1].fPts[2] = fPts[2]; - dst[0].fW = tmp2[0].fZ; // ????? - dst[1].fW = tmp2[2].fZ; // ????? + // to put in "standard form", where w0 and w2 are both 1, we compute the + // new w1 as sqrt(w1*w1/w0*w2) + // or + // w1 /= sqrt(w0*w2) + // + // However, in our case, we know that for dst[0], w0 == 1, and for dst[1], w2 == 1 + // + SkScalar root = SkScalarSqrt(tmp2[1].fZ); + dst[0].fW = tmp2[0].fZ / root; + dst[1].fW = tmp2[2].fZ / root; }