| 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 "SkOpSpan.h" | 7 #include "SkOpSpan.h" |
| 8 #include "SkPathOpsPoint.h" | 8 #include "SkPathOpsPoint.h" |
| 9 #include "SkPathWriter.h" | 9 #include "SkPathWriter.h" |
| 10 #include "SkTSort.h" | 10 #include "SkTSort.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 void SkPathWriter::cubicTo(const SkPoint& pt1, const SkPoint& pt2, const SkOpPtT
* pt3) { | 42 void SkPathWriter::cubicTo(const SkPoint& pt1, const SkPoint& pt2, const SkOpPtT
* pt3) { |
| 43 this->update(pt3); | 43 this->update(pt3); |
| 44 #if DEBUG_PATH_CONSTRUCTION | 44 #if DEBUG_PATH_CONSTRUCTION |
| 45 SkDebugf("path.cubicTo(%1.9g,%1.9g, %1.9g,%1.9g, %1.9g,%1.9g);\n", | 45 SkDebugf("path.cubicTo(%1.9g,%1.9g, %1.9g,%1.9g, %1.9g,%1.9g);\n", |
| 46 pt1.fX, pt1.fY, pt2.fX, pt2.fY, pt3->fPt.fX, pt3->fPt.fY); | 46 pt1.fX, pt1.fY, pt2.fX, pt2.fY, pt3->fPt.fX, pt3->fPt.fY); |
| 47 #endif | 47 #endif |
| 48 fCurrent.cubicTo(pt1, pt2, pt3->fPt); | 48 fCurrent.cubicTo(pt1, pt2, pt3->fPt); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void SkPathWriter::deferredLine(const SkOpPtT* pt) { | 51 bool SkPathWriter::deferredLine(const SkOpPtT* pt) { |
| 52 SkASSERT(fFirstPtT); | 52 SkASSERT(fFirstPtT); |
| 53 SkASSERT(fDefer[0]); | 53 SkASSERT(fDefer[0]); |
| 54 if (fDefer[0] == pt) { | 54 if (fDefer[0] == pt) { |
| 55 // FIXME: why we're adding a degenerate line? Caller should have preflig
hted this. | 55 // FIXME: why we're adding a degenerate line? Caller should have preflig
hted this. |
| 56 return; | 56 return true; |
| 57 } | 57 } |
| 58 if (pt->contains(fDefer[0])) { | 58 if (pt->contains(fDefer[0])) { |
| 59 // FIXME: why we're adding a degenerate line? | 59 // FIXME: why we're adding a degenerate line? |
| 60 return; | 60 return true; |
| 61 } | 61 } |
| 62 SkASSERT(!this->matchedLast(pt)); | 62 if (this->matchedLast(pt)) { |
| 63 return false; |
| 64 } |
| 63 if (fDefer[1] && this->changedSlopes(pt)) { | 65 if (fDefer[1] && this->changedSlopes(pt)) { |
| 64 this->lineTo(); | 66 this->lineTo(); |
| 65 fDefer[0] = fDefer[1]; | 67 fDefer[0] = fDefer[1]; |
| 66 } | 68 } |
| 67 fDefer[1] = pt; | 69 fDefer[1] = pt; |
| 70 return true; |
| 68 } | 71 } |
| 69 | 72 |
| 70 void SkPathWriter::deferredMove(const SkOpPtT* pt) { | 73 void SkPathWriter::deferredMove(const SkOpPtT* pt) { |
| 71 if (!fDefer[1]) { | 74 if (!fDefer[1]) { |
| 72 fFirstPtT = fDefer[0] = pt; | 75 fFirstPtT = fDefer[0] = pt; |
| 73 return; | 76 return; |
| 74 } | 77 } |
| 75 SkASSERT(fDefer[0]); | 78 SkASSERT(fDefer[0]); |
| 76 if (!this->matchedLast(pt)) { | 79 if (!this->matchedLast(pt)) { |
| 77 this->finishContour(); | 80 this->finishContour(); |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 } | 356 } |
| 354 } while (rIndex < linkCount); | 357 } while (rIndex < linkCount); |
| 355 #if DEBUG_ASSEMBLE | 358 #if DEBUG_ASSEMBLE |
| 356 for (rIndex = 0; rIndex < linkCount; ++rIndex) { | 359 for (rIndex = 0; rIndex < linkCount; ++rIndex) { |
| 357 SkASSERT(sLink[rIndex] == SK_MaxS32); | 360 SkASSERT(sLink[rIndex] == SK_MaxS32); |
| 358 SkASSERT(eLink[rIndex] == SK_MaxS32); | 361 SkASSERT(eLink[rIndex] == SK_MaxS32); |
| 359 } | 362 } |
| 360 #endif | 363 #endif |
| 361 return; | 364 return; |
| 362 } | 365 } |
| OLD | NEW |