From a964028843ec3f69b3b2e556426ff881d1fcb4b2 Mon Sep 17 00:00:00 2001 From: "reed@android.com" Date: Fri, 28 Aug 2009 20:06:54 +0000 Subject: http://code.google.com/p/skia/issues/detail?id=32 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 --- samplecode/SamplePath.cpp | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'samplecode/SamplePath.cpp') 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; -- cgit v1.2.3