EdgeWalker_Test.h revision d6176b0dcacb124539e0cfd051e6d93a9782f020
1
2
3#include "ShapeOps.h"
4#include "SkBitmap.h"
5#include "SkStream.h"
6#include <pthread.h>
7
8class SkCanvas;
9struct State4;
10
11//extern int comparePaths(const SkPath& one, const SkPath& two);
12extern int comparePaths(const SkPath& one, const SkPath& two, SkBitmap& bitmap,
13        SkCanvas* canvas);
14extern void comparePathsTiny(const SkPath& one, const SkPath& two);
15extern bool drawAsciiPaths(const SkPath& one, const SkPath& two,
16        bool drawPaths);
17extern void showPath(const SkPath& path, const char* str = NULL);
18extern bool testSimplify(const SkPath& path, bool fill, SkPath& out,
19        SkBitmap& bitmap, SkCanvas* canvas = 0);
20extern bool testSimplifyx(SkPath& path, bool useXor, SkPath& out,
21        State4& state, const char* pathStr);
22extern bool testSimplifyx(const SkPath& path);
23
24struct State4 {
25    State4();
26    static pthread_mutex_t addQueue;
27    static pthread_cond_t checkQueue;
28    pthread_cond_t initialized;
29    static State4* queue;
30    pthread_t threadID;
31    int index;
32    bool done;
33    bool last;
34    int a;
35    int b;
36    int c;
37    int d; // sometimes 1 if abc_is_a_triangle
38    int testsRun;
39    char filename[256];
40
41    SkCanvas* canvas;
42    SkBitmap bitmap;
43};
44
45void createThread(State4* statePtr, void* (*test)(void* ));
46int dispatchTest4(void* (*testFun)(void* ), int a, int b, int c, int d);
47void initializeTests(const char* testName, size_t testNameSize);
48void outputProgress(const State4& state, const char* pathStr, SkPath::FillType );
49void outputToStream(const State4& state, const char* pathStr, SkPath::FillType, SkWStream& outFile);
50bool runNextTestSet(State4& state);
51int waitForCompletion();
52