| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 GrClipMaskCache_DEFINED | 8 #ifndef GrClipMaskCache_DEFINED |
| 9 #define GrClipMaskCache_DEFINED | 9 #define GrClipMaskCache_DEFINED |
| 10 | 10 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 return NULL; | 111 return NULL; |
| 112 } | 112 } |
| 113 | 113 |
| 114 GrClipStackFrame* back = (GrClipStackFrame*) fStack.back(); | 114 GrClipStackFrame* back = (GrClipStackFrame*) fStack.back(); |
| 115 | 115 |
| 116 return back->fLastMask.texture(); | 116 return back->fLastMask.texture(); |
| 117 } | 117 } |
| 118 | 118 |
| 119 void acquireMask(int32_t clipGenID, | 119 void acquireMask(int32_t clipGenID, |
| 120 const GrTextureDesc& desc, | 120 const GrTextureDesc& desc, |
| 121 const GrIRect& bound) { | 121 const SkIRect& bound) { |
| 122 | 122 |
| 123 if (fStack.empty()) { | 123 if (fStack.empty()) { |
| 124 GrAssert(false); | 124 GrAssert(false); |
| 125 return; | 125 return; |
| 126 } | 126 } |
| 127 | 127 |
| 128 GrClipStackFrame* back = (GrClipStackFrame*) fStack.back(); | 128 GrClipStackFrame* back = (GrClipStackFrame*) fStack.back(); |
| 129 | 129 |
| 130 back->acquireMask(fContext, clipGenID, desc, bound); | 130 back->acquireMask(fContext, clipGenID, desc, bound); |
| 131 } | 131 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 155 | 155 |
| 156 GrClipStackFrame* back = (GrClipStackFrame*) fStack.back(); | 156 GrClipStackFrame* back = (GrClipStackFrame*) fStack.back(); |
| 157 | 157 |
| 158 if (NULL == back->fLastMask.texture()) { | 158 if (NULL == back->fLastMask.texture()) { |
| 159 return -1; | 159 return -1; |
| 160 } | 160 } |
| 161 | 161 |
| 162 return back->fLastMask.texture()->height(); | 162 return back->fLastMask.texture()->height(); |
| 163 } | 163 } |
| 164 | 164 |
| 165 void getLastBound(GrIRect* bound) const { | 165 void getLastBound(SkIRect* bound) const { |
| 166 | 166 |
| 167 if (fStack.empty()) { | 167 if (fStack.empty()) { |
| 168 GrAssert(false); | 168 GrAssert(false); |
| 169 bound->setEmpty(); | 169 bound->setEmpty(); |
| 170 return; | 170 return; |
| 171 } | 171 } |
| 172 | 172 |
| 173 GrClipStackFrame* back = (GrClipStackFrame*) fStack.back(); | 173 GrClipStackFrame* back = (GrClipStackFrame*) fStack.back(); |
| 174 | 174 |
| 175 *bound = back->fLastBound; | 175 *bound = back->fLastBound; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 196 private: | 196 private: |
| 197 struct GrClipStackFrame { | 197 struct GrClipStackFrame { |
| 198 | 198 |
| 199 GrClipStackFrame() { | 199 GrClipStackFrame() { |
| 200 this->reset(); | 200 this->reset(); |
| 201 } | 201 } |
| 202 | 202 |
| 203 void acquireMask(GrContext* context, | 203 void acquireMask(GrContext* context, |
| 204 int32_t clipGenID, | 204 int32_t clipGenID, |
| 205 const GrTextureDesc& desc, | 205 const GrTextureDesc& desc, |
| 206 const GrIRect& bound) { | 206 const SkIRect& bound) { |
| 207 | 207 |
| 208 fLastClipGenID = clipGenID; | 208 fLastClipGenID = clipGenID; |
| 209 | 209 |
| 210 fLastMask.set(context, desc); | 210 fLastMask.set(context, desc); |
| 211 | 211 |
| 212 fLastBound = bound; | 212 fLastBound = bound; |
| 213 } | 213 } |
| 214 | 214 |
| 215 void reset () { | 215 void reset () { |
| 216 fLastClipGenID = SkClipStack::kInvalidGenID; | 216 fLastClipGenID = SkClipStack::kInvalidGenID; |
| 217 | 217 |
| 218 GrTextureDesc desc; | 218 GrTextureDesc desc; |
| 219 | 219 |
| 220 fLastMask.set(NULL, desc); | 220 fLastMask.set(NULL, desc); |
| 221 fLastBound.setEmpty(); | 221 fLastBound.setEmpty(); |
| 222 } | 222 } |
| 223 | 223 |
| 224 int32_t fLastClipGenID; | 224 int32_t fLastClipGenID; |
| 225 // The mask's width & height values are used by GrClipMaskManager to cor
rectly scale the | 225 // The mask's width & height values are used by GrClipMaskManager to cor
rectly scale the |
| 226 // texture coords for the geometry drawn with this mask. | 226 // texture coords for the geometry drawn with this mask. |
| 227 GrAutoScratchTexture fLastMask; | 227 GrAutoScratchTexture fLastMask; |
| 228 // fLastBound stores the bounding box of the clip mask in clip-stack spa
ce. This rect is | 228 // fLastBound stores the bounding box of the clip mask in clip-stack spa
ce. This rect is |
| 229 // used by GrClipMaskManager to position a rect and compute texture coor
ds for the mask. | 229 // used by GrClipMaskManager to position a rect and compute texture coor
ds for the mask. |
| 230 GrIRect fLastBound; | 230 SkIRect fLastBound; |
| 231 }; | 231 }; |
| 232 | 232 |
| 233 GrContext* fContext; | 233 GrContext* fContext; |
| 234 SkDeque fStack; | 234 SkDeque fStack; |
| 235 | 235 |
| 236 typedef GrNoncopyable INHERITED; | 236 typedef GrNoncopyable INHERITED; |
| 237 }; | 237 }; |
| 238 | 238 |
| 239 #endif // GrClipMaskCache_DEFINED | 239 #endif // GrClipMaskCache_DEFINED |
| OLD | NEW |