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