EdgeWalker_Test.h revision be584d782020fe0d413a9ab4e9a57a13b1ac1032
1/* 2 * Copyright 2012 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7#include "ShapeOps.h" 8#include "SkBitmap.h" 9#include "SkStream.h" 10#include <pthread.h> 11 12struct State4; 13 14//extern int comparePaths(const SkPath& one, const SkPath& two); 15extern int comparePaths(const SkPath& one, const SkPath& two, SkBitmap& bitmap); 16extern void comparePathsTiny(const SkPath& one, const SkPath& two); 17extern bool drawAsciiPaths(const SkPath& one, const SkPath& two, 18 bool drawPaths); 19extern void showPath(const SkPath& path, const char* str = NULL); 20extern bool testSimplify(const SkPath& path, bool fill, SkPath& out, 21 SkBitmap& bitmap); 22extern bool testSimplifyx(SkPath& path, bool useXor, SkPath& out, 23 State4& state, const char* pathStr); 24extern bool testSimplifyx(const SkPath& path); 25 26struct State4 { 27 State4(); 28 static pthread_mutex_t addQueue; 29 static pthread_cond_t checkQueue; 30 pthread_cond_t initialized; 31 static State4* queue; 32 pthread_t threadID; 33 int index; 34 bool done; 35 bool last; 36 int a; 37 int b; 38 int c; 39 int d; // sometimes 1 if abc_is_a_triangle 40 int testsRun; 41 char filename[256]; 42 43 SkBitmap bitmap; 44}; 45 46void createThread(State4* statePtr, void* (*test)(void* )); 47int dispatchTest4(void* (*testFun)(void* ), int a, int b, int c, int d); 48void initializeTests(const char* testName, size_t testNameSize); 49void outputProgress(const State4& state, const char* pathStr, SkPath::FillType ); 50void outputToStream(const State4& state, const char* pathStr, SkPath::FillType, SkWStream& outFile); 51bool runNextTestSet(State4& state); 52int waitForCompletion(); 53