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 #include "SkPathOpsPoint.h" | 7 #include "SkPathOpsPoint.h" |
8 #include "SkPathWriter.h" | 8 #include "SkPathWriter.h" |
9 | 9 |
10 // wrap path to keep track of whether the contour is initialized and non-empty | 10 // wrap path to keep track of whether the contour is initialized and non-empty |
(...skipping 17 matching lines...) Expand all Loading... |
28 if (callClose) { | 28 if (callClose) { |
29 #if DEBUG_PATH_CONSTRUCTION | 29 #if DEBUG_PATH_CONSTRUCTION |
30 SkDebugf("path.close();\n"); | 30 SkDebugf("path.close();\n"); |
31 #endif | 31 #endif |
32 fPathPtr->close(); | 32 fPathPtr->close(); |
33 fCloses++; | 33 fCloses++; |
34 } | 34 } |
35 init(); | 35 init(); |
36 } | 36 } |
37 | 37 |
| 38 void SkPathWriter::conicTo(const SkPoint& pt1, const SkPoint& pt2, SkScalar weig
ht) { |
| 39 lineTo(); |
| 40 if (fEmpty && AlmostEqualUlps(fDefer[0], pt1) && AlmostEqualUlps(pt1, pt2))
{ |
| 41 deferredLine(pt2); |
| 42 return; |
| 43 } |
| 44 moveTo(); |
| 45 fDefer[1] = pt2; |
| 46 nudge(); |
| 47 fDefer[0] = fDefer[1]; |
| 48 #if DEBUG_PATH_CONSTRUCTION |
| 49 SkDebugf("path.conicTo(%1.9g,%1.9g, %1.9g,%1.9g, %1.9g);\n", |
| 50 pt1.fX, pt1.fY, fDefer[1].fX, fDefer[1].fY, weight); |
| 51 #endif |
| 52 fPathPtr->conicTo(pt1.fX, pt1.fY, fDefer[1].fX, fDefer[1].fY, weight); |
| 53 fEmpty = false; |
| 54 } |
| 55 |
38 void SkPathWriter::cubicTo(const SkPoint& pt1, const SkPoint& pt2, const SkPoint
& pt3) { | 56 void SkPathWriter::cubicTo(const SkPoint& pt1, const SkPoint& pt2, const SkPoint
& pt3) { |
39 lineTo(); | 57 lineTo(); |
40 if (fEmpty && AlmostEqualUlps(fDefer[0], pt1) && AlmostEqualUlps(pt1, pt2) | 58 if (fEmpty && AlmostEqualUlps(fDefer[0], pt1) && AlmostEqualUlps(pt1, pt2) |
41 && AlmostEqualUlps(pt2, pt3)) { | 59 && AlmostEqualUlps(pt2, pt3)) { |
42 deferredLine(pt3); | 60 deferredLine(pt3); |
43 return; | 61 return; |
44 } | 62 } |
45 moveTo(); | 63 moveTo(); |
46 fDefer[1] = pt3; | 64 fDefer[1] = pt3; |
47 nudge(); | 65 nudge(); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 return; | 175 return; |
158 } | 176 } |
159 fFirstPt = fDefer[0]; | 177 fFirstPt = fDefer[0]; |
160 #if DEBUG_PATH_CONSTRUCTION | 178 #if DEBUG_PATH_CONSTRUCTION |
161 SkDebugf("path.moveTo(%1.9g,%1.9g);\n", fDefer[0].fX, fDefer[0].fY); | 179 SkDebugf("path.moveTo(%1.9g,%1.9g);\n", fDefer[0].fX, fDefer[0].fY); |
162 #endif | 180 #endif |
163 fPathPtr->moveTo(fDefer[0].fX, fDefer[0].fY); | 181 fPathPtr->moveTo(fDefer[0].fX, fDefer[0].fY); |
164 fMoved = false; | 182 fMoved = false; |
165 fMoves++; | 183 fMoves++; |
166 } | 184 } |
OLD | NEW |