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 18 matching lines...) Expand all Loading... |
29 temp->~GrClipStackFrame(); | 29 temp->~GrClipStackFrame(); |
30 fStack.pop_back(); | 30 fStack.pop_back(); |
31 } | 31 } |
32 } | 32 } |
33 | 33 |
34 bool canReuse(int32_t clipGenID, const SkIRect& bounds) { | 34 bool canReuse(int32_t clipGenID, const SkIRect& bounds) { |
35 | 35 |
36 SkASSERT(clipGenID != SkClipStack::kWideOpenGenID); | 36 SkASSERT(clipGenID != SkClipStack::kWideOpenGenID); |
37 SkASSERT(clipGenID != SkClipStack::kEmptyGenID); | 37 SkASSERT(clipGenID != SkClipStack::kEmptyGenID); |
38 | 38 |
39 if (SkClipStack::kInvalidGenID == clipGenID) { | |
40 return false; | |
41 } | |
42 | |
43 GrClipStackFrame* back = (GrClipStackFrame*) fStack.back(); | 39 GrClipStackFrame* back = (GrClipStackFrame*) fStack.back(); |
44 | 40 |
45 // We could reuse the mask if bounds is a subset of last bounds. We'd ha
ve to communicate | 41 // We could reuse the mask if bounds is a subset of last bounds. We'd ha
ve to communicate |
46 // an offset to the caller. | 42 // an offset to the caller. |
47 if (back->fLastMask.texture() && | 43 if (back->fLastMask.texture() && |
48 back->fLastBound == bounds && | 44 back->fLastBound == bounds && |
49 back->fLastClipGenID == clipGenID) { | 45 back->fLastClipGenID == clipGenID) { |
50 return true; | 46 return true; |
51 } | 47 } |
52 | 48 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 SkIRect fLastBound; | 226 SkIRect fLastBound; |
231 }; | 227 }; |
232 | 228 |
233 GrContext* fContext; | 229 GrContext* fContext; |
234 SkDeque fStack; | 230 SkDeque fStack; |
235 | 231 |
236 typedef SkNoncopyable INHERITED; | 232 typedef SkNoncopyable INHERITED; |
237 }; | 233 }; |
238 | 234 |
239 #endif // GrClipMaskCache_DEFINED | 235 #endif // GrClipMaskCache_DEFINED |
OLD | NEW |