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 GrClipMaskManager_DEFINED | 8 #ifndef GrClipMaskManager_DEFINED |
9 #define GrClipMaskManager_DEFINED | 9 #define GrClipMaskManager_DEFINED |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 , fClipTarget(NULL) | 43 , fClipTarget(NULL) |
44 , fClipMode(kIgnoreClip_StencilClipMode) { | 44 , fClipMode(kIgnoreClip_StencilClipMode) { |
45 } | 45 } |
46 | 46 |
47 // The state of the scissor is controlled by the clip manager, no one else s
hould set | 47 // The state of the scissor is controlled by the clip manager, no one else s
hould set |
48 // Scissor state. This should really be on Gpu itself. We should revist th
is when GPU | 48 // Scissor state. This should really be on Gpu itself. We should revist th
is when GPU |
49 // and drawtarget are separate | 49 // and drawtarget are separate |
50 struct ScissorState { | 50 struct ScissorState { |
51 ScissorState() : fEnabled(false) {} | 51 ScissorState() : fEnabled(false) {} |
52 void set(const SkIRect& rect) { fRect = rect; fEnabled = true; } | 52 void set(const SkIRect& rect) { fRect = rect; fEnabled = true; } |
| 53 bool operator==(const ScissorState& other) { |
| 54 return fEnabled == other.fEnabled && |
| 55 (false == fEnabled || fRect == other.fRect); |
| 56 } |
| 57 bool operator!=(const ScissorState& other) { return !(*this == other); } |
53 bool fEnabled; | 58 bool fEnabled; |
54 SkIRect fRect; | 59 SkIRect fRect; |
55 }; | 60 }; |
56 | 61 |
57 /** | 62 /** |
58 * Creates a clip mask if necessary as a stencil buffer or alpha texture | 63 * Creates a clip mask if necessary as a stencil buffer or alpha texture |
59 * and sets the GrGpu's scissor and stencil state. If the return is false | 64 * and sets the GrGpu's scissor and stencil state. If the return is false |
60 * then the draw can be skipped. The AutoRestoreEffects is initialized by | 65 * then the draw can be skipped. The AutoRestoreEffects is initialized by |
61 * the manager when it must install additional effects to implement the | 66 * the manager when it must install additional effects to implement the |
62 * clip. devBounds is optional but can help optimize clipping. | 67 * clip. devBounds is optional but can help optimize clipping. |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 } fCurrClipMaskType; | 194 } fCurrClipMaskType; |
190 | 195 |
191 GrClipMaskCache fAACache; // cache for the AA path | 196 GrClipMaskCache fAACache; // cache for the AA path |
192 GrClipTarget* fClipTarget; | 197 GrClipTarget* fClipTarget; |
193 StencilClipMode fClipMode; | 198 StencilClipMode fClipMode; |
194 | 199 |
195 typedef SkNoncopyable INHERITED; | 200 typedef SkNoncopyable INHERITED; |
196 }; | 201 }; |
197 | 202 |
198 #endif // GrClipMaskManager_DEFINED | 203 #endif // GrClipMaskManager_DEFINED |
OLD | NEW |