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

Side by Side Diff: src/core/SkPathMeasure.cpp

Issue 2356343004: speed up debug dm (Closed)
Patch Set: add comments Created 4 years, 2 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 | « no previous file | no next file » | 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 2008 The Android Open Source Project 2 * Copyright 2008 The Android Open Source Project
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 8
9 #include "SkPathMeasure.h" 9 #include "SkPathMeasure.h"
10 #include "SkPathMeasurePriv.h" 10 #include "SkPathMeasurePriv.h"
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 fLength = distance; 400 fLength = distance;
401 fIsClosed = isClosed; 401 fIsClosed = isClosed;
402 fFirstPtIndex = ptIndex; 402 fFirstPtIndex = ptIndex;
403 403
404 #ifdef SK_DEBUG 404 #ifdef SK_DEBUG
405 { 405 {
406 const Segment* seg = fSegments.begin(); 406 const Segment* seg = fSegments.begin();
407 const Segment* stop = fSegments.end(); 407 const Segment* stop = fSegments.end();
408 unsigned ptIndex = 0; 408 unsigned ptIndex = 0;
409 SkScalar distance = 0; 409 SkScalar distance = 0;
410 410 // limit the loop to a reasonable number; pathological cases can run for minutes
411 int maxChecks = 10000000; // set to INT_MAX to defeat the c heck
411 while (seg < stop) { 412 while (seg < stop) {
412 SkASSERT(seg->fDistance > distance); 413 SkASSERT(seg->fDistance > distance);
413 SkASSERT(seg->fPtIndex >= ptIndex); 414 SkASSERT(seg->fPtIndex >= ptIndex);
414 SkASSERT(seg->fTValue > 0); 415 SkASSERT(seg->fTValue > 0);
415 416
416 const Segment* s = seg; 417 const Segment* s = seg;
417 while (s < stop - 1 && s[0].fPtIndex == s[1].fPtIndex) { 418 while (s < stop - 1 && s[0].fPtIndex == s[1].fPtIndex && --maxChecks > 0) {
418 SkASSERT(s[0].fType == s[1].fType); 419 SkASSERT(s[0].fType == s[1].fType);
419 SkASSERT(s[0].fTValue < s[1].fTValue); 420 SkASSERT(s[0].fTValue < s[1].fTValue);
420 s += 1; 421 s += 1;
421 } 422 }
422 423
423 distance = seg->fDistance; 424 distance = seg->fDistance;
424 ptIndex = seg->fPtIndex; 425 ptIndex = seg->fPtIndex;
425 seg += 1; 426 seg += 1;
426 } 427 }
427 // SkDebugf("\n"); 428 // SkDebugf("\n");
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 697
697 for (int i = 0; i < fSegments.count(); i++) { 698 for (int i = 0; i < fSegments.count(); i++) {
698 const Segment* seg = &fSegments[i]; 699 const Segment* seg = &fSegments[i];
699 SkDebugf("pathmeas: seg[%d] distance=%g, point=%d, t=%g, type=%d\n", 700 SkDebugf("pathmeas: seg[%d] distance=%g, point=%d, t=%g, type=%d\n",
700 i, seg->fDistance, seg->fPtIndex, seg->getScalarT(), 701 i, seg->fDistance, seg->fPtIndex, seg->getScalarT(),
701 seg->fType); 702 seg->fType);
702 } 703 }
703 } 704 }
704 705
705 #endif 706 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698