Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(577)

Side by Side Diff: src/gpu/GrClipMaskManager.h

Issue 816513003: Stop creating GrODS for stencilPath commands. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef GrClipMaskManager_DEFINED 7 #ifndef GrClipMaskManager_DEFINED
8 #define GrClipMaskManager_DEFINED 8 #define GrClipMaskManager_DEFINED
9 9
10 #include "GrClipMaskCache.h" 10 #include "GrClipMaskCache.h"
(...skipping 23 matching lines...) Expand all
34 * cases scissoring is used to bound the range of the clip mask. 34 * cases scissoring is used to bound the range of the clip mask.
35 */ 35 */
36 class GrClipMaskManager : SkNoncopyable { 36 class GrClipMaskManager : SkNoncopyable {
37 public: 37 public:
38 GrClipMaskManager() 38 GrClipMaskManager()
39 : fCurrClipMaskType(kNone_ClipMaskType) 39 : fCurrClipMaskType(kNone_ClipMaskType)
40 , fClipTarget(NULL) 40 , fClipTarget(NULL)
41 , fClipMode(kIgnoreClip_StencilClipMode) { 41 , fClipMode(kIgnoreClip_StencilClipMode) {
42 } 42 }
43 43
44 // The state of the scissor is controlled by the clip manager, no one else s hould set
45 // Scissor state. This should really be on Gpu itself. We should revist th is when GPU
46 // and drawtarget are separate
47 struct ScissorState {
48 ScissorState() : fEnabled(false) {}
49 void set(const SkIRect& rect) { fRect = rect; fEnabled = true; }
50 bool operator==(const ScissorState& other) const {
51 return fEnabled == other.fEnabled &&
52 (false == fEnabled || fRect == other.fRect);
53 }
54 bool operator!=(const ScissorState& other) const { return !(*this == oth er); }
55 bool fEnabled;
56 SkIRect fRect;
57 };
58
59 /** 44 /**
60 * Creates a clip mask if necessary as a stencil buffer or alpha texture 45 * Creates a clip mask if necessary as a stencil buffer or alpha texture
61 * and sets the GrGpu's scissor and stencil state. If the return is false 46 * and sets the GrGpu's scissor and stencil state. If the return is false
62 * then the draw can be skipped. The AutoRestoreEffects is initialized by 47 * then the draw can be skipped. The AutoRestoreEffects is initialized by
63 * the manager when it must install additional effects to implement the 48 * the manager when it must install additional effects to implement the
64 * clip. devBounds is optional but can help optimize clipping. 49 * clip. devBounds is optional but can help optimize clipping.
65 */ 50 */
66 bool setupClipping(GrDrawState*, 51 bool setupClipping(GrDrawState*,
67 GrDrawState::AutoRestoreEffects*, 52 GrDrawState::AutoRestoreEffects*,
68 GrDrawState::AutoRestoreStencil*, 53 GrDrawState::AutoRestoreStencil*,
69 ScissorState*, 54 GrScissorState*,
70 const GrClipData* clipDataIn, 55 const GrClipData* clipDataIn,
71 const SkRect* devBounds); 56 const SkRect* devBounds);
72 57
73 /** 58 /**
74 * Purge resources to free up memory. TODO: This class shouldn't hold any lo ng lived refs 59 * Purge resources to free up memory. TODO: This class shouldn't hold any lo ng lived refs
75 * which will allow ResourceCache2 to automatically purge anything this clas s has created. 60 * which will allow ResourceCache2 to automatically purge anything this clas s has created.
76 */ 61 */
77 void purgeResources(); 62 void purgeResources();
78 63
79 bool isClipInStencil() const { 64 bool isClipInStencil() const {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 kAlpha_ClipMaskType, 187 kAlpha_ClipMaskType,
203 } fCurrClipMaskType; 188 } fCurrClipMaskType;
204 189
205 GrClipMaskCache fAACache; // cache for the AA path 190 GrClipMaskCache fAACache; // cache for the AA path
206 GrClipTarget* fClipTarget; 191 GrClipTarget* fClipTarget;
207 StencilClipMode fClipMode; 192 StencilClipMode fClipMode;
208 193
209 typedef SkNoncopyable INHERITED; 194 typedef SkNoncopyable INHERITED;
210 }; 195 };
211 #endif // GrClipMaskManager_DEFINED 196 #endif // GrClipMaskManager_DEFINED
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698