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 #ifndef GrClipMaskManager_DEFINED | 7 #ifndef GrClipMaskManager_DEFINED |
8 #define GrClipMaskManager_DEFINED | 8 #define GrClipMaskManager_DEFINED |
9 | 9 |
10 #include "GrPipelineBuilder.h" | 10 #include "GrPipelineBuilder.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 /** | 60 /** |
61 * Creates a clip mask if necessary as a stencil buffer or alpha texture | 61 * Creates a clip mask if necessary as a stencil buffer or alpha texture |
62 * and sets the GrGpu's scissor and stencil state. If the return is false | 62 * and sets the GrGpu's scissor and stencil state. If the return is false |
63 * then the draw can be skipped. The AutoRestoreEffects is initialized by | 63 * then the draw can be skipped. The AutoRestoreEffects is initialized by |
64 * the manager when it must install additional effects to implement the | 64 * the manager when it must install additional effects to implement the |
65 * clip. devBounds is optional but can help optimize clipping. | 65 * clip. devBounds is optional but can help optimize clipping. |
66 */ | 66 */ |
67 bool setupClipping(const GrPipelineBuilder&, | 67 bool setupClipping(const GrPipelineBuilder&, |
68 GrPipelineBuilder::AutoRestoreStencil*, | 68 GrPipelineBuilder::AutoRestoreStencil*, |
69 const SkRect* devBounds, | 69 const SkRect* devBounds, |
70 GrAppliedClip*); | 70 GrAppliedClip*, |
| 71 GrRenderTarget* dst); |
71 | 72 |
72 void adjustPathStencilParams(const GrStencilAttachment*, GrStencilSettings*)
; | 73 void adjustPathStencilParams(const GrStencilAttachment*, GrStencilSettings*)
; |
73 | 74 |
74 private: | 75 private: |
75 inline GrContext* getContext(); | 76 inline GrContext* getContext(); |
76 inline const GrCaps* caps() const; | 77 inline const GrCaps* caps() const; |
77 inline GrResourceProvider* resourceProvider(); | 78 inline GrResourceProvider* resourceProvider(); |
78 | 79 |
79 static bool PathNeedsSWRenderer(GrContext* context, | 80 static bool PathNeedsSWRenderer(GrContext* context, |
80 bool isStencilDisabled, | 81 bool isStencilDisabled, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 const GrReducedClip::ElementList& elements, | 121 const GrReducedClip::ElementList& elements, |
121 const SkIRect& clipSpaceIBounds, | 122 const SkIRect& clipSpaceIBounds, |
122 const SkIPoint& clipSpaceToStencilOffset); | 123 const SkIPoint& clipSpaceToStencilOffset); |
123 | 124 |
124 // Creates an alpha mask of the clip. The mask is a rasterization of element
s through the | 125 // Creates an alpha mask of the clip. The mask is a rasterization of element
s through the |
125 // rect specified by clipSpaceIBounds. | 126 // rect specified by clipSpaceIBounds. |
126 GrTexture* createAlphaClipMask(int32_t elementsGenID, | 127 GrTexture* createAlphaClipMask(int32_t elementsGenID, |
127 GrReducedClip::InitialState initialState, | 128 GrReducedClip::InitialState initialState, |
128 const GrReducedClip::ElementList& elements, | 129 const GrReducedClip::ElementList& elements, |
129 const SkVector& clipToMaskOffset, | 130 const SkVector& clipToMaskOffset, |
130 const SkIRect& clipSpaceIBounds); | 131 const SkIRect& clipSpaceIBounds, |
| 132 SkAutoTUnref<GrDrawContext>* dc); |
131 | 133 |
132 // Similar to createAlphaClipMask but it rasterizes in SW and uploads to the
result texture. | 134 // Similar to createAlphaClipMask but it rasterizes in SW and uploads to the
result texture. |
133 GrTexture* createSoftwareClipMask(int32_t elementsGenID, | 135 GrTexture* createSoftwareClipMask(int32_t elementsGenID, |
134 GrReducedClip::InitialState initialState, | 136 GrReducedClip::InitialState initialState, |
135 const GrReducedClip::ElementList& elements
, | 137 const GrReducedClip::ElementList& elements
, |
136 const SkVector& clipToMaskOffset, | 138 const SkVector& clipToMaskOffset, |
137 const SkIRect& clipSpaceIBounds); | 139 const SkIRect& clipSpaceIBounds); |
138 | 140 |
139 bool useSWOnlyPath(const GrPipelineBuilder&, | 141 bool useSWOnlyPath(const GrPipelineBuilder&, |
140 const GrRenderTarget* rt, | 142 const GrRenderTarget* rt, |
(...skipping 27 matching lines...) Expand all Loading... |
168 GrTexture* createCachedMask(int width, int height, const GrUniqueKey& key, b
ool renderTarget); | 170 GrTexture* createCachedMask(int width, int height, const GrUniqueKey& key, b
ool renderTarget); |
169 | 171 |
170 static const int kMaxAnalyticElements = 4; | 172 static const int kMaxAnalyticElements = 4; |
171 | 173 |
172 GrDrawTarget* fDrawTarget; // This is our owning draw target. | 174 GrDrawTarget* fDrawTarget; // This is our owning draw target. |
173 StencilClipMode fClipMode; | 175 StencilClipMode fClipMode; |
174 | 176 |
175 typedef SkNoncopyable INHERITED; | 177 typedef SkNoncopyable INHERITED; |
176 }; | 178 }; |
177 #endif // GrClipMaskManager_DEFINED | 179 #endif // GrClipMaskManager_DEFINED |
OLD | NEW |