OLD | NEW |
1 | |
2 /* | 1 /* |
3 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
4 * | 3 * |
5 * 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 |
6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
7 */ | 6 */ |
| 7 |
| 8 #include "SkCanvas.h" |
8 #include "SkClipStack.h" | 9 #include "SkClipStack.h" |
9 #include "SkPath.h" | 10 #include "SkPath.h" |
10 #include "SkThread.h" | 11 #include "SkThread.h" |
11 | 12 |
12 #include <new> | 13 #include <new> |
13 | 14 |
14 | 15 |
15 // 0-2 are reserved for invalid, empty & wide-open | 16 // 0-2 are reserved for invalid, empty & wide-open |
16 static const int32_t kFirstUnreservedGenID = 3; | 17 static const int32_t kFirstUnreservedGenID = 3; |
17 int32_t SkClipStack::gGenID = kFirstUnreservedGenID; | 18 int32_t SkClipStack::gGenID = kFirstUnreservedGenID; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 case kRect_Type: | 60 case kRect_Type: |
60 return this->getRect() == element.getRect(); | 61 return this->getRect() == element.getRect(); |
61 case kEmpty_Type: | 62 case kEmpty_Type: |
62 return true; | 63 return true; |
63 default: | 64 default: |
64 SkDEBUGFAIL("Unexpected type."); | 65 SkDEBUGFAIL("Unexpected type."); |
65 return false; | 66 return false; |
66 } | 67 } |
67 } | 68 } |
68 | 69 |
| 70 void SkClipStack::Element::replay(SkCanvasClipVisitor* visitor) const { |
| 71 static const SkRect kEmptyRect = { 0, 0, 0, 0 }; |
| 72 |
| 73 switch (fType) { |
| 74 case kPath_Type: |
| 75 visitor->clipPath(this->getPath(), this->getOp(), this->isAA()); |
| 76 break; |
| 77 case kRRect_Type: |
| 78 visitor->clipRRect(this->getRRect(), this->getOp(), this->isAA()); |
| 79 break; |
| 80 case kRect_Type: |
| 81 visitor->clipRect(this->getRect(), this->getOp(), this->isAA()); |
| 82 break; |
| 83 case kEmpty_Type: |
| 84 visitor->clipRect(kEmptyRect, SkRegion::kIntersect_Op, false); |
| 85 break; |
| 86 } |
| 87 } |
| 88 |
69 void SkClipStack::Element::invertShapeFillType() { | 89 void SkClipStack::Element::invertShapeFillType() { |
70 switch (fType) { | 90 switch (fType) { |
71 case kRect_Type: | 91 case kRect_Type: |
72 fPath.init(); | 92 fPath.init(); |
73 fPath.get()->addRect(this->getRect()); | 93 fPath.get()->addRect(this->getRect()); |
74 fPath.get()->setFillType(SkPath::kInverseEvenOdd_FillType); | 94 fPath.get()->setFillType(SkPath::kInverseEvenOdd_FillType); |
75 fType = kPath_Type; | 95 fType = kPath_Type; |
76 break; | 96 break; |
77 case kRRect_Type: | 97 case kRRect_Type: |
78 fPath.init(); | 98 fPath.init(); |
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 return kWideOpenGenID; | 838 return kWideOpenGenID; |
819 } | 839 } |
820 | 840 |
821 const Element* back = static_cast<const Element*>(fDeque.back()); | 841 const Element* back = static_cast<const Element*>(fDeque.back()); |
822 if (kInsideOut_BoundsType == back->fFiniteBoundType && back->fFiniteBound.is
Empty()) { | 842 if (kInsideOut_BoundsType == back->fFiniteBoundType && back->fFiniteBound.is
Empty()) { |
823 return kWideOpenGenID; | 843 return kWideOpenGenID; |
824 } | 844 } |
825 | 845 |
826 return back->getGenID(); | 846 return back->getGenID(); |
827 } | 847 } |
OLD | NEW |