OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
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 #ifndef SkClipStack_DEFINED | 8 #ifndef SkClipStack_DEFINED |
9 #define SkClipStack_DEFINED | 9 #define SkClipStack_DEFINED |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 public: | 41 public: |
42 enum Type { | 42 enum Type { |
43 //!< This element makes the clip empty (regardless of previous eleme
nts). | 43 //!< This element makes the clip empty (regardless of previous eleme
nts). |
44 kEmpty_Type, | 44 kEmpty_Type, |
45 //!< This element combines a rect with the current clip using a set
operation | 45 //!< This element combines a rect with the current clip using a set
operation |
46 kRect_Type, | 46 kRect_Type, |
47 //!< This element combines a round-rect with the current clip using
a set operation | 47 //!< This element combines a round-rect with the current clip using
a set operation |
48 kRRect_Type, | 48 kRRect_Type, |
49 //!< This element combines a path with the current clip using a set
operation | 49 //!< This element combines a path with the current clip using a set
operation |
50 kPath_Type, | 50 kPath_Type, |
| 51 |
| 52 kLastType = kPath_Type |
51 }; | 53 }; |
| 54 static const int kTypeCnt = kLastType + 1; |
52 | 55 |
53 Element() { | 56 Element() { |
54 this->initCommon(0, SkRegion::kReplace_Op, false); | 57 this->initCommon(0, SkRegion::kReplace_Op, false); |
55 this->setEmpty(); | 58 this->setEmpty(); |
56 } | 59 } |
57 | 60 |
58 Element(const Element&); | 61 Element(const Element&); |
59 | 62 |
60 Element(const SkRect& rect, SkRegion::Op op, bool doAA) { | 63 Element(const SkRect& rect, SkRegion::Op op, bool doAA) { |
61 this->initRect(0, rect, op, doAA); | 64 this->initRect(0, rect, op, doAA); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 */ | 161 */ |
159 bool isInverseFilled() const { | 162 bool isInverseFilled() const { |
160 return kPath_Type == fType && fPath.get()->isInverseFillType(); | 163 return kPath_Type == fType && fPath.get()->isInverseFillType(); |
161 } | 164 } |
162 | 165 |
163 /** | 166 /** |
164 * Replay this clip into the visitor. | 167 * Replay this clip into the visitor. |
165 */ | 168 */ |
166 void replay(SkCanvasClipVisitor*) const; | 169 void replay(SkCanvasClipVisitor*) const; |
167 | 170 |
| 171 #ifdef SK_DEVELOPER |
| 172 /** |
| 173 * Dumps the element to SkDebugf. This is intended for Skia development
debugging |
| 174 * Don't rely on the existence of this function or the formatting of its
output. |
| 175 */ |
| 176 void dump() const; |
| 177 #endif |
| 178 |
168 private: | 179 private: |
169 friend class SkClipStack; | 180 friend class SkClipStack; |
170 | 181 |
171 SkTLazy<SkPath> fPath; | 182 SkTLazy<SkPath> fPath; |
172 SkRRect fRRect; | 183 SkRRect fRRect; |
173 int fSaveCount; // save count of stack when this element was
added. | 184 int fSaveCount; // save count of stack when this element was
added. |
174 SkRegion::Op fOp; | 185 SkRegion::Op fOp; |
175 Type fType; | 186 Type fType; |
176 bool fDoAA; | 187 bool fDoAA; |
177 | 188 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 * (potentially ignorable) cases | 345 * (potentially ignorable) cases |
335 */ | 346 */ |
336 static const int32_t kInvalidGenID = 0; //!< Invalid id that is never re
turned by | 347 static const int32_t kInvalidGenID = 0; //!< Invalid id that is never re
turned by |
337 //!< SkClipStack. Useful when ca
ching clips | 348 //!< SkClipStack. Useful when ca
ching clips |
338 //!< based on GenID. | 349 //!< based on GenID. |
339 static const int32_t kEmptyGenID = 1; // no pixels writeable | 350 static const int32_t kEmptyGenID = 1; // no pixels writeable |
340 static const int32_t kWideOpenGenID = 2; // all pixels writeable | 351 static const int32_t kWideOpenGenID = 2; // all pixels writeable |
341 | 352 |
342 int32_t getTopmostGenID() const; | 353 int32_t getTopmostGenID() const; |
343 | 354 |
| 355 #ifdef SK_DEVELOPER |
| 356 /** |
| 357 * Dumps the contents of the clip stack to SkDebugf. This is intended for Sk
ia development |
| 358 * debugging. Don't rely on the existence of this function or the formatting
of its output. |
| 359 */ |
| 360 void dump() const; |
| 361 #endif |
| 362 |
344 public: | 363 public: |
345 class Iter { | 364 class Iter { |
346 public: | 365 public: |
347 enum IterStart { | 366 enum IterStart { |
348 kBottom_IterStart = SkDeque::Iter::kFront_IterStart, | 367 kBottom_IterStart = SkDeque::Iter::kFront_IterStart, |
349 kTop_IterStart = SkDeque::Iter::kBack_IterStart | 368 kTop_IterStart = SkDeque::Iter::kBack_IterStart |
350 }; | 369 }; |
351 | 370 |
352 /** | 371 /** |
353 * Creates an uninitialized iterator. Must be reset() | 372 * Creates an uninitialized iterator. Must be reset() |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 */ | 470 */ |
452 void restoreTo(int saveCount); | 471 void restoreTo(int saveCount); |
453 | 472 |
454 /** | 473 /** |
455 * Return the next unique generation ID. | 474 * Return the next unique generation ID. |
456 */ | 475 */ |
457 static int32_t GetNextGenID(); | 476 static int32_t GetNextGenID(); |
458 }; | 477 }; |
459 | 478 |
460 #endif | 479 #endif |
OLD | NEW |