Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/core/SkClipStack.cpp

Issue 1793373002: Add asRRect method to SkClipStack::Element (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: comments Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/core/SkClipStack.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 7
8 #include "SkAtomics.h" 8 #include "SkAtomics.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkClipStack.h" 10 #include "SkClipStack.h"
11 #include "SkPath.h" 11 #include "SkPath.h"
12 #include "SkPathOps.h" 12 #include "SkPathOps.h"
13 13
14 #include <new> 14 #include <new>
15 15
16 16
17 // 0-2 are reserved for invalid, empty & wide-open 17 // 0-2 are reserved for invalid, empty & wide-open
18 static const int32_t kFirstUnreservedGenID = 3; 18 static const int32_t kFirstUnreservedGenID = 3;
19 int32_t SkClipStack::gGenID = kFirstUnreservedGenID; 19 int32_t SkClipStack::gGenID = kFirstUnreservedGenID;
20 20
21 SkClipStack::Element::Element(const Element& that) { 21 SkClipStack::Element::Element(const Element& that) {
22 switch (that.getType()) { 22 switch (that.getType()) {
23 case kEmpty_Type: 23 case kEmpty_Type:
24 fRRect.setEmpty();
bsalomon 2016/03/17 13:07:12 Do we really care about doing this? The reason the
24 fPath.reset(); 25 fPath.reset();
25 break; 26 break;
26 case kRect_Type: // Rect uses rrect 27 case kRect_Type: // Rect uses rrect
27 case kRRect_Type: 28 case kRRect_Type:
28 fPath.reset(); 29 fPath.reset();
29 fRRect = that.fRRect; 30 fRRect = that.fRRect;
30 break; 31 break;
31 case kPath_Type: 32 case kPath_Type:
32 fPath.set(that.getPath()); 33 fPath.set(that.getPath());
33 break; 34 break;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 fPath.reset(); 165 fPath.reset();
165 fGenID = kEmptyGenID; 166 fGenID = kEmptyGenID;
166 SkDEBUGCODE(this->checkEmpty();) 167 SkDEBUGCODE(this->checkEmpty();)
167 } 168 }
168 169
169 void SkClipStack::Element::checkEmpty() const { 170 void SkClipStack::Element::checkEmpty() const {
170 SkASSERT(fFiniteBound.isEmpty()); 171 SkASSERT(fFiniteBound.isEmpty());
171 SkASSERT(kNormal_BoundsType == fFiniteBoundType); 172 SkASSERT(kNormal_BoundsType == fFiniteBoundType);
172 SkASSERT(!fIsIntersectionOfRects); 173 SkASSERT(!fIsIntersectionOfRects);
173 SkASSERT(kEmptyGenID == fGenID); 174 SkASSERT(kEmptyGenID == fGenID);
175 SkASSERT(fRRect.isEmpty());
174 SkASSERT(!fPath.isValid()); 176 SkASSERT(!fPath.isValid());
175 } 177 }
176 178
177 bool SkClipStack::Element::canBeIntersectedInPlace(int saveCount, SkRegion::Op o p) const { 179 bool SkClipStack::Element::canBeIntersectedInPlace(int saveCount, SkRegion::Op o p) const {
178 if (kEmpty_Type == fType && 180 if (kEmpty_Type == fType &&
179 (SkRegion::kDifference_Op == op || SkRegion::kIntersect_Op == op)) { 181 (SkRegion::kDifference_Op == op || SkRegion::kIntersect_Op == op)) {
180 return true; 182 return true;
181 } 183 }
182 // Only clips within the same save/restore frame (as captured by 184 // Only clips within the same save/restore frame (as captured by
183 // the save count) can be merged 185 // the save count) can be merged
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 911
910 void SkClipStack::dump() const { 912 void SkClipStack::dump() const {
911 B2TIter iter(*this); 913 B2TIter iter(*this);
912 const Element* e; 914 const Element* e;
913 while ((e = iter.next())) { 915 while ((e = iter.next())) {
914 e->dump(); 916 e->dump();
915 SkDebugf("\n"); 917 SkDebugf("\n");
916 } 918 }
917 } 919 }
918 #endif 920 #endif
OLDNEW
« no previous file with comments | « include/core/SkClipStack.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698