OLD | NEW |
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" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #define DEBUG_QUAD_PART_SHOW_SIMPLE DEBUG_QUAD_PART && 0 | 23 #define DEBUG_QUAD_PART_SHOW_SIMPLE DEBUG_QUAD_PART && 0 |
24 #define SWAP_TOP_DEBUG 0 | 24 #define SWAP_TOP_DEBUG 0 |
25 | 25 |
26 static const int kCubicToQuadSubdivisionDepth = 8; // slots reserved for cubic t
o quads subdivision | 26 static const int kCubicToQuadSubdivisionDepth = 8; // slots reserved for cubic t
o quads subdivision |
27 | 27 |
28 static int quadPart(const SkDCubic& cubic, double tStart, double tEnd, SkReduceO
rder* reducer) { | 28 static int quadPart(const SkDCubic& cubic, double tStart, double tEnd, SkReduceO
rder* reducer) { |
29 SkDCubic part = cubic.subDivide(tStart, tEnd); | 29 SkDCubic part = cubic.subDivide(tStart, tEnd); |
30 SkDQuad quad = part.toQuad(); | 30 SkDQuad quad = part.toQuad(); |
31 // FIXME: should reduceOrder be looser in this use case if quartic is going
to blow up on an | 31 // FIXME: should reduceOrder be looser in this use case if quartic is going
to blow up on an |
32 // extremely shallow quadratic? | 32 // extremely shallow quadratic? |
33 int order = reducer->reduce(quad, SkReduceOrder::kFill_Style); | 33 int order = reducer->reduce(quad); |
34 #if DEBUG_QUAD_PART | 34 #if DEBUG_QUAD_PART |
35 SkDebugf("%s cubic=(%1.9g,%1.9g %1.9g,%1.9g %1.9g,%1.9g %1.9g,%1.9g)" | 35 SkDebugf("%s cubic=(%1.9g,%1.9g %1.9g,%1.9g %1.9g,%1.9g %1.9g,%1.9g)" |
36 " t=(%1.9g,%1.9g)\n", __FUNCTION__, cubic[0].fX, cubic[0].fY, | 36 " t=(%1.9g,%1.9g)\n", __FUNCTION__, cubic[0].fX, cubic[0].fY, |
37 cubic[1].fX, cubic[1].fY, cubic[2].fX, cubic[2].fY, | 37 cubic[1].fX, cubic[1].fY, cubic[2].fX, cubic[2].fY, |
38 cubic[3].fX, cubic[3].fY, tStart, tEnd); | 38 cubic[3].fX, cubic[3].fY, tStart, tEnd); |
39 SkDebugf(" {{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}},\n" | 39 SkDebugf(" {{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}},\n" |
40 " {{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}},\n", | 40 " {{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}},\n", |
41 part[0].fX, part[0].fY, part[1].fX, part[1].fY, part[2].fX, part[2].
fY, | 41 part[0].fX, part[0].fY, part[1].fX, part[1].fY, part[2].fX, part[2].
fY, |
42 part[3].fX, part[3].fY, quad[0].fX, quad[0].fY, | 42 part[3].fX, part[3].fY, quad[0].fX, quad[0].fY, |
43 quad[1].fX, quad[1].fY, quad[2].fX, quad[2].fY); | 43 quad[1].fX, quad[1].fY, quad[2].fX, quad[2].fY); |
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 } | 638 } |
639 (void) intersect(c, c); | 639 (void) intersect(c, c); |
640 if (used() > 0) { | 640 if (used() > 0) { |
641 SkASSERT(used() == 1); | 641 SkASSERT(used() == 1); |
642 if (fT[0][0] > fT[1][0]) { | 642 if (fT[0][0] > fT[1][0]) { |
643 swapPts(); | 643 swapPts(); |
644 } | 644 } |
645 } | 645 } |
646 return used(); | 646 return used(); |
647 } | 647 } |
OLD | NEW |