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