OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 #ifndef GrClip_DEFINED | 8 #ifndef GrClip_DEFINED |
9 #define GrClip_DEFINED | 9 #define GrClip_DEFINED |
10 | 10 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 bool operator!=(const GrClip& other) const { | 86 bool operator!=(const GrClip& other) const { |
87 return !(*this == other); | 87 return !(*this == other); |
88 } | 88 } |
89 | 89 |
90 const SkClipStack* clipStack() const { | 90 const SkClipStack* clipStack() const { |
91 SkASSERT(kClipStack_ClipType == fClipType); | 91 SkASSERT(kClipStack_ClipType == fClipType); |
92 return fClip.fStack; | 92 return fClip.fStack; |
93 } | 93 } |
94 | 94 |
95 void setClipStack(const SkClipStack* clipStack, const SkIPoint* origin = NUL
L) { | 95 void setClipStack(const SkClipStack* clipStack, const SkIPoint* origin = NUL
L) { |
| 96 this->reset(); |
96 if (clipStack->isWideOpen()) { | 97 if (clipStack->isWideOpen()) { |
97 fClipType = kWideOpen_ClipType; | 98 fClipType = kWideOpen_ClipType; |
98 fOrigin.setZero(); | 99 fOrigin.setZero(); |
99 } else { | 100 } else { |
100 fClipType = kClipStack_ClipType; | 101 fClipType = kClipStack_ClipType; |
101 fClip.fStack = SkRef(clipStack); | 102 fClip.fStack = SkRef(clipStack); |
102 if (origin) { | 103 if (origin) { |
103 fOrigin = *origin; | 104 fOrigin = *origin; |
104 } else { | 105 } else { |
105 fOrigin.setZero(); | 106 fOrigin.setZero(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 union Clip { | 171 union Clip { |
171 const SkClipStack* fStack; | 172 const SkClipStack* fStack; |
172 SkIRect fIRect; | 173 SkIRect fIRect; |
173 } fClip; | 174 } fClip; |
174 | 175 |
175 SkIPoint fOrigin; | 176 SkIPoint fOrigin; |
176 ClipType fClipType; | 177 ClipType fClipType; |
177 }; | 178 }; |
178 | 179 |
179 #endif | 180 #endif |
OLD | NEW |