diff options
author | reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2009-08-28 20:06:54 +0000 |
---|---|---|
committer | reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2009-08-28 20:06:54 +0000 |
commit | a964028843ec3f69b3b2e556426ff881d1fcb4b2 (patch) | |
tree | 5f4b9f35200f31d6e5cbdf651f548f947126c852 /samplecode/SamplePath.cpp | |
parent | 28937283e16928a562b3f9e19908db51bbb89ff9 (diff) |
Detect when we no longer have a valid range for chopping due to finite float
precision, and just return a degenerate cubic at the end.
git-svn-id: http://skia.googlecode.com/svn/trunk@341 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'samplecode/SamplePath.cpp')
-rw-r--r-- | samplecode/SamplePath.cpp | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/samplecode/SamplePath.cpp b/samplecode/SamplePath.cpp index b39e65c6f5..e63c513064 100644 --- a/samplecode/SamplePath.cpp +++ b/samplecode/SamplePath.cpp @@ -14,14 +14,38 @@ #include "SkTime.h" #include "SkTypeface.h" +#include "SkGeometry.h" + +// http://code.google.com/p/skia/issues/detail?id=32 +static void test_cubic() { + SkPoint src[4] = { + { 556.25000, 523.03003 }, + { 556.23999, 522.96002 }, + { 556.21997, 522.89001 }, + { 556.21997, 522.82001 } + }; + SkPoint dst[11]; + dst[10].set(42, -42); // one past the end, that we don't clobber these + SkScalar tval[] = { 0.33333334f, 0.99999994f }; + + SkChopCubicAt(src, dst, tval, 2); + +#if 0 + for (int i = 0; i < 11; i++) { + SkDebugf("--- %d [%g %g]\n", i, dst[i].fX, dst[i].fY); + } +#endif +} + class PathView : public SkView { public: int fDStroke, fStroke, fMinStroke, fMaxStroke; SkPath fPath[6]; bool fShowHairline; - PathView() - { + PathView() { + test_cubic(); + fShowHairline = false; fDStroke = 1; |