EdgeWalker_Test.h revision 24bec79d6f3d71ff97b50db72461a3892bd4f6b5
1cd4421df5012b75c792c6c8bf2c5ee0410921c15caryclark@google.com
2cd4421df5012b75c792c6c8bf2c5ee0410921c15caryclark@google.com
3d88e0894d0156f4d427b812fec69bfba3eec7a8dcaryclark@google.com#include "ShapeOps.h"
478e17130f396d8b2157116c2504e357192f87ed1caryclark@google.com#include "SkBitmap.h"
578e17130f396d8b2157116c2504e357192f87ed1caryclark@google.com#include <pthread.h>
6cd4421df5012b75c792c6c8bf2c5ee0410921c15caryclark@google.com
7198e054b33051a6cd5f606ccbc8d539cefc5631fcaryclark@google.comclass SkCanvas;
859823f7f3ba43c7c6bc1fa8c600b093ecb4236aacaryclark@google.comstruct State4;
9198e054b33051a6cd5f606ccbc8d539cefc5631fcaryclark@google.com
10198e054b33051a6cd5f606ccbc8d539cefc5631fcaryclark@google.com//extern int comparePaths(const SkPath& one, const SkPath& two);
111577e8f9c5bc8436cc71d3438c6d0b9f02c38338caryclark@google.comextern int comparePaths(const SkPath& one, const SkPath& two, SkBitmap& bitmap,
121577e8f9c5bc8436cc71d3438c6d0b9f02c38338caryclark@google.com        SkCanvas* canvas);
13cd4421df5012b75c792c6c8bf2c5ee0410921c15caryclark@google.comextern void comparePathsTiny(const SkPath& one, const SkPath& two);
14752b60e633a349c5b9f7bcc6a28b8064fc77bb41caryclark@google.comextern bool drawAsciiPaths(const SkPath& one, const SkPath& two,
152e7f4c810dc717383df42d27bdba862514ab6d51caryclark@google.com        bool drawPaths);
162e7f4c810dc717383df42d27bdba862514ab6d51caryclark@google.comextern void showPath(const SkPath& path, const char* str = NULL);
17198e054b33051a6cd5f606ccbc8d539cefc5631fcaryclark@google.comextern bool testSimplify(const SkPath& path, bool fill, SkPath& out,
18198e054b33051a6cd5f606ccbc8d539cefc5631fcaryclark@google.com        SkBitmap& bitmap, SkCanvas* canvas = 0);
1924bec79d6f3d71ff97b50db72461a3892bd4f6b5caryclark@google.comextern bool testSimplifyx(SkPath& path, bool useXor, SkPath& out,
2059823f7f3ba43c7c6bc1fa8c600b093ecb4236aacaryclark@google.com        State4& state, const char* pathStr);
218dcf114db9762c02d217beba6e29dffa4e92d298caryclark@google.comextern bool testSimplifyx(const SkPath& path);
2278e17130f396d8b2157116c2504e357192f87ed1caryclark@google.com
2378e17130f396d8b2157116c2504e357192f87ed1caryclark@google.comstruct State4 {
2478e17130f396d8b2157116c2504e357192f87ed1caryclark@google.com    State4();
252ddff9388694263c7be9347de7eb768cd0847997caryclark@google.com    static pthread_mutex_t addQueue;
262ddff9388694263c7be9347de7eb768cd0847997caryclark@google.com    static pthread_cond_t checkQueue;
272ddff9388694263c7be9347de7eb768cd0847997caryclark@google.com    pthread_cond_t initialized;
282ddff9388694263c7be9347de7eb768cd0847997caryclark@google.com    static State4* queue;
292ddff9388694263c7be9347de7eb768cd0847997caryclark@google.com    pthread_t threadID;
302ddff9388694263c7be9347de7eb768cd0847997caryclark@google.com    int index;
312ddff9388694263c7be9347de7eb768cd0847997caryclark@google.com    bool done;
322ddff9388694263c7be9347de7eb768cd0847997caryclark@google.com    bool last;
3378e17130f396d8b2157116c2504e357192f87ed1caryclark@google.com    int a;
3478e17130f396d8b2157116c2504e357192f87ed1caryclark@google.com    int b;
3578e17130f396d8b2157116c2504e357192f87ed1caryclark@google.com    int c;
3659823f7f3ba43c7c6bc1fa8c600b093ecb4236aacaryclark@google.com    int d; // sometimes 1 if abc_is_a_triangle
3727c449af06cd1d05db441593d08b84f3530fba52caryclark@google.com    int testsRun;
3847580694fbe974a065caf7c39c3d2075708c2018caryclark@google.com    char filename[256];
392ddff9388694263c7be9347de7eb768cd0847997caryclark@google.com
4078e17130f396d8b2157116c2504e357192f87ed1caryclark@google.com    SkCanvas* canvas;
4178e17130f396d8b2157116c2504e357192f87ed1caryclark@google.com    SkBitmap bitmap;
4278e17130f396d8b2157116c2504e357192f87ed1caryclark@google.com};
4378e17130f396d8b2157116c2504e357192f87ed1caryclark@google.com
4478e17130f396d8b2157116c2504e357192f87ed1caryclark@google.comvoid createThread(State4* statePtr, void* (*test)(void* ));
4559823f7f3ba43c7c6bc1fa8c600b093ecb4236aacaryclark@google.comint dispatchTest4(void* (*testFun)(void* ), int a, int b, int c, int d);
4659823f7f3ba43c7c6bc1fa8c600b093ecb4236aacaryclark@google.comvoid initializeTests(const char* testName, size_t testNameSize);
4724bec79d6f3d71ff97b50db72461a3892bd4f6b5caryclark@google.comvoid outputProgress(const State4& state, const char* pathStr, SkPath::FillType );
4824bec79d6f3d71ff97b50db72461a3892bd4f6b5caryclark@google.comvoid outputToStream(const State4& state, const char* pathStr, SkPath::FillType, SkWStream& outFile);
4959823f7f3ba43c7c6bc1fa8c600b093ecb4236aacaryclark@google.combool runNextTestSet(State4& state);
5059823f7f3ba43c7c6bc1fa8c600b093ecb4236aacaryclark@google.comint waitForCompletion();
51