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 12 struct State4; 13 14 //extern int comparePaths(const SkPath& one, const SkPath& two); 15 extern int comparePaths(const SkPath& one, const SkPath& two, SkBitmap& bitmap); 16 extern void comparePathsTiny(const SkPath& one, const SkPath& two); 17 extern bool drawAsciiPaths(const SkPath& one, const SkPath& two, 18 bool drawPaths); 19 extern void showOp(const ShapeOp op); 20 extern void showPath(const SkPath& path, const char* str); 21 extern void showPath(const SkPath& path); 22 extern void showPathData(const SkPath& path); 23 extern bool testSimplify(const SkPath& path, bool fill, SkPath& out, 24 SkBitmap& bitmap); 25 extern bool testSimplifyx(SkPath& path, bool useXor, SkPath& out, 26 State4& state, const char* pathStr); 27 extern bool testSimplifyx(const SkPath& path); 28 extern bool testShapeOp(const SkPath& a, const SkPath& b, const ShapeOp ); 29 30 struct State4 { 31 State4(); 32 static pthread_mutex_t addQueue; 33 static pthread_cond_t checkQueue; 34 pthread_cond_t initialized; 35 static State4* queue; 36 pthread_t threadID; 37 int index; 38 bool done; 39 bool last; 40 int a; 41 int b; 42 int c; 43 int d; // sometimes 1 if abc_is_a_triangle 44 int testsRun; 45 char filename[256]; 46 47 SkBitmap bitmap; 48 }; 49 50 void createThread(State4* statePtr, void* (*test)(void* )); 51 int dispatchTest4(void* (*testFun)(void* ), int a, int b, int c, int d); 52 void initializeTests(const char* testName, size_t testNameSize); 53 void outputProgress(const State4& state, const char* pathStr, SkPath::FillType ); 54 void outputProgress(const State4& state, const char* pathStr, ShapeOp op); 55 void outputToStream(const State4& state, const char* pathStr, const char* pathPrefix, 56 const char* nameSuffix, 57 const char* testFunction, SkWStream& outFile); 58 bool runNextTestSet(State4& state); 59 int waitForCompletion(); 60