blob: d5c38cfc6832a9121f73b3f0e58cd15f30528e83 [file] [log] [blame]
caryclark@google.com9e49fb62012-08-27 14:11:33 +00001/*
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.comd88e0892012-03-27 13:23:51 +00007#include "ShapeOps.h"
caryclark@google.com78e17132012-04-17 11:40:34 +00008#include "SkBitmap.h"
caryclark@google.com03f97062012-08-21 13:13:52 +00009#include "SkStream.h"
caryclark@google.com78e17132012-04-17 11:40:34 +000010#include <pthread.h>
caryclark@google.comcd4421d2012-03-01 19:16:31 +000011
caryclark@google.com59823f72012-08-09 18:17:47 +000012struct State4;
caryclark@google.com198e0542012-03-30 18:47:02 +000013
14//extern int comparePaths(const SkPath& one, const SkPath& two);
reed@google.combe584d72012-09-28 19:48:09 +000015extern int comparePaths(const SkPath& one, const SkPath& two, SkBitmap& bitmap);
caryclark@google.comcd4421d2012-03-01 19:16:31 +000016extern void comparePathsTiny(const SkPath& one, const SkPath& two);
caryclark@google.com752b60e2012-03-22 21:11:17 +000017extern bool drawAsciiPaths(const SkPath& one, const SkPath& two,
caryclark@google.com2e7f4c82012-03-20 21:11:59 +000018 bool drawPaths);
caryclark@google.com2e7f4c82012-03-20 21:11:59 +000019extern void showPath(const SkPath& path, const char* str = NULL);
caryclark@google.com198e0542012-03-30 18:47:02 +000020extern bool testSimplify(const SkPath& path, bool fill, SkPath& out,
reed@google.combe584d72012-09-28 19:48:09 +000021 SkBitmap& bitmap);
caryclark@google.com24bec792012-08-20 12:43:57 +000022extern bool testSimplifyx(SkPath& path, bool useXor, SkPath& out,
caryclark@google.com59823f72012-08-09 18:17:47 +000023 State4& state, const char* pathStr);
caryclark@google.com8dcf1142012-07-02 20:27:02 +000024extern bool testSimplifyx(const SkPath& path);
caryclark@google.com31143cf2012-11-09 22:14:19 +000025extern bool testShapeOp(const SkPath& a, const SkPath& b, const ShapeOp );
caryclark@google.com78e17132012-04-17 11:40:34 +000026
27struct State4 {
28 State4();
caryclark@google.com2ddff932012-08-07 21:25:27 +000029 static pthread_mutex_t addQueue;
30 static pthread_cond_t checkQueue;
31 pthread_cond_t initialized;
32 static State4* queue;
caryclark@google.com2ddff932012-08-07 21:25:27 +000033 pthread_t threadID;
34 int index;
35 bool done;
36 bool last;
caryclark@google.com78e17132012-04-17 11:40:34 +000037 int a;
38 int b;
39 int c;
caryclark@google.com59823f72012-08-09 18:17:47 +000040 int d; // sometimes 1 if abc_is_a_triangle
caryclark@google.com27c449a2012-07-27 18:26:38 +000041 int testsRun;
caryclark@google.com47580692012-07-23 12:14:49 +000042 char filename[256];
rmistry@google.comd6176b02012-08-23 18:14:13 +000043
caryclark@google.com78e17132012-04-17 11:40:34 +000044 SkBitmap bitmap;
caryclark@google.com78e17132012-04-17 11:40:34 +000045};
46
47void createThread(State4* statePtr, void* (*test)(void* ));
caryclark@google.com59823f72012-08-09 18:17:47 +000048int dispatchTest4(void* (*testFun)(void* ), int a, int b, int c, int d);
49void initializeTests(const char* testName, size_t testNameSize);
caryclark@google.com24bec792012-08-20 12:43:57 +000050void outputProgress(const State4& state, const char* pathStr, SkPath::FillType );
caryclark@google.comb1c42bb2012-11-16 13:16:41 +000051void outputProgress(const State4& state, const char* pathStr, ShapeOp op);
52void outputToStream(const State4& state, const char* pathStr, const char* pathPrefix,
53 const char* nameSuffix,
54 const char* testFunction, SkWStream& outFile);
caryclark@google.com59823f72012-08-09 18:17:47 +000055bool runNextTestSet(State4& state);
56int waitForCompletion();