Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: tests/PathOpsExtendedTest.cpp

Issue 1945353003: Revert of SK_DECLARE_STATIC_MUTEX -> static SkMutex (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/views/SkEventSink.cpp ('k') | tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "PathOpsExtendedTest.h" 8 #include "PathOpsExtendedTest.h"
9 #include "PathOpsThreadedCommon.h" 9 #include "PathOpsThreadedCommon.h"
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 324
325 void ShowTestArray(const char* testName) { 325 void ShowTestArray(const char* testName) {
326 if (!testName) { 326 if (!testName) {
327 testName = "xOp"; 327 testName = "xOp";
328 } 328 }
329 for (int x = gTestFirst; x < gTestNo; ++x) { 329 for (int x = gTestFirst; x < gTestNo; ++x) {
330 SkDebugf(" TEST(%s%d%s),\n", testName, x, opSuffixes[gTestOp[x - gTes tFirst]]); 330 SkDebugf(" TEST(%s%d%s),\n", testName, x, opSuffixes[gTestOp[x - gTes tFirst]]);
331 } 331 }
332 } 332 }
333 333
334 static SkMutex compareDebugOut3; 334 SK_DECLARE_STATIC_MUTEX(compareDebugOut3);
335 335
336 static int comparePaths(skiatest::Reporter* reporter, const char* testName, cons t SkPath& one, 336 static int comparePaths(skiatest::Reporter* reporter, const char* testName, cons t SkPath& one,
337 const SkPath& scaledOne, const SkPath& two, const SkPath& scaledTwo, SkB itmap& bitmap, 337 const SkPath& scaledOne, const SkPath& two, const SkPath& scaledTwo, SkB itmap& bitmap,
338 const SkPath& a, const SkPath& b, const SkPathOp shapeOp, const SkMatrix & scale, 338 const SkPath& a, const SkPath& b, const SkPathOp shapeOp, const SkMatrix & scale,
339 bool expectSuccess) { 339 bool expectSuccess) {
340 int errors2x2; 340 int errors2x2;
341 const int MAX_ERRORS = 8; 341 const int MAX_ERRORS = 8;
342 (void) pathsDrawTheSame(bitmap, scaledOne, scaledTwo, errors2x2); 342 (void) pathsDrawTheSame(bitmap, scaledOne, scaledTwo, errors2x2);
343 if (!expectSuccess) { 343 if (!expectSuccess) {
344 if (errors2x2 < MAX_ERRORS) { 344 if (errors2x2 < MAX_ERRORS) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 outFile.writeText(" void (*fun)();\n"); 412 outFile.writeText(" void (*fun)();\n");
413 outFile.writeText(" const char* str;\n"); 413 outFile.writeText(" const char* str;\n");
414 outFile.writeText("} tests[] = {\n"); 414 outFile.writeText("} tests[] = {\n");
415 outFile.writeText(" TEST("); 415 outFile.writeText(" TEST(");
416 writeTestName(nameSuffix, outFile); 416 writeTestName(nameSuffix, outFile);
417 outFile.writeText("),\n"); 417 outFile.writeText("),\n");
418 #endif 418 #endif
419 outFile.flush(); 419 outFile.flush();
420 } 420 }
421 421
422 static SkMutex simplifyDebugOut; 422 SK_DECLARE_STATIC_MUTEX(simplifyDebugOut);
423 423
424 bool testSimplify(SkPath& path, bool useXor, SkPath& out, PathOpsThreadState& st ate, 424 bool testSimplify(SkPath& path, bool useXor, SkPath& out, PathOpsThreadState& st ate,
425 const char* pathStr) { 425 const char* pathStr) {
426 SkPath::FillType fillType = useXor ? SkPath::kEvenOdd_FillType : SkPath::kWi nding_FillType; 426 SkPath::FillType fillType = useXor ? SkPath::kEvenOdd_FillType : SkPath::kWi nding_FillType;
427 path.setFillType(fillType); 427 path.setFillType(fillType);
428 state.fReporter->bumpTestCount(); 428 state.fReporter->bumpTestCount();
429 if (!Simplify(path, &out)) { 429 if (!Simplify(path, &out)) {
430 SkDebugf("%s did not expect failure\n", __FUNCTION__); 430 SkDebugf("%s did not expect failure\n", __FUNCTION__);
431 REPORTER_ASSERT(state.fReporter, 0); 431 REPORTER_ASSERT(state.fReporter, 0);
432 return false; 432 return false;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 SkPath out = orig; 571 SkPath out = orig;
572 if (Op(a, b, shapeOp, &out) ) { 572 if (Op(a, b, shapeOp, &out) ) {
573 SkDebugf("%s test is expected to fail\n", __FUNCTION__); 573 SkDebugf("%s test is expected to fail\n", __FUNCTION__);
574 REPORTER_ASSERT(reporter, 0); 574 REPORTER_ASSERT(reporter, 0);
575 return false; 575 return false;
576 } 576 }
577 SkASSERT(out == orig); 577 SkASSERT(out == orig);
578 return true; 578 return true;
579 } 579 }
580 580
581 static SkMutex gMutex; 581 SK_DECLARE_STATIC_MUTEX(gMutex);
582 582
583 void initializeTests(skiatest::Reporter* reporter, const char* test) { 583 void initializeTests(skiatest::Reporter* reporter, const char* test) {
584 #if 0 // doesn't work yet 584 #if 0 // doesn't work yet
585 SK_CONF_SET("images.jpeg.suppressDecoderWarnings", true); 585 SK_CONF_SET("images.jpeg.suppressDecoderWarnings", true);
586 SK_CONF_SET("images.png.suppressDecoderWarnings", true); 586 SK_CONF_SET("images.png.suppressDecoderWarnings", true);
587 #endif 587 #endif
588 if (reporter->verbose()) { 588 if (reporter->verbose()) {
589 SkAutoMutexAcquire lock(gMutex); 589 SkAutoMutexAcquire lock(gMutex);
590 testName = test; 590 testName = test;
591 size_t testNameSize = strlen(test); 591 size_t testNameSize = strlen(test);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 if (foundSkip && tests[index].fun != firstTest) { 681 if (foundSkip && tests[index].fun != firstTest) {
682 SkDebugf(" %s,\n", tests[index].str); 682 SkDebugf(" %s,\n", tests[index].str);
683 } 683 }
684 if (tests[index].fun == stopTest || index == last) { 684 if (tests[index].fun == stopTest || index == last) {
685 break; 685 break;
686 } 686 }
687 index += reverse ? -1 : 1; 687 index += reverse ? -1 : 1;
688 } while (true); 688 } while (true);
689 #endif 689 #endif
690 } 690 }
OLDNEW
« no previous file with comments | « src/views/SkEventSink.cpp ('k') | tools/gpu/gl/command_buffer/GLTestContext_command_buffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698