blob: 5e8e7b7bf0c07bfd92bb92705d13af12b001cefd [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.comd4c8e1e2013-03-05 14:13:13 +000019extern void showOp(const ShapeOp op);
20extern void showPath(const SkPath& path, const char* str);
21extern void showPath(const SkPath& path);
22extern void showPathData(const SkPath& path);
caryclark@google.com198e0542012-03-30 18:47:02 +000023extern bool testSimplify(const SkPath& path, bool fill, SkPath& out,
reed@google.combe584d72012-09-28 19:48:09 +000024 SkBitmap& bitmap);
caryclark@google.com24bec792012-08-20 12:43:57 +000025extern bool testSimplifyx(SkPath& path, bool useXor, SkPath& out,
caryclark@google.com59823f72012-08-09 18:17:47 +000026 State4& state, const char* pathStr);
caryclark@google.com8dcf1142012-07-02 20:27:02 +000027extern bool testSimplifyx(const SkPath& path);
caryclark@google.com31143cf2012-11-09 22:14:19 +000028extern bool testShapeOp(const SkPath& a, const SkPath& b, const ShapeOp );
caryclark@google.com78e17132012-04-17 11:40:34 +000029
30struct State4 {
31 State4();
caryclark@google.com2ddff932012-08-07 21:25:27 +000032 static pthread_mutex_t addQueue;
33 static pthread_cond_t checkQueue;
34 pthread_cond_t initialized;
35 static State4* queue;
caryclark@google.com2ddff932012-08-07 21:25:27 +000036 pthread_t threadID;
37 int index;
38 bool done;
39 bool last;
caryclark@google.com78e17132012-04-17 11:40:34 +000040 int a;
41 int b;
42 int c;
caryclark@google.com59823f72012-08-09 18:17:47 +000043 int d; // sometimes 1 if abc_is_a_triangle
caryclark@google.com27c449a2012-07-27 18:26:38 +000044 int testsRun;
caryclark@google.com47580692012-07-23 12:14:49 +000045 char filename[256];
rmistry@google.comd6176b02012-08-23 18:14:13 +000046
caryclark@google.com78e17132012-04-17 11:40:34 +000047 SkBitmap bitmap;
caryclark@google.com78e17132012-04-17 11:40:34 +000048};
49
50void createThread(State4* statePtr, void* (*test)(void* ));
caryclark@google.com59823f72012-08-09 18:17:47 +000051int dispatchTest4(void* (*testFun)(void* ), int a, int b, int c, int d);
52void initializeTests(const char* testName, size_t testNameSize);
caryclark@google.com24bec792012-08-20 12:43:57 +000053void outputProgress(const State4& state, const char* pathStr, SkPath::FillType );
caryclark@google.comb1c42bb2012-11-16 13:16:41 +000054void outputProgress(const State4& state, const char* pathStr, ShapeOp op);
55void outputToStream(const State4& state, const char* pathStr, const char* pathPrefix,
56 const char* nameSuffix,
57 const char* testFunction, SkWStream& outFile);
caryclark@google.com59823f72012-08-09 18:17:47 +000058bool runNextTestSet(State4& state);
59int waitForCompletion();