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

Side by Side Diff: src/pathops/SkPathOpsDebug.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/lazy/SkDiscardableMemoryPool.cpp ('k') | src/pathops/SkPathOpsOp.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 2013 Google Inc. 2 * Copyright 2013 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 "SkMutex.h" 8 #include "SkMutex.h"
9 #include "SkOpCoincidence.h" 9 #include "SkOpCoincidence.h"
10 #include "SkOpContour.h" 10 #include "SkOpContour.h"
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 260
261 const char* SkPathOpsDebug::OpStr(SkPathOp op) { 261 const char* SkPathOpsDebug::OpStr(SkPathOp op) {
262 return gOpStrs[op]; 262 return gOpStrs[op];
263 } 263 }
264 264
265 static void show_op(SkPathOp op, const char* pathOne, const char* pathTwo) { 265 static void show_op(SkPathOp op, const char* pathOne, const char* pathTwo) {
266 SkDebugf(" testPathOp(reporter, %s, %s, %s, filename);\n", pathOne, pathT wo, gOpStrs[op]); 266 SkDebugf(" testPathOp(reporter, %s, %s, %s, filename);\n", pathOne, pathT wo, gOpStrs[op]);
267 SkDebugf("}\n"); 267 SkDebugf("}\n");
268 } 268 }
269 269
270 static SkMutex gTestMutex; 270 SK_DECLARE_STATIC_MUTEX(gTestMutex);
271 271
272 void SkPathOpsDebug::ShowPath(const SkPath& a, const SkPath& b, SkPathOp shapeOp , 272 void SkPathOpsDebug::ShowPath(const SkPath& a, const SkPath& b, SkPathOp shapeOp ,
273 const char* testName) { 273 const char* testName) {
274 SkAutoMutexAcquire ac(gTestMutex); 274 SkAutoMutexAcquire ac(gTestMutex);
275 show_function_header(testName); 275 show_function_header(testName);
276 ShowOnePath(a, "path", true); 276 ShowOnePath(a, "path", true);
277 ShowOnePath(b, "pathB", true); 277 ShowOnePath(b, "pathB", true);
278 show_op(shapeOp, "path", "pathB"); 278 show_op(shapeOp, "path", "pathB");
279 } 279 }
280 280
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 continue; 639 continue;
640 } 640 }
641 const SkOpSpan* span = spanBase->upCastable(); 641 const SkOpSpan* span = spanBase->upCastable();
642 // FIXME?: this assumes that if the opposite segment is coincident t hen no more 642 // FIXME?: this assumes that if the opposite segment is coincident t hen no more
643 // coincidence needs to be detected. This may not be true. 643 // coincidence needs to be detected. This may not be true.
644 if (span && span->segment() != opp && span->containsCoincidence(opp) ) { 644 if (span && span->segment() != opp && span->containsCoincidence(opp) ) {
645 continue; 645 continue;
646 } 646 }
647 if (spanBase->segment() != opp && spanBase->containsCoinEnd(opp)) { 647 if (spanBase->segment() != opp && spanBase->containsCoinEnd(opp)) {
648 continue; 648 continue;
649 } 649 }
650 const SkOpPtT* priorPtT = nullptr, * priorStopPtT; 650 const SkOpPtT* priorPtT = nullptr, * priorStopPtT;
651 // find prior span containing opp segment 651 // find prior span containing opp segment
652 const SkOpSegment* priorOpp = nullptr; 652 const SkOpSegment* priorOpp = nullptr;
653 const SkOpSpan* priorTest = spanBase->prev(); 653 const SkOpSpan* priorTest = spanBase->prev();
654 while (!priorOpp && priorTest) { 654 while (!priorOpp && priorTest) {
655 priorStopPtT = priorPtT = priorTest->ptT(); 655 priorStopPtT = priorPtT = priorTest->ptT();
656 while ((priorPtT = priorPtT->next()) != priorStopPtT) { 656 while ((priorPtT = priorPtT->next()) != priorStopPtT) {
657 if (priorPtT->deleted()) { 657 if (priorPtT->deleted()) {
658 continue; 658 continue;
659 } 659 }
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 foundMatch: // merge oppTest and oppSpan 779 foundMatch: // merge oppTest and oppSpan
780 if (oppTest == &oppSegment->fTail || oppTest == &oppSegment- >fHead) { 780 if (oppTest == &oppSegment->fTail || oppTest == &oppSegment- >fHead) {
781 SkASSERT(oppSpan != &oppSegment->fHead); // don't expect collapse 781 SkASSERT(oppSpan != &oppSegment->fHead); // don't expect collapse
782 SkASSERT(oppSpan != &oppSegment->fTail); 782 SkASSERT(oppSpan != &oppSegment->fTail);
783 glitches->record(kMoveMultiple_Glitch, id, oppTest, oppS pan); 783 glitches->record(kMoveMultiple_Glitch, id, oppTest, oppS pan);
784 } else { 784 } else {
785 glitches->record(kMoveMultiple_Glitch, id, oppSpan, oppT est); 785 glitches->record(kMoveMultiple_Glitch, id, oppSpan, oppT est);
786 } 786 }
787 goto checkNextSpan; 787 goto checkNextSpan;
788 } 788 }
789 tryNextSpan: 789 tryNextSpan:
790 ; 790 ;
791 } while (oppTest != oppLast && (oppTest = oppTest->upCast()->next()) ); 791 } while (oppTest != oppLast && (oppTest = oppTest->upCast()->next()) );
792 } while ((testPtT = testPtT->next()) != startPtT); 792 } while ((testPtT = testPtT->next()) != startPtT);
793 checkNextSpan: 793 checkNextSpan:
794 ; 794 ;
795 } while ((test = test->final() ? nullptr : test->upCast()->next())); 795 } while ((test = test->final() ? nullptr : test->upCast()->next()));
796 } 796 }
797 797
798 void SkOpSegment::debugMoveNearby(const char* id, SkPathOpsDebug::GlitchLog* gli tches) const { 798 void SkOpSegment::debugMoveNearby(const char* id, SkPathOpsDebug::GlitchLog* gli tches) const {
799 const SkOpSpanBase* spanS = &fHead; 799 const SkOpSpanBase* spanS = &fHead;
800 do { 800 do {
801 const SkOpSpanBase* test = spanS->upCast()->next(); 801 const SkOpSpanBase* test = spanS->upCast()->next();
802 const SkOpSpanBase* next; 802 const SkOpSpanBase* next;
803 if (spanS->contains(test)) { 803 if (spanS->contains(test)) {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 SkDebugf("%d", span->windSum()); 951 SkDebugf("%d", span->windSum());
952 } 952 }
953 SkDebugf(" windValue=%d oppValue=%d\n", span->windValue(), span->oppValue()) ; 953 SkDebugf(" windValue=%d oppValue=%d\n", span->windValue(), span->oppValue()) ;
954 } 954 }
955 955
956 #endif 956 #endif
957 957
958 // loop looking for a pair of angle parts that are too close to be sorted 958 // loop looking for a pair of angle parts that are too close to be sorted
959 /* This is called after other more simple intersection and angle sorting tests h ave been exhausted. 959 /* This is called after other more simple intersection and angle sorting tests h ave been exhausted.
960 This should be rarely called -- the test below is thorough and time consuming . 960 This should be rarely called -- the test below is thorough and time consuming .
961 This checks the distance between start points; the distance between 961 This checks the distance between start points; the distance between
962 */ 962 */
963 #if DEBUG_ANGLE 963 #if DEBUG_ANGLE
964 void SkOpAngle::debugCheckNearCoincidence() const { 964 void SkOpAngle::debugCheckNearCoincidence() const {
965 const SkOpAngle* test = this; 965 const SkOpAngle* test = this;
966 do { 966 do {
967 const SkOpSegment* testSegment = test->segment(); 967 const SkOpSegment* testSegment = test->segment();
968 double testStartT = test->start()->t(); 968 double testStartT = test->start()->t();
969 SkDPoint testStartPt = testSegment->dPtAtT(testStartT); 969 SkDPoint testStartPt = testSegment->dPtAtT(testStartT);
970 double testEndT = test->end()->t(); 970 double testEndT = test->end()->t();
971 SkDPoint testEndPt = testSegment->dPtAtT(testEndT); 971 SkDPoint testEndPt = testSegment->dPtAtT(testEndT);
(...skipping 17 matching lines...) Expand all
989 SkDebugf("%s testMidDistSq=%1.9g\n", __FUNCTION__, testMidDistSq); 989 SkDebugf("%s testMidDistSq=%1.9g\n", __FUNCTION__, testMidDistSq);
990 SkDebugf("%s testEndDistSq=%1.9g\n", __FUNCTION__, testEndDistSq); 990 SkDebugf("%s testEndDistSq=%1.9g\n", __FUNCTION__, testEndDistSq);
991 SkDebugf("%s nextMidDistSq=%1.9g\n", __FUNCTION__, nextMidDistSq); 991 SkDebugf("%s nextMidDistSq=%1.9g\n", __FUNCTION__, nextMidDistSq);
992 SkDebugf("%s nextEndDistSq=%1.9g\n", __FUNCTION__, nextEndDistSq); 992 SkDebugf("%s nextEndDistSq=%1.9g\n", __FUNCTION__, nextEndDistSq);
993 SkDPoint nextEndPt = nextSegment->dPtAtT(nextEndT); 993 SkDPoint nextEndPt = nextSegment->dPtAtT(nextEndT);
994 double nextLenSq = nextStartPt.distanceSquared(nextEndPt); 994 double nextLenSq = nextStartPt.distanceSquared(nextEndPt);
995 SkDebugf("%s nextLenSq=%1.9g\n", __FUNCTION__, nextLenSq); 995 SkDebugf("%s nextLenSq=%1.9g\n", __FUNCTION__, nextLenSq);
996 SkDebugf("\n"); 996 SkDebugf("\n");
997 } 997 }
998 test = test->fNext; 998 test = test->fNext;
999 } while (test->fNext != this); 999 } while (test->fNext != this);
1000 } 1000 }
1001 #endif 1001 #endif
1002 1002
1003 #if DEBUG_ANGLE 1003 #if DEBUG_ANGLE
1004 SkString SkOpAngle::debugPart() const { 1004 SkString SkOpAngle::debugPart() const {
1005 SkString result; 1005 SkString result;
1006 switch (this->segment()->verb()) { 1006 switch (this->segment()->verb()) {
1007 case SkPath::kLine_Verb: 1007 case SkPath::kLine_Verb:
1008 result.printf(LINE_DEBUG_STR " id=%d", LINE_DEBUG_DATA(fCurvePart), 1008 result.printf(LINE_DEBUG_STR " id=%d", LINE_DEBUG_DATA(fCurvePart),
1009 this->segment()->debugID()); 1009 this->segment()->debugID());
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
1845 #endif 1845 #endif
1846 SkPath::FillType fillType = path.getFillType(); 1846 SkPath::FillType fillType = path.getFillType();
1847 SkASSERT(fillType >= SkPath::kWinding_FillType && fillType <= SkPath::kInver seEvenOdd_FillType); 1847 SkASSERT(fillType >= SkPath::kWinding_FillType && fillType <= SkPath::kInver seEvenOdd_FillType);
1848 if (includeDeclaration) { 1848 if (includeDeclaration) {
1849 SkDebugf(" SkPath %s;\n", name); 1849 SkDebugf(" SkPath %s;\n", name);
1850 } 1850 }
1851 SkDebugf(" %s.setFillType(SkPath::%s);\n", name, gFillTypeStr[fillType]); 1851 SkDebugf(" %s.setFillType(SkPath::%s);\n", name, gFillTypeStr[fillType]);
1852 iter.setPath(path); 1852 iter.setPath(path);
1853 showPathContours(iter, name); 1853 showPathContours(iter, name);
1854 } 1854 }
OLDNEW
« no previous file with comments | « src/lazy/SkDiscardableMemoryPool.cpp ('k') | src/pathops/SkPathOpsOp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698