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
12struct State4;
13
14//extern int comparePaths(const SkPath& one, const SkPath& two);
15extern int comparePaths(const SkPath& one, const SkPath& two, SkBitmap& bitmap);
16extern void comparePathsTiny(const SkPath& one, const SkPath& two);
17extern bool drawAsciiPaths(const SkPath& one, const SkPath& two,
18        bool drawPaths);
19extern 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);
23extern bool testSimplify(const SkPath& path, bool fill, SkPath& out,
24        SkBitmap& bitmap);
25extern bool testSimplifyx(SkPath& path, bool useXor, SkPath& out,
26        State4& state, const char* pathStr);
27extern bool testSimplifyx(const SkPath& path);
28extern bool testShapeOp(const SkPath& a, const SkPath& b, const ShapeOp );
29
30struct 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
50void createThread(State4* statePtr, void* (*test)(void* ));
51int dispatchTest4(void* (*testFun)(void* ), int a, int b, int c, int d);
52void initializeTests(const char* testName, size_t testNameSize);
53void outputProgress(const State4& state, const char* pathStr, SkPath::FillType );
54void 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);
58bool runNextTestSet(State4& state);
59int waitForCompletion();
60