| OLD | NEW | 
|---|
| 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 #include "SkStrokerPriv.h" | 8 #include "SkStrokerPriv.h" | 
| 9 #include "SkGeometry.h" | 9 #include "SkGeometry.h" | 
| 10 #include "SkPathPriv.h" | 10 #include "SkPathPriv.h" | 
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 133     void close(bool isLine) { this->finishContour(true, isLine); } | 133     void close(bool isLine) { this->finishContour(true, isLine); } | 
| 134 | 134 | 
| 135     void done(SkPath* dst, bool isLine) { | 135     void done(SkPath* dst, bool isLine) { | 
| 136         this->finishContour(false, isLine); | 136         this->finishContour(false, isLine); | 
| 137         fOuter.addPath(fExtra); | 137         fOuter.addPath(fExtra); | 
| 138         dst->swap(fOuter); | 138         dst->swap(fOuter); | 
| 139     } | 139     } | 
| 140 | 140 | 
| 141     SkScalar getResScale() const { return fResScale; } | 141     SkScalar getResScale() const { return fResScale; } | 
| 142 | 142 | 
|  | 143     bool isZeroLength() const { | 
|  | 144         return fInner.isZeroLength() && fOuter.isZeroLength(); | 
|  | 145     } | 
|  | 146 | 
| 143 private: | 147 private: | 
| 144     SkScalar    fRadius; | 148     SkScalar    fRadius; | 
| 145     SkScalar    fInvMiterLimit; | 149     SkScalar    fInvMiterLimit; | 
| 146     SkScalar    fResScale; | 150     SkScalar    fResScale; | 
| 147     SkScalar    fInvResScale; | 151     SkScalar    fInvResScale; | 
| 148     SkScalar    fInvResScaleSquared; | 152     SkScalar    fInvResScaleSquared; | 
| 149 | 153 | 
| 150     SkVector    fFirstNormal, fPrevNormal, fFirstUnitNormal, fPrevUnitNormal; | 154     SkVector    fFirstNormal, fPrevNormal, fFirstUnitNormal, fPrevUnitNormal; | 
| 151     SkPoint     fFirstPt, fPrevPt;  // on original path | 155     SkPoint     fFirstPt, fPrevPt;  // on original path | 
| 152     SkPoint     fFirstOuterPt; | 156     SkPoint     fFirstOuterPt; | 
| (...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1387             case SkPath::kConic_Verb: { | 1391             case SkPath::kConic_Verb: { | 
| 1388                 stroker.conicTo(pts[1], pts[2], iter.conicWeight()); | 1392                 stroker.conicTo(pts[1], pts[2], iter.conicWeight()); | 
| 1389                 lastSegment = SkPath::kConic_Verb; | 1393                 lastSegment = SkPath::kConic_Verb; | 
| 1390                 break; | 1394                 break; | 
| 1391             } break; | 1395             } break; | 
| 1392             case SkPath::kCubic_Verb: | 1396             case SkPath::kCubic_Verb: | 
| 1393                 stroker.cubicTo(pts[1], pts[2], pts[3]); | 1397                 stroker.cubicTo(pts[1], pts[2], pts[3]); | 
| 1394                 lastSegment = SkPath::kCubic_Verb; | 1398                 lastSegment = SkPath::kCubic_Verb; | 
| 1395                 break; | 1399                 break; | 
| 1396             case SkPath::kClose_Verb: | 1400             case SkPath::kClose_Verb: | 
| 1397                 if (stroker.hasOnlyMoveTo() && SkPaint::kButt_Cap != this->getCa
      p()) { | 1401                 if (SkPaint::kButt_Cap != this->getCap()) { | 
| 1398                     /* If the stroke consists of a moveTo followed by a close, t
      reat it | 1402                     /* If the stroke consists of a moveTo followed by a close, t
      reat it | 
| 1399                        as if it were followed by a zero-length line. Lines witho
      ut length | 1403                        as if it were followed by a zero-length line. Lines witho
      ut length | 
| 1400                        can have square and round end caps. */ | 1404                        can have square and round end caps. */ | 
| 1401                     stroker.lineTo(stroker.moveToPt()); | 1405                     if (stroker.hasOnlyMoveTo()) { | 
| 1402                     lastSegment = SkPath::kLine_Verb; | 1406                         stroker.lineTo(stroker.moveToPt()); | 
| 1403                     break; | 1407                         goto ZERO_LENGTH; | 
|  | 1408                     } | 
|  | 1409                     /* If the stroke consists of a moveTo followed by one or mor
      e zero-length | 
|  | 1410                        verbs, then followed by a close, treat is as if it were f
      ollowed by a | 
|  | 1411                        zero-length line. Lines without length can have square & 
      round end caps. */ | 
|  | 1412                     if (stroker.isZeroLength()) { | 
|  | 1413                 ZERO_LENGTH: | 
|  | 1414                         lastSegment = SkPath::kLine_Verb; | 
|  | 1415                         break; | 
|  | 1416                     } | 
| 1404                 } | 1417                 } | 
| 1405                 stroker.close(lastSegment == SkPath::kLine_Verb); | 1418                 stroker.close(lastSegment == SkPath::kLine_Verb); | 
| 1406                 break; | 1419                 break; | 
| 1407             case SkPath::kDone_Verb: | 1420             case SkPath::kDone_Verb: | 
| 1408                 goto DONE; | 1421                 goto DONE; | 
| 1409         } | 1422         } | 
| 1410     } | 1423     } | 
| 1411 DONE: | 1424 DONE: | 
| 1412     stroker.done(dst, lastSegment == SkPath::kLine_Verb); | 1425     stroker.done(dst, lastSegment == SkPath::kLine_Verb); | 
| 1413 | 1426 | 
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1518         default: | 1531         default: | 
| 1519             break; | 1532             break; | 
| 1520     } | 1533     } | 
| 1521 | 1534 | 
| 1522     if (fWidth < SkMinScalar(rw, rh) && !fDoFill) { | 1535     if (fWidth < SkMinScalar(rw, rh) && !fDoFill) { | 
| 1523         r = rect; | 1536         r = rect; | 
| 1524         r.inset(radius, radius); | 1537         r.inset(radius, radius); | 
| 1525         dst->addRect(r, reverse_direction(dir)); | 1538         dst->addRect(r, reverse_direction(dir)); | 
| 1526     } | 1539     } | 
| 1527 } | 1540 } | 
| OLD | NEW | 
|---|