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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 fClipType = kClipStack_ClipType; | 107 fClipType = kClipStack_ClipType; |
108 fClip.fStack = SkRef(clipStack); | 108 fClip.fStack = SkRef(clipStack); |
109 if (origin) { | 109 if (origin) { |
110 fOrigin = *origin; | 110 fOrigin = *origin; |
111 } else { | 111 } else { |
112 fOrigin.setZero(); | 112 fOrigin.setZero(); |
113 } | 113 } |
114 } | 114 } |
115 } | 115 } |
116 | 116 |
| 117 void setIRect(const SkIRect& irect) { |
| 118 this->reset(); |
| 119 fClipType = kIRect_ClipType; |
| 120 fOrigin.setZero(); |
| 121 fClip.fIRect = irect; |
| 122 } |
| 123 |
117 const SkIRect& irect() const { | 124 const SkIRect& irect() const { |
118 SkASSERT(kIRect_ClipType == fClipType); | 125 SkASSERT(kIRect_ClipType == fClipType); |
119 return fClip.fIRect; | 126 return fClip.fIRect; |
120 } | 127 } |
121 | 128 |
122 void reset() { | 129 void reset() { |
123 if (kClipStack_ClipType == fClipType) { | 130 if (kClipStack_ClipType == fClipType) { |
124 fClip.fStack->unref(); | 131 fClip.fStack->unref(); |
125 fClip.fStack = NULL; | 132 fClip.fStack = NULL; |
126 } | 133 } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 union Clip { | 183 union Clip { |
177 const SkClipStack* fStack; | 184 const SkClipStack* fStack; |
178 SkIRect fIRect; | 185 SkIRect fIRect; |
179 } fClip; | 186 } fClip; |
180 | 187 |
181 SkIPoint fOrigin; | 188 SkIPoint fOrigin; |
182 ClipType fClipType; | 189 ClipType fClipType; |
183 }; | 190 }; |
184 | 191 |
185 #endif | 192 #endif |
OLD | NEW |