| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "SkBuffer.h" | 10 #include "SkBuffer.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 */ | 140 */ |
| 141 | 141 |
| 142 //////////////////////////////////////////////////////////////////////////// | 142 //////////////////////////////////////////////////////////////////////////// |
| 143 | 143 |
| 144 // flag to require a moveTo if we begin with something else, like lineTo etc. | 144 // flag to require a moveTo if we begin with something else, like lineTo etc. |
| 145 #define INITIAL_LASTMOVETOINDEX_VALUE ~0 | 145 #define INITIAL_LASTMOVETOINDEX_VALUE ~0 |
| 146 | 146 |
| 147 SkPath::SkPath() | 147 SkPath::SkPath() |
| 148 : fPathRef(SkPathRef::CreateEmpty()) | 148 : fPathRef(SkPathRef::CreateEmpty()) |
| 149 #ifdef SK_BUILD_FOR_ANDROID | 149 #ifdef SK_BUILD_FOR_ANDROID |
| 150 , fGenerationID(0) | 150 , fSourcePath(NULL) |
| 151 #endif | 151 #endif |
| 152 { | 152 { |
| 153 this->resetFields(); | 153 this->resetFields(); |
| 154 } | 154 } |
| 155 | 155 |
| 156 void SkPath::resetFields() { | 156 void SkPath::resetFields() { |
| 157 //fPathRef is assumed to have been emptied by the caller. | 157 //fPathRef is assumed to have been emptied by the caller. |
| 158 fLastMoveToIndex = INITIAL_LASTMOVETOINDEX_VALUE; | 158 fLastMoveToIndex = INITIAL_LASTMOVETOINDEX_VALUE; |
| 159 fFillType = kWinding_FillType; | 159 fFillType = kWinding_FillType; |
| 160 fSegmentMask = 0; | 160 fSegmentMask = 0; |
| 161 fConvexity = kUnknown_Convexity; | 161 fConvexity = kUnknown_Convexity; |
| 162 fDirection = kUnknown_Direction; | 162 fDirection = kUnknown_Direction; |
| 163 fIsOval = false; | 163 fIsOval = false; |
| 164 #ifdef SK_BUILD_FOR_ANDROID | 164 |
| 165 GEN_ID_INC; | 165 // We don't touch Android's fSourcePath. It's used to track texture garbage
collection, so we |
| 166 // We don't touch fSourcePath. It's used to track texture garbage collectio
n, so we don't | 166 // don't want to muck with it if it's been set to something non-NULL. |
| 167 // want to muck with it if it's been set to something non-NULL. | |
| 168 #endif | |
| 169 } | 167 } |
| 170 | 168 |
| 171 SkPath::SkPath(const SkPath& that) | 169 SkPath::SkPath(const SkPath& that) |
| 172 : fPathRef(SkRef(that.fPathRef.get())) { | 170 : fPathRef(SkRef(that.fPathRef.get())) { |
| 173 this->copyFields(that); | 171 this->copyFields(that); |
| 174 #ifdef SK_BUILD_FOR_ANDROID | 172 #ifdef SK_BUILD_FOR_ANDROID |
| 175 fGenerationID = that.fGenerationID; | |
| 176 fSourcePath = that.fSourcePath; | 173 fSourcePath = that.fSourcePath; |
| 177 #endif | 174 #endif |
| 178 SkDEBUGCODE(that.validate();) | 175 SkDEBUGCODE(that.validate();) |
| 179 } | 176 } |
| 180 | 177 |
| 181 SkPath::~SkPath() { | 178 SkPath::~SkPath() { |
| 182 SkDEBUGCODE(this->validate();) | 179 SkDEBUGCODE(this->validate();) |
| 183 } | 180 } |
| 184 | 181 |
| 185 SkPath& SkPath::operator=(const SkPath& that) { | 182 SkPath& SkPath::operator=(const SkPath& that) { |
| 186 SkDEBUGCODE(that.validate();) | 183 SkDEBUGCODE(that.validate();) |
| 187 | 184 |
| 188 if (this != &that) { | 185 if (this != &that) { |
| 189 fPathRef.reset(SkRef(that.fPathRef.get())); | 186 fPathRef.reset(SkRef(that.fPathRef.get())); |
| 190 this->copyFields(that); | 187 this->copyFields(that); |
| 191 #ifdef SK_BUILD_FOR_ANDROID | 188 #ifdef SK_BUILD_FOR_ANDROID |
| 192 GEN_ID_INC; // Similar to swap, we can't just copy this or it could go
back in time. | |
| 193 fSourcePath = that.fSourcePath; | 189 fSourcePath = that.fSourcePath; |
| 194 #endif | 190 #endif |
| 195 } | 191 } |
| 196 SkDEBUGCODE(this->validate();) | 192 SkDEBUGCODE(this->validate();) |
| 197 return *this; | 193 return *this; |
| 198 } | 194 } |
| 199 | 195 |
| 200 void SkPath::copyFields(const SkPath& that) { | 196 void SkPath::copyFields(const SkPath& that) { |
| 201 //fPathRef is assumed to have been set by the caller. | 197 //fPathRef is assumed to have been set by the caller. |
| 202 fLastMoveToIndex = that.fLastMoveToIndex; | 198 fLastMoveToIndex = that.fLastMoveToIndex; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 225 | 221 |
| 226 if (this != &that) { | 222 if (this != &that) { |
| 227 fPathRef.swap(&that.fPathRef); | 223 fPathRef.swap(&that.fPathRef); |
| 228 SkTSwap<int>(fLastMoveToIndex, that.fLastMoveToIndex); | 224 SkTSwap<int>(fLastMoveToIndex, that.fLastMoveToIndex); |
| 229 SkTSwap<uint8_t>(fFillType, that.fFillType); | 225 SkTSwap<uint8_t>(fFillType, that.fFillType); |
| 230 SkTSwap<uint8_t>(fSegmentMask, that.fSegmentMask); | 226 SkTSwap<uint8_t>(fSegmentMask, that.fSegmentMask); |
| 231 SkTSwap<uint8_t>(fConvexity, that.fConvexity); | 227 SkTSwap<uint8_t>(fConvexity, that.fConvexity); |
| 232 SkTSwap<uint8_t>(fDirection, that.fDirection); | 228 SkTSwap<uint8_t>(fDirection, that.fDirection); |
| 233 SkTSwap<SkBool8>(fIsOval, that.fIsOval); | 229 SkTSwap<SkBool8>(fIsOval, that.fIsOval); |
| 234 #ifdef SK_BUILD_FOR_ANDROID | 230 #ifdef SK_BUILD_FOR_ANDROID |
| 235 // It doesn't really make sense to swap the generation IDs here, because
they might go | |
| 236 // backwards. To be safe we increment both to mark them both as changed
. | |
| 237 GEN_ID_INC; | |
| 238 GEN_ID_PTR_INC(&that); | |
| 239 SkTSwap<const SkPath*>(fSourcePath, that.fSourcePath); | 231 SkTSwap<const SkPath*>(fSourcePath, that.fSourcePath); |
| 240 #endif | 232 #endif |
| 241 } | 233 } |
| 242 } | 234 } |
| 243 | 235 |
| 244 static inline bool check_edge_against_rect(const SkPoint& p0, | 236 static inline bool check_edge_against_rect(const SkPoint& p0, |
| 245 const SkPoint& p1, | 237 const SkPoint& p1, |
| 246 const SkRect& rect, | 238 const SkRect& rect, |
| 247 SkPath::Direction dir) { | 239 SkPath::Direction dir) { |
| 248 const SkPoint* edgeBegin; | 240 const SkPoint* edgeBegin; |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 if (!check_edge_against_rect(prevPt, pts[nextPt], rect, direction))
{ | 313 if (!check_edge_against_rect(prevPt, pts[nextPt], rect, direction))
{ |
| 322 return false; | 314 return false; |
| 323 } | 315 } |
| 324 prevPt = pts[nextPt]; | 316 prevPt = pts[nextPt]; |
| 325 } | 317 } |
| 326 } | 318 } |
| 327 | 319 |
| 328 return check_edge_against_rect(prevPt, firstPt, rect, direction); | 320 return check_edge_against_rect(prevPt, firstPt, rect, direction); |
| 329 } | 321 } |
| 330 | 322 |
| 323 uint32_t SkPath::getGenerationID() const { |
| 324 uint32_t genID = fPathRef->genID(); |
| 331 #ifdef SK_BUILD_FOR_ANDROID | 325 #ifdef SK_BUILD_FOR_ANDROID |
| 332 uint32_t SkPath::getGenerationID() const { | 326 SkASSERT((unsigned)fFillType < (1 << (32 - kPathRefGenIDBitCnt))); |
| 333 return fGenerationID; | 327 genID |= static_cast<uint32_t>(fFillType) << kPathRefGenIDBitCnt; |
| 328 #endif |
| 329 return genID; |
| 334 } | 330 } |
| 335 | 331 |
| 332 #ifdef SK_BUILD_FOR_ANDROID |
| 336 const SkPath* SkPath::getSourcePath() const { | 333 const SkPath* SkPath::getSourcePath() const { |
| 337 return fSourcePath; | 334 return fSourcePath; |
| 338 } | 335 } |
| 339 | 336 |
| 340 void SkPath::setSourcePath(const SkPath* path) { | 337 void SkPath::setSourcePath(const SkPath* path) { |
| 341 fSourcePath = path; | 338 fSourcePath = path; |
| 342 } | 339 } |
| 343 #endif | 340 #endif |
| 344 | 341 |
| 345 void SkPath::reset() { | 342 void SkPath::reset() { |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 void SkPath::setLastPt(SkScalar x, SkScalar y) { | 623 void SkPath::setLastPt(SkScalar x, SkScalar y) { |
| 627 SkDEBUGCODE(this->validate();) | 624 SkDEBUGCODE(this->validate();) |
| 628 | 625 |
| 629 int count = fPathRef->countPoints(); | 626 int count = fPathRef->countPoints(); |
| 630 if (count == 0) { | 627 if (count == 0) { |
| 631 this->moveTo(x, y); | 628 this->moveTo(x, y); |
| 632 } else { | 629 } else { |
| 633 fIsOval = false; | 630 fIsOval = false; |
| 634 SkPathRef::Editor ed(&fPathRef); | 631 SkPathRef::Editor ed(&fPathRef); |
| 635 ed.atPoint(count-1)->set(x, y); | 632 ed.atPoint(count-1)->set(x, y); |
| 636 GEN_ID_INC; | |
| 637 } | 633 } |
| 638 } | 634 } |
| 639 | 635 |
| 640 void SkPath::setConvexity(Convexity c) { | 636 void SkPath::setConvexity(Convexity c) { |
| 641 if (fConvexity != c) { | 637 if (fConvexity != c) { |
| 642 fConvexity = c; | 638 fConvexity = c; |
| 643 GEN_ID_INC; | |
| 644 } | 639 } |
| 645 } | 640 } |
| 646 | 641 |
| 647 ////////////////////////////////////////////////////////////////////////////// | 642 ////////////////////////////////////////////////////////////////////////////// |
| 648 // Construction methods | 643 // Construction methods |
| 649 | 644 |
| 650 #define DIRTY_AFTER_EDIT \ | 645 #define DIRTY_AFTER_EDIT \ |
| 651 do { \ | 646 do { \ |
| 652 fConvexity = kUnknown_Convexity; \ | 647 fConvexity = kUnknown_Convexity; \ |
| 653 fDirection = kUnknown_Direction; \ | 648 fDirection = kUnknown_Direction; \ |
| 654 fIsOval = false; \ | 649 fIsOval = false; \ |
| 655 } while (0) | 650 } while (0) |
| 656 | 651 |
| 657 void SkPath::incReserve(U16CPU inc) { | 652 void SkPath::incReserve(U16CPU inc) { |
| 658 SkDEBUGCODE(this->validate();) | 653 SkDEBUGCODE(this->validate();) |
| 659 SkPathRef::Editor(&fPathRef, inc, inc); | 654 SkPathRef::Editor(&fPathRef, inc, inc); |
| 660 SkDEBUGCODE(this->validate();) | 655 SkDEBUGCODE(this->validate();) |
| 661 } | 656 } |
| 662 | 657 |
| 663 void SkPath::moveTo(SkScalar x, SkScalar y) { | 658 void SkPath::moveTo(SkScalar x, SkScalar y) { |
| 664 SkDEBUGCODE(this->validate();) | 659 SkDEBUGCODE(this->validate();) |
| 665 | 660 |
| 666 SkPathRef::Editor ed(&fPathRef); | 661 SkPathRef::Editor ed(&fPathRef); |
| 667 | 662 |
| 668 // remember our index | 663 // remember our index |
| 669 fLastMoveToIndex = ed.pathRef()->countPoints(); | 664 fLastMoveToIndex = ed.pathRef()->countPoints(); |
| 670 | 665 |
| 671 ed.growForVerb(kMove_Verb)->set(x, y); | 666 ed.growForVerb(kMove_Verb)->set(x, y); |
| 672 | |
| 673 GEN_ID_INC; | |
| 674 } | 667 } |
| 675 | 668 |
| 676 void SkPath::rMoveTo(SkScalar x, SkScalar y) { | 669 void SkPath::rMoveTo(SkScalar x, SkScalar y) { |
| 677 SkPoint pt; | 670 SkPoint pt; |
| 678 this->getLastPt(&pt); | 671 this->getLastPt(&pt); |
| 679 this->moveTo(pt.fX + x, pt.fY + y); | 672 this->moveTo(pt.fX + x, pt.fY + y); |
| 680 } | 673 } |
| 681 | 674 |
| 682 void SkPath::injectMoveToIfNeeded() { | 675 void SkPath::injectMoveToIfNeeded() { |
| 683 if (fLastMoveToIndex < 0) { | 676 if (fLastMoveToIndex < 0) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 695 | 688 |
| 696 void SkPath::lineTo(SkScalar x, SkScalar y) { | 689 void SkPath::lineTo(SkScalar x, SkScalar y) { |
| 697 SkDEBUGCODE(this->validate();) | 690 SkDEBUGCODE(this->validate();) |
| 698 | 691 |
| 699 this->injectMoveToIfNeeded(); | 692 this->injectMoveToIfNeeded(); |
| 700 | 693 |
| 701 SkPathRef::Editor ed(&fPathRef); | 694 SkPathRef::Editor ed(&fPathRef); |
| 702 ed.growForVerb(kLine_Verb)->set(x, y); | 695 ed.growForVerb(kLine_Verb)->set(x, y); |
| 703 fSegmentMask |= kLine_SegmentMask; | 696 fSegmentMask |= kLine_SegmentMask; |
| 704 | 697 |
| 705 GEN_ID_INC; | |
| 706 DIRTY_AFTER_EDIT; | 698 DIRTY_AFTER_EDIT; |
| 707 } | 699 } |
| 708 | 700 |
| 709 void SkPath::rLineTo(SkScalar x, SkScalar y) { | 701 void SkPath::rLineTo(SkScalar x, SkScalar y) { |
| 710 this->injectMoveToIfNeeded(); // This can change the result of this->getLas
tPt(). | 702 this->injectMoveToIfNeeded(); // This can change the result of this->getLas
tPt(). |
| 711 SkPoint pt; | 703 SkPoint pt; |
| 712 this->getLastPt(&pt); | 704 this->getLastPt(&pt); |
| 713 this->lineTo(pt.fX + x, pt.fY + y); | 705 this->lineTo(pt.fX + x, pt.fY + y); |
| 714 } | 706 } |
| 715 | 707 |
| 716 void SkPath::quadTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2) { | 708 void SkPath::quadTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2) { |
| 717 SkDEBUGCODE(this->validate();) | 709 SkDEBUGCODE(this->validate();) |
| 718 | 710 |
| 719 this->injectMoveToIfNeeded(); | 711 this->injectMoveToIfNeeded(); |
| 720 | 712 |
| 721 SkPathRef::Editor ed(&fPathRef); | 713 SkPathRef::Editor ed(&fPathRef); |
| 722 SkPoint* pts = ed.growForVerb(kQuad_Verb); | 714 SkPoint* pts = ed.growForVerb(kQuad_Verb); |
| 723 pts[0].set(x1, y1); | 715 pts[0].set(x1, y1); |
| 724 pts[1].set(x2, y2); | 716 pts[1].set(x2, y2); |
| 725 fSegmentMask |= kQuad_SegmentMask; | 717 fSegmentMask |= kQuad_SegmentMask; |
| 726 | 718 |
| 727 GEN_ID_INC; | |
| 728 DIRTY_AFTER_EDIT; | 719 DIRTY_AFTER_EDIT; |
| 729 } | 720 } |
| 730 | 721 |
| 731 void SkPath::rQuadTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2) { | 722 void SkPath::rQuadTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2) { |
| 732 this->injectMoveToIfNeeded(); // This can change the result of this->getLas
tPt(). | 723 this->injectMoveToIfNeeded(); // This can change the result of this->getLas
tPt(). |
| 733 SkPoint pt; | 724 SkPoint pt; |
| 734 this->getLastPt(&pt); | 725 this->getLastPt(&pt); |
| 735 this->quadTo(pt.fX + x1, pt.fY + y1, pt.fX + x2, pt.fY + y2); | 726 this->quadTo(pt.fX + x1, pt.fY + y1, pt.fX + x2, pt.fY + y2); |
| 736 } | 727 } |
| 737 | 728 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 749 SkDEBUGCODE(this->validate();) | 740 SkDEBUGCODE(this->validate();) |
| 750 | 741 |
| 751 this->injectMoveToIfNeeded(); | 742 this->injectMoveToIfNeeded(); |
| 752 | 743 |
| 753 SkPathRef::Editor ed(&fPathRef); | 744 SkPathRef::Editor ed(&fPathRef); |
| 754 SkPoint* pts = ed.growForConic(w); | 745 SkPoint* pts = ed.growForConic(w); |
| 755 pts[0].set(x1, y1); | 746 pts[0].set(x1, y1); |
| 756 pts[1].set(x2, y2); | 747 pts[1].set(x2, y2); |
| 757 fSegmentMask |= kConic_SegmentMask; | 748 fSegmentMask |= kConic_SegmentMask; |
| 758 | 749 |
| 759 GEN_ID_INC; | |
| 760 DIRTY_AFTER_EDIT; | 750 DIRTY_AFTER_EDIT; |
| 761 } | 751 } |
| 762 } | 752 } |
| 763 | 753 |
| 764 void SkPath::rConicTo(SkScalar dx1, SkScalar dy1, SkScalar dx2, SkScalar dy2, | 754 void SkPath::rConicTo(SkScalar dx1, SkScalar dy1, SkScalar dx2, SkScalar dy2, |
| 765 SkScalar w) { | 755 SkScalar w) { |
| 766 this->injectMoveToIfNeeded(); // This can change the result of this->getLas
tPt(). | 756 this->injectMoveToIfNeeded(); // This can change the result of this->getLas
tPt(). |
| 767 SkPoint pt; | 757 SkPoint pt; |
| 768 this->getLastPt(&pt); | 758 this->getLastPt(&pt); |
| 769 this->conicTo(pt.fX + dx1, pt.fY + dy1, pt.fX + dx2, pt.fY + dy2, w); | 759 this->conicTo(pt.fX + dx1, pt.fY + dy1, pt.fX + dx2, pt.fY + dy2, w); |
| 770 } | 760 } |
| 771 | 761 |
| 772 void SkPath::cubicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, | 762 void SkPath::cubicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, |
| 773 SkScalar x3, SkScalar y3) { | 763 SkScalar x3, SkScalar y3) { |
| 774 SkDEBUGCODE(this->validate();) | 764 SkDEBUGCODE(this->validate();) |
| 775 | 765 |
| 776 this->injectMoveToIfNeeded(); | 766 this->injectMoveToIfNeeded(); |
| 777 | 767 |
| 778 SkPathRef::Editor ed(&fPathRef); | 768 SkPathRef::Editor ed(&fPathRef); |
| 779 SkPoint* pts = ed.growForVerb(kCubic_Verb); | 769 SkPoint* pts = ed.growForVerb(kCubic_Verb); |
| 780 pts[0].set(x1, y1); | 770 pts[0].set(x1, y1); |
| 781 pts[1].set(x2, y2); | 771 pts[1].set(x2, y2); |
| 782 pts[2].set(x3, y3); | 772 pts[2].set(x3, y3); |
| 783 fSegmentMask |= kCubic_SegmentMask; | 773 fSegmentMask |= kCubic_SegmentMask; |
| 784 | 774 |
| 785 GEN_ID_INC; | |
| 786 DIRTY_AFTER_EDIT; | 775 DIRTY_AFTER_EDIT; |
| 787 } | 776 } |
| 788 | 777 |
| 789 void SkPath::rCubicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, | 778 void SkPath::rCubicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, |
| 790 SkScalar x3, SkScalar y3) { | 779 SkScalar x3, SkScalar y3) { |
| 791 this->injectMoveToIfNeeded(); // This can change the result of this->getLas
tPt(). | 780 this->injectMoveToIfNeeded(); // This can change the result of this->getLas
tPt(). |
| 792 SkPoint pt; | 781 SkPoint pt; |
| 793 this->getLastPt(&pt); | 782 this->getLastPt(&pt); |
| 794 this->cubicTo(pt.fX + x1, pt.fY + y1, pt.fX + x2, pt.fY + y2, | 783 this->cubicTo(pt.fX + x1, pt.fY + y1, pt.fX + x2, pt.fY + y2, |
| 795 pt.fX + x3, pt.fY + y3); | 784 pt.fX + x3, pt.fY + y3); |
| 796 } | 785 } |
| 797 | 786 |
| 798 void SkPath::close() { | 787 void SkPath::close() { |
| 799 SkDEBUGCODE(this->validate();) | 788 SkDEBUGCODE(this->validate();) |
| 800 | 789 |
| 801 int count = fPathRef->countVerbs(); | 790 int count = fPathRef->countVerbs(); |
| 802 if (count > 0) { | 791 if (count > 0) { |
| 803 switch (fPathRef->atVerb(count - 1)) { | 792 switch (fPathRef->atVerb(count - 1)) { |
| 804 case kLine_Verb: | 793 case kLine_Verb: |
| 805 case kQuad_Verb: | 794 case kQuad_Verb: |
| 806 case kConic_Verb: | 795 case kConic_Verb: |
| 807 case kCubic_Verb: | 796 case kCubic_Verb: |
| 808 case kMove_Verb: { | 797 case kMove_Verb: { |
| 809 SkPathRef::Editor ed(&fPathRef); | 798 SkPathRef::Editor ed(&fPathRef); |
| 810 ed.growForVerb(kClose_Verb); | 799 ed.growForVerb(kClose_Verb); |
| 811 GEN_ID_INC; | |
| 812 break; | 800 break; |
| 813 } | 801 } |
| 814 case kClose_Verb: | 802 case kClose_Verb: |
| 815 // don't add a close if it's the first verb or a repeat | 803 // don't add a close if it's the first verb or a repeat |
| 816 break; | 804 break; |
| 817 default: | 805 default: |
| 818 SkDEBUGFAIL("unexpected verb"); | 806 SkDEBUGFAIL("unexpected verb"); |
| 819 break; | 807 break; |
| 820 } | 808 } |
| 821 } | 809 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 887 for (int i = 1; i < count; ++i) { | 875 for (int i = 1; i < count; ++i) { |
| 888 vb[~i] = kLine_Verb; | 876 vb[~i] = kLine_Verb; |
| 889 } | 877 } |
| 890 } | 878 } |
| 891 fSegmentMask |= kLine_SegmentMask; | 879 fSegmentMask |= kLine_SegmentMask; |
| 892 } | 880 } |
| 893 if (close) { | 881 if (close) { |
| 894 vb[~count] = kClose_Verb; | 882 vb[~count] = kClose_Verb; |
| 895 } | 883 } |
| 896 | 884 |
| 897 GEN_ID_INC; | |
| 898 DIRTY_AFTER_EDIT; | 885 DIRTY_AFTER_EDIT; |
| 899 SkDEBUGCODE(this->validate();) | 886 SkDEBUGCODE(this->validate();) |
| 900 } | 887 } |
| 901 | 888 |
| 902 #include "SkGeometry.h" | 889 #include "SkGeometry.h" |
| 903 | 890 |
| 904 static int build_arc_points(const SkRect& oval, SkScalar startAngle, | 891 static int build_arc_points(const SkRect& oval, SkScalar startAngle, |
| 905 SkScalar sweepAngle, | 892 SkScalar sweepAngle, |
| 906 SkPoint pts[kSkBuildQuadArcStorage]) { | 893 SkPoint pts[kSkBuildQuadArcStorage]) { |
| 907 | 894 |
| (...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1713 dst->fDirection = kUnknown_Direction; | 1700 dst->fDirection = kUnknown_Direction; |
| 1714 } else { | 1701 } else { |
| 1715 SkPathRef::CreateTransformedCopy(&dst->fPathRef, *fPathRef.get(), matrix
); | 1702 SkPathRef::CreateTransformedCopy(&dst->fPathRef, *fPathRef.get(), matrix
); |
| 1716 | 1703 |
| 1717 if (this != dst) { | 1704 if (this != dst) { |
| 1718 dst->fFillType = fFillType; | 1705 dst->fFillType = fFillType; |
| 1719 dst->fSegmentMask = fSegmentMask; | 1706 dst->fSegmentMask = fSegmentMask; |
| 1720 dst->fConvexity = fConvexity; | 1707 dst->fConvexity = fConvexity; |
| 1721 } | 1708 } |
| 1722 | 1709 |
| 1723 #ifdef SK_BUILD_FOR_ANDROID | |
| 1724 if (!matrix.isIdentity() && !dst->hasComputedBounds()) { | |
| 1725 GEN_ID_PTR_INC(dst); | |
| 1726 } | |
| 1727 #endif | |
| 1728 | |
| 1729 if (kUnknown_Direction == fDirection) { | 1710 if (kUnknown_Direction == fDirection) { |
| 1730 dst->fDirection = kUnknown_Direction; | 1711 dst->fDirection = kUnknown_Direction; |
| 1731 } else { | 1712 } else { |
| 1732 SkScalar det2x2 = | 1713 SkScalar det2x2 = |
| 1733 SkScalarMul(matrix.get(SkMatrix::kMScaleX), matrix.get(SkMatrix:
:kMScaleY)) - | 1714 SkScalarMul(matrix.get(SkMatrix::kMScaleX), matrix.get(SkMatrix:
:kMScaleY)) - |
| 1734 SkScalarMul(matrix.get(SkMatrix::kMSkewX), matrix.get(SkMatrix::
kMSkewY)); | 1715 SkScalarMul(matrix.get(SkMatrix::kMSkewX), matrix.get(SkMatrix::
kMSkewY)); |
| 1735 if (det2x2 < 0) { | 1716 if (det2x2 < 0) { |
| 1736 dst->fDirection = SkPath::OppositeDirection(static_cast<Directio
n>(fDirection)); | 1717 dst->fDirection = SkPath::OppositeDirection(static_cast<Directio
n>(fDirection)); |
| 1737 } else if (det2x2 > 0) { | 1718 } else if (det2x2 > 0) { |
| 1738 dst->fDirection = fDirection; | 1719 dst->fDirection = fDirection; |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2127 #endif | 2108 #endif |
| 2128 | 2109 |
| 2129 fPathRef.reset(SkPathRef::CreateFromBuffer(&buffer | 2110 fPathRef.reset(SkPathRef::CreateFromBuffer(&buffer |
| 2130 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V14_AND_ALL_OTHER_INSTANCES_TO
O | 2111 #ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V14_AND_ALL_OTHER_INSTANCES_TO
O |
| 2131 , newFormat, packed) | 2112 , newFormat, packed) |
| 2132 #endif | 2113 #endif |
| 2133 ); | 2114 ); |
| 2134 | 2115 |
| 2135 buffer.skipToAlign4(); | 2116 buffer.skipToAlign4(); |
| 2136 | 2117 |
| 2137 GEN_ID_INC; | |
| 2138 | |
| 2139 SkDEBUGCODE(this->validate();) | 2118 SkDEBUGCODE(this->validate();) |
| 2140 return SkToU32(buffer.pos()); | 2119 return SkToU32(buffer.pos()); |
| 2141 } | 2120 } |
| 2142 | 2121 |
| 2143 /////////////////////////////////////////////////////////////////////////////// | 2122 /////////////////////////////////////////////////////////////////////////////// |
| 2144 | 2123 |
| 2145 #include "SkString.h" | 2124 #include "SkString.h" |
| 2146 | 2125 |
| 2147 static void append_scalar(SkString* str, SkScalar value) { | 2126 static void append_scalar(SkString* str, SkScalar value) { |
| 2148 SkString tmp; | 2127 SkString tmp; |
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3002 switch (this->getFillType()) { | 2981 switch (this->getFillType()) { |
| 3003 case SkPath::kEvenOdd_FillType: | 2982 case SkPath::kEvenOdd_FillType: |
| 3004 case SkPath::kInverseEvenOdd_FillType: | 2983 case SkPath::kInverseEvenOdd_FillType: |
| 3005 w &= 1; | 2984 w &= 1; |
| 3006 break; | 2985 break; |
| 3007 default: | 2986 default: |
| 3008 break; | 2987 break; |
| 3009 } | 2988 } |
| 3010 return SkToBool(w); | 2989 return SkToBool(w); |
| 3011 } | 2990 } |
| OLD | NEW |