caryclark@google.com | 9e49fb6 | 2012-08-27 14:11:33 +0000 | [diff] [blame] | 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 | */ |
caryclark@google.com | d88e089 | 2012-03-27 13:23:51 +0000 | [diff] [blame] | 7 | #include "ShapeOps.h" |
caryclark@google.com | 78e1713 | 2012-04-17 11:40:34 +0000 | [diff] [blame] | 8 | #include "SkBitmap.h" |
caryclark@google.com | 03f9706 | 2012-08-21 13:13:52 +0000 | [diff] [blame] | 9 | #include "SkStream.h" |
caryclark@google.com | 78e1713 | 2012-04-17 11:40:34 +0000 | [diff] [blame] | 10 | #include <pthread.h> |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 11 | |
caryclark@google.com | 59823f7 | 2012-08-09 18:17:47 +0000 | [diff] [blame] | 12 | struct State4; |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 13 | |
| 14 | //extern int comparePaths(const SkPath& one, const SkPath& two); |
reed@google.com | be584d7 | 2012-09-28 19:48:09 +0000 | [diff] [blame] | 15 | extern int comparePaths(const SkPath& one, const SkPath& two, SkBitmap& bitmap); |
caryclark@google.com | cd4421d | 2012-03-01 19:16:31 +0000 | [diff] [blame] | 16 | extern void comparePathsTiny(const SkPath& one, const SkPath& two); |
caryclark@google.com | 752b60e | 2012-03-22 21:11:17 +0000 | [diff] [blame] | 17 | extern bool drawAsciiPaths(const SkPath& one, const SkPath& two, |
caryclark@google.com | 2e7f4c8 | 2012-03-20 21:11:59 +0000 | [diff] [blame] | 18 | bool drawPaths); |
caryclark@google.com | d4c8e1e | 2013-03-05 14:13:13 +0000 | [diff] [blame] | 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); |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 23 | extern bool testSimplify(const SkPath& path, bool fill, SkPath& out, |
reed@google.com | be584d7 | 2012-09-28 19:48:09 +0000 | [diff] [blame] | 24 | SkBitmap& bitmap); |
caryclark@google.com | 24bec79 | 2012-08-20 12:43:57 +0000 | [diff] [blame] | 25 | extern bool testSimplifyx(SkPath& path, bool useXor, SkPath& out, |
caryclark@google.com | 59823f7 | 2012-08-09 18:17:47 +0000 | [diff] [blame] | 26 | State4& state, const char* pathStr); |
caryclark@google.com | 8dcf114 | 2012-07-02 20:27:02 +0000 | [diff] [blame] | 27 | extern bool testSimplifyx(const SkPath& path); |
caryclark@google.com | 31143cf | 2012-11-09 22:14:19 +0000 | [diff] [blame] | 28 | extern bool testShapeOp(const SkPath& a, const SkPath& b, const ShapeOp ); |
caryclark@google.com | 78e1713 | 2012-04-17 11:40:34 +0000 | [diff] [blame] | 29 | |
| 30 | struct State4 { |
| 31 | State4(); |
caryclark@google.com | 2ddff93 | 2012-08-07 21:25:27 +0000 | [diff] [blame] | 32 | static pthread_mutex_t addQueue; |
| 33 | static pthread_cond_t checkQueue; |
| 34 | pthread_cond_t initialized; |
| 35 | static State4* queue; |
caryclark@google.com | 2ddff93 | 2012-08-07 21:25:27 +0000 | [diff] [blame] | 36 | pthread_t threadID; |
| 37 | int index; |
| 38 | bool done; |
| 39 | bool last; |
caryclark@google.com | 78e1713 | 2012-04-17 11:40:34 +0000 | [diff] [blame] | 40 | int a; |
| 41 | int b; |
| 42 | int c; |
caryclark@google.com | 59823f7 | 2012-08-09 18:17:47 +0000 | [diff] [blame] | 43 | int d; // sometimes 1 if abc_is_a_triangle |
caryclark@google.com | 27c449a | 2012-07-27 18:26:38 +0000 | [diff] [blame] | 44 | int testsRun; |
caryclark@google.com | 4758069 | 2012-07-23 12:14:49 +0000 | [diff] [blame] | 45 | char filename[256]; |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 46 | |
caryclark@google.com | 78e1713 | 2012-04-17 11:40:34 +0000 | [diff] [blame] | 47 | SkBitmap bitmap; |
caryclark@google.com | 78e1713 | 2012-04-17 11:40:34 +0000 | [diff] [blame] | 48 | }; |
| 49 | |
| 50 | void createThread(State4* statePtr, void* (*test)(void* )); |
caryclark@google.com | 59823f7 | 2012-08-09 18:17:47 +0000 | [diff] [blame] | 51 | int dispatchTest4(void* (*testFun)(void* ), int a, int b, int c, int d); |
| 52 | void initializeTests(const char* testName, size_t testNameSize); |
caryclark@google.com | 24bec79 | 2012-08-20 12:43:57 +0000 | [diff] [blame] | 53 | void outputProgress(const State4& state, const char* pathStr, SkPath::FillType ); |
caryclark@google.com | b1c42bb | 2012-11-16 13:16:41 +0000 | [diff] [blame] | 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); |
caryclark@google.com | 59823f7 | 2012-08-09 18:17:47 +0000 | [diff] [blame] | 58 | bool runNextTestSet(State4& state); |
| 59 | int waitForCompletion(); |