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 | 2e7f4c8 | 2012-03-20 21:11:59 +0000 | [diff] [blame] | 19 | extern void showPath(const SkPath& path, const char* str = NULL); |
caryclark@google.com | 198e054 | 2012-03-30 18:47:02 +0000 | [diff] [blame] | 20 | extern bool testSimplify(const SkPath& path, bool fill, SkPath& out, |
reed@google.com | be584d7 | 2012-09-28 19:48:09 +0000 | [diff] [blame] | 21 | SkBitmap& bitmap); |
caryclark@google.com | 24bec79 | 2012-08-20 12:43:57 +0000 | [diff] [blame] | 22 | extern bool testSimplifyx(SkPath& path, bool useXor, SkPath& out, |
caryclark@google.com | 59823f7 | 2012-08-09 18:17:47 +0000 | [diff] [blame] | 23 | State4& state, const char* pathStr); |
caryclark@google.com | 8dcf114 | 2012-07-02 20:27:02 +0000 | [diff] [blame] | 24 | extern bool testSimplifyx(const SkPath& path); |
caryclark@google.com | 31143cf | 2012-11-09 22:14:19 +0000 | [diff] [blame] | 25 | extern bool testShapeOp(const SkPath& a, const SkPath& b, const ShapeOp ); |
caryclark@google.com | 78e1713 | 2012-04-17 11:40:34 +0000 | [diff] [blame] | 26 | |
| 27 | struct State4 { |
| 28 | State4(); |
caryclark@google.com | 2ddff93 | 2012-08-07 21:25:27 +0000 | [diff] [blame] | 29 | static pthread_mutex_t addQueue; |
| 30 | static pthread_cond_t checkQueue; |
| 31 | pthread_cond_t initialized; |
| 32 | static State4* queue; |
caryclark@google.com | 2ddff93 | 2012-08-07 21:25:27 +0000 | [diff] [blame] | 33 | pthread_t threadID; |
| 34 | int index; |
| 35 | bool done; |
| 36 | bool last; |
caryclark@google.com | 78e1713 | 2012-04-17 11:40:34 +0000 | [diff] [blame] | 37 | int a; |
| 38 | int b; |
| 39 | int c; |
caryclark@google.com | 59823f7 | 2012-08-09 18:17:47 +0000 | [diff] [blame] | 40 | int d; // sometimes 1 if abc_is_a_triangle |
caryclark@google.com | 27c449a | 2012-07-27 18:26:38 +0000 | [diff] [blame] | 41 | int testsRun; |
caryclark@google.com | 4758069 | 2012-07-23 12:14:49 +0000 | [diff] [blame] | 42 | char filename[256]; |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 43 | |
caryclark@google.com | 78e1713 | 2012-04-17 11:40:34 +0000 | [diff] [blame] | 44 | SkBitmap bitmap; |
caryclark@google.com | 78e1713 | 2012-04-17 11:40:34 +0000 | [diff] [blame] | 45 | }; |
| 46 | |
| 47 | void createThread(State4* statePtr, void* (*test)(void* )); |
caryclark@google.com | 59823f7 | 2012-08-09 18:17:47 +0000 | [diff] [blame] | 48 | int dispatchTest4(void* (*testFun)(void* ), int a, int b, int c, int d); |
| 49 | void initializeTests(const char* testName, size_t testNameSize); |
caryclark@google.com | 24bec79 | 2012-08-20 12:43:57 +0000 | [diff] [blame] | 50 | void outputProgress(const State4& state, const char* pathStr, SkPath::FillType ); |
caryclark@google.com | b1c42bb | 2012-11-16 13:16:41 +0000 | [diff] [blame^] | 51 | void outputProgress(const State4& state, const char* pathStr, ShapeOp op); |
| 52 | void outputToStream(const State4& state, const char* pathStr, const char* pathPrefix, |
| 53 | const char* nameSuffix, |
| 54 | const char* testFunction, SkWStream& outFile); |
caryclark@google.com | 59823f7 | 2012-08-09 18:17:47 +0000 | [diff] [blame] | 55 | bool runNextTestSet(State4& state); |
| 56 | int waitForCompletion(); |