virtual void onDraw(SkCanvas* canvas) { for (int i = 0; i < N; i++) { SK_DECLARE_STATIC_MUTEX(mu); for (int j = 0; j < M; j++) { mu.acquire(); mu.release(); } } }
static int comparePaths(skiatest::Reporter* reporter, const char* testName, const SkPath& one, const SkPath& scaledOne, const SkPath& two, const SkPath& scaledTwo, SkBitmap& bitmap, const SkPath& a, const SkPath& b, const SkPathOp shapeOp, const SkMatrix& scale) { int errors2x2; (void) pathsDrawTheSame(bitmap, scaledOne, scaledTwo, errors2x2); if (errors2x2 == 0) { if (gShowPath) { showPathOpPath(testName, one, two, a, b, scaledOne, scaledTwo, shapeOp, scale); } return 0; } const int MAX_ERRORS = 8; if (errors2x2 > MAX_ERRORS && gComparePathsAssert) { SK_DECLARE_STATIC_MUTEX(compareDebugOut3); SkAutoMutexAcquire autoM(compareDebugOut3); showPathOpPath(testName, one, two, a, b, scaledOne, scaledTwo, shapeOp, scale); REPORTER_ASSERT(reporter, 0); } else if (gShowPath || errors2x2 == MAX_ERRORS || errors2x2 == MAX_ERRORS - 1) { SK_DECLARE_STATIC_MUTEX(compareDebugOut4); SkAutoMutexAcquire autoM(compareDebugOut4); showPathOpPath(testName, one, two, a, b, scaledOne, scaledTwo, shapeOp, scale); } return errors2x2 > MAX_ERRORS ? errors2x2 : 0; }
bool testSimplify(SkPath& path, bool useXor, SkPath& out, PathOpsThreadState& state, const char* pathStr) { SkPath::FillType fillType = useXor ? SkPath::kEvenOdd_FillType : SkPath::kWinding_FillType; path.setFillType(fillType); if (gShowPath) { showPath(path, "path", false); } if (!Simplify(path, &out)) { SkDebugf("%s did not expect failure\n", __FUNCTION__); REPORTER_ASSERT(state.fReporter, 0); return false; } if (!state.fReporter->verbose()) { return true; } int result = comparePaths(state.fReporter, NULL, path, out, *state.fBitmap); if (result && gPathStrAssert) { SK_DECLARE_STATIC_MUTEX(simplifyDebugOut); SkAutoMutexAcquire autoM(simplifyDebugOut); char temp[8192]; sk_bzero(temp, sizeof(temp)); SkMemoryWStream stream(temp, sizeof(temp)); const char* pathPrefix = NULL; const char* nameSuffix = NULL; if (fillType == SkPath::kEvenOdd_FillType) { pathPrefix = " path.setFillType(SkPath::kEvenOdd_FillType);\n"; nameSuffix = "x"; } const char testFunction[] = "testSimplify(reporter, path);"; outputToStream(pathStr, pathPrefix, nameSuffix, testFunction, false, stream); SkDebugf(temp); REPORTER_ASSERT(state.fReporter, 0); } state.fReporter->bumpTestCount(); return result == 0; }
// static SkBaseMutex& SkPDFShader::CanonicalShadersMutex() { // This initialization is only thread safe with gcc or when // POD-style mutex initialization is used. SK_DECLARE_STATIC_MUTEX(gCanonicalShadersMutex); return gCanonicalShadersMutex; }
// static SkBaseMutex& SkPDFGraphicState::CanonicalPaintsMutex() { SK_DECLARE_STATIC_MUTEX(gCanonicalPaintsMutex); return gCanonicalPaintsMutex; }