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

Side by Side Diff: src/pathops/SkDCubicIntersection.cpp

Issue 14034014: path ops -- use standard SkTQSort (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/pathops/SkDCubicToQuads.cpp » ('j') | src/pathops/SkPathOpsCommon.cpp » ('J')
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 "SkIntersections.h" 8 #include "SkIntersections.h"
9 #include "SkPathOpsCubic.h" 9 #include "SkPathOpsCubic.h"
10 #include "SkPathOpsLine.h" 10 #include "SkPathOpsLine.h"
11 #include "SkPathOpsPoint.h" 11 #include "SkPathOpsPoint.h"
12 #include "SkPathOpsQuad.h" 12 #include "SkPathOpsQuad.h"
13 #include "SkPathOpsRect.h" 13 #include "SkPathOpsRect.h"
14 #include "SkReduceOrder.h" 14 #include "SkReduceOrder.h"
15 #include "SkTDArray.h" 15 #include "SkTDArray.h"
16 #include "TSearch.h" 16 #include "SkTSort.h"
17 17
18 #if ONE_OFF_DEBUG 18 #if ONE_OFF_DEBUG
19 static const double tLimits1[2][2] = {{0.36, 0.37}, {0.63, 0.64}}; 19 static const double tLimits1[2][2] = {{0.36, 0.37}, {0.63, 0.64}};
20 static const double tLimits2[2][2] = {{-0.865211397, -0.865215212}, {-0.86520769 6, -0.865208078}}; 20 static const double tLimits2[2][2] = {{-0.865211397, -0.865215212}, {-0.86520769 6, -0.865208078}};
21 #endif 21 #endif
22 22
23 #define DEBUG_QUAD_PART 0 23 #define DEBUG_QUAD_PART 0
24 #define SWAP_TOP_DEBUG 0 24 #define SWAP_TOP_DEBUG 0
25 25
26 static int quadPart(const SkDCubic& cubic, double tStart, double tEnd, SkReduceO rder* reducer) { 26 static int quadPart(const SkDCubic& cubic, double tStart, double tEnd, SkReduceO rder* reducer) {
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 i.insert(start ? 0 : 1, foundT, line[0]); 335 i.insert(start ? 0 : 1, foundT, line[0]);
336 } 336 }
337 } else { 337 } else {
338 *tVals.append() = local[0][idx2]; 338 *tVals.append() = local[0][idx2];
339 } 339 }
340 } 340 }
341 } 341 }
342 if (tVals.count() == 0) { 342 if (tVals.count() == 0) {
343 return; 343 return;
344 } 344 }
345 QSort<double>(tVals.begin(), tVals.end() - 1); 345 SkTQSort<double>(tVals.begin(), tVals.end() - 1);
346 double tMin1 = start ? 0 : 1 - LINE_FRACTION; 346 double tMin1 = start ? 0 : 1 - LINE_FRACTION;
347 double tMax1 = start ? LINE_FRACTION : 1; 347 double tMax1 = start ? LINE_FRACTION : 1;
348 int tIdx = 0; 348 int tIdx = 0;
349 do { 349 do {
350 int tLast = tIdx; 350 int tLast = tIdx;
351 while (tLast + 1 < tVals.count() && roughly_equal(tVals[tLast + 1], tVal s[tIdx])) { 351 while (tLast + 1 < tVals.count() && roughly_equal(tVals[tLast + 1], tVal s[tIdx])) {
352 ++tLast; 352 ++tLast;
353 } 353 }
354 double tMin2 = SkTMax<double>(tVals[tIdx] - LINE_FRACTION, 0.0); 354 double tMin2 = SkTMax<double>(tVals[tIdx] - LINE_FRACTION, 0.0);
355 double tMax2 = SkTMin<double>(tVals[tLast] + LINE_FRACTION, 1.0); 355 double tMax2 = SkTMin<double>(tVals[tLast] + LINE_FRACTION, 1.0);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 } 440 }
441 (void) intersect(c, c); 441 (void) intersect(c, c);
442 if (used() > 0) { 442 if (used() > 0) {
443 SkASSERT(used() == 1); 443 SkASSERT(used() == 1);
444 if (fT[0][0] > fT[1][0]) { 444 if (fT[0][0] > fT[1][0]) {
445 swapPts(); 445 swapPts();
446 } 446 }
447 } 447 }
448 return used(); 448 return used();
449 } 449 }
OLDNEW
« no previous file with comments | « no previous file | src/pathops/SkDCubicToQuads.cpp » ('j') | src/pathops/SkPathOpsCommon.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698