| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 bool* isIntersectionOfRects = NULL) const { | 141 bool* isIntersectionOfRects = NULL) const { |
| 142 this->getConservativeBounds(surface->width(), surface->height(), | 142 this->getConservativeBounds(surface->width(), surface->height(), |
| 143 devResult, isIntersectionOfRects); | 143 devResult, isIntersectionOfRects); |
| 144 } | 144 } |
| 145 | 145 |
| 146 void getConservativeBounds(int width, int height, | 146 void getConservativeBounds(int width, int height, |
| 147 SkIRect* devResult, | 147 SkIRect* devResult, |
| 148 bool* isIntersectionOfRects = NULL) const; | 148 bool* isIntersectionOfRects = NULL) const; |
| 149 | 149 |
| 150 static const GrClip& WideOpen() { | 150 static const GrClip& WideOpen() { |
| 151 static SkAlignedSStorage<sizeof(GrClip)> g_WideOpenClip_Storage; | 151 static GrClip clip; |
| 152 static GrClip* g_WideOpenClip SkNEW_PLACEMENT(g_WideOpenClip_Storage.get
(), GrClip); | 152 return clip; |
| 153 static SkAutoTDestroy<GrClip> g_WideOpenClip_ad(g_WideOpenClip); | |
| 154 return *g_WideOpenClip_ad; | |
| 155 } | 153 } |
| 156 | 154 |
| 157 enum ClipType { | 155 enum ClipType { |
| 158 kClipStack_ClipType, | 156 kClipStack_ClipType, |
| 159 kWideOpen_ClipType, | 157 kWideOpen_ClipType, |
| 160 kIRect_ClipType, | 158 kIRect_ClipType, |
| 161 }; | 159 }; |
| 162 | 160 |
| 163 ClipType clipType() const { return fClipType; } | 161 ClipType clipType() const { return fClipType; } |
| 164 | 162 |
| 165 private: | 163 private: |
| 166 union Clip { | 164 union Clip { |
| 167 struct ClipStack { | 165 struct ClipStack { |
| 168 const SkClipStack* fStack; | 166 const SkClipStack* fStack; |
| 169 SkIPoint fOrigin; | 167 SkIPoint fOrigin; |
| 170 } fClipStack; | 168 } fClipStack; |
| 171 SkIRect fIRect; | 169 SkIRect fIRect; |
| 172 } fClip; | 170 } fClip; |
| 173 | 171 |
| 174 ClipType fClipType; | 172 ClipType fClipType; |
| 175 }; | 173 }; |
| 176 | 174 |
| 177 #endif | 175 #endif |
| OLD | NEW |