diff options
author | 2012-04-17 11:40:34 +0000 | |
---|---|---|
committer | 2012-04-17 11:40:34 +0000 | |
commit | 78e17130f396d8b2157116c2504e357192f87ed1 (patch) | |
tree | d271b9dfdf378c33bc283afafc5519844367e6b4 /experimental/Intersection/EdgeWalker_TestUtility.cpp | |
parent | 95bfdedb371262905ae06b9c06b2c0f55869a441 (diff) |
work in progress
git-svn-id: http://skia.googlecode.com/svn/trunk@3702 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'experimental/Intersection/EdgeWalker_TestUtility.cpp')
-rw-r--r-- | experimental/Intersection/EdgeWalker_TestUtility.cpp | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/experimental/Intersection/EdgeWalker_TestUtility.cpp b/experimental/Intersection/EdgeWalker_TestUtility.cpp index 0844458ba3..d0b82c1695 100644 --- a/experimental/Intersection/EdgeWalker_TestUtility.cpp +++ b/experimental/Intersection/EdgeWalker_TestUtility.cpp @@ -5,6 +5,9 @@ #include "SkPaint.h" #include <algorithm> +#undef SkASSERT +#define SkASSERT(cond) while (!(cond)) { sk_throw(); } + static bool gShowPath = false; static bool gComparePaths = true; static bool gDrawLastAsciiPaths = true; @@ -170,6 +173,8 @@ static int scaledDrawTheSame(const SkPath& one, const SkPath& two, return errors; } +static int max = 0; + static int comparePaths(const SkPath& one, const SkPath& two, SkBitmap& bitmap, SkCanvas* canvas) { int errors = pathsDrawTheSame(one, two, bitmap, canvas); @@ -192,17 +197,22 @@ static int comparePaths(const SkPath& one, const SkPath& two, SkBitmap& bitmap, SkScalar xScale = std::max(80.0f / larger.width(), 1.0f); SkScalar yScale = std::max(60.0f / larger.height(), 1.0f); errors = scaledDrawTheSame(one, two, xScale, yScale, false, bitmap, canvas); - if (errors > 8) { + if (errors > 50) { scaledDrawTheSame(one, two, xScale, yScale, true, bitmap, canvas); } } - if (errors > 0) SkDebugf("\n%s errors=%d\n", __FUNCTION__, errors); - if (errors > 31 && gComparePathsAssert) { + if (errors > max) { + SkDebugf("\n%s errors=%d\n", __FUNCTION__, errors); + max = errors; + } + const int MAX_ERRORS = 100; + if (errors > MAX_ERRORS) SkDebugf("\n%s errors=%d\n", __FUNCTION__, errors); + if (errors > MAX_ERRORS && gComparePathsAssert) { showPath(one); showPath(two, "simplified:"); SkASSERT(0); } - return errors; + return errors > MAX_ERRORS ? errors : 0; } // doesn't work yet @@ -247,3 +257,23 @@ bool testSimplify(const SkPath& path, bool fill, SkPath& out, SkBitmap& bitmap, } return comparePaths(path, out, bitmap, canvas) == 0; } + +State4::State4() { + bitmap.setConfig(SkBitmap::kARGB_8888_Config, 150 * 2, 100); + bitmap.allocPixels(); + canvas = new SkCanvas(bitmap); +} + +void createThread(State4* statePtr, void* (*test)(void* )) { + int threadError = pthread_create(&statePtr->threadID, NULL, test, + (void*) statePtr); + SkASSERT(!threadError); +} + +void waitForCompletion(State4 threadState[], int& threadIndex) { + for (int index = 0; index < threadIndex; ++index) { + pthread_join(threadState[index].threadID, NULL); + } + SkDebugf("."); + threadIndex = 0; +} |