| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 const SkRect* devBounds, | 69 const SkRect* devBounds, |
| 70 GrAppliedClip*); | 70 GrAppliedClip*); |
| 71 | 71 |
| 72 void adjustPathStencilParams(const GrStencilAttachment*, GrStencilSettings*)
; | 72 void adjustPathStencilParams(const GrStencilAttachment*, GrStencilSettings*)
; |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 inline GrContext* getContext(); | 75 inline GrContext* getContext(); |
| 76 inline const GrCaps* caps() const; | 76 inline const GrCaps* caps() const; |
| 77 inline GrResourceProvider* resourceProvider(); | 77 inline GrResourceProvider* resourceProvider(); |
| 78 | 78 |
| 79 static bool PathNeedsSWRenderer(GrContext* context, |
| 80 bool isStencilDisabled, |
| 81 const GrRenderTarget* rt, |
| 82 const SkMatrix& viewMatrix, |
| 83 const SkClipStack::Element* element, |
| 84 GrPathRenderer** prOut, |
| 85 bool needsStencil); |
| 86 static GrPathRenderer* GetPathRenderer(GrContext* context, |
| 87 GrTexture* texture, |
| 88 const SkMatrix& viewMatrix, |
| 89 const SkClipStack::Element* element); |
| 90 |
| 79 /** | 91 /** |
| 80 * Informs the helper function adjustStencilParams() about how the stencil | 92 * Informs the helper function adjustStencilParams() about how the stencil |
| 81 * buffer clip is being used. | 93 * buffer clip is being used. |
| 82 */ | 94 */ |
| 83 enum StencilClipMode { | 95 enum StencilClipMode { |
| 84 // Draw to the clip bit of the stencil buffer | 96 // Draw to the clip bit of the stencil buffer |
| 85 kModifyClip_StencilClipMode, | 97 kModifyClip_StencilClipMode, |
| 86 // Clip against the existing representation of the clip in the high bit | 98 // Clip against the existing representation of the clip in the high bit |
| 87 // of the stencil buffer. | 99 // of the stencil buffer. |
| 88 kRespectClip_StencilClipMode, | 100 kRespectClip_StencilClipMode, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 118 const SkIRect& clipSpaceIBounds); | 130 const SkIRect& clipSpaceIBounds); |
| 119 | 131 |
| 120 // Similar to createAlphaClipMask but it rasterizes in SW and uploads to the
result texture. | 132 // Similar to createAlphaClipMask but it rasterizes in SW and uploads to the
result texture. |
| 121 GrTexture* createSoftwareClipMask(int32_t elementsGenID, | 133 GrTexture* createSoftwareClipMask(int32_t elementsGenID, |
| 122 GrReducedClip::InitialState initialState, | 134 GrReducedClip::InitialState initialState, |
| 123 const GrReducedClip::ElementList& elements
, | 135 const GrReducedClip::ElementList& elements
, |
| 124 const SkVector& clipToMaskOffset, | 136 const SkVector& clipToMaskOffset, |
| 125 const SkIRect& clipSpaceIBounds); | 137 const SkIRect& clipSpaceIBounds); |
| 126 | 138 |
| 127 bool useSWOnlyPath(const GrPipelineBuilder&, | 139 bool useSWOnlyPath(const GrPipelineBuilder&, |
| 128 const SkVector& clipToMaskOffset, | 140 const GrRenderTarget* rt, |
| 129 const GrReducedClip::ElementList& elements); | 141 const SkVector& clipToMaskOffset, |
| 142 const GrReducedClip::ElementList& elements); |
| 130 | 143 |
| 131 // Draws a clip element into the target alpha mask. The caller should have a
lready setup the | 144 // Draws a clip element into the target alpha mask. The caller should have a
lready setup the |
| 132 // desired blend operation. Optionally if the caller already selected a path
renderer it can | 145 // desired blend operation. Optionally if the caller already selected a path
renderer it can |
| 133 // be passed. Otherwise the function will select one if the element is a pat
h. | 146 // be passed. Otherwise the function will select one if the element is a pat
h. |
| 134 bool drawElement(GrPipelineBuilder*, | 147 bool drawElement(GrPipelineBuilder*, |
| 135 const SkMatrix& viewMatrix, | 148 const SkMatrix& viewMatrix, |
| 136 GrTexture* target, | 149 GrTexture* target, |
| 137 const SkClipStack::Element*, | 150 const SkClipStack::Element*, |
| 138 GrPathRenderer* pr = nullptr); | 151 GrPathRenderer* pr = nullptr); |
| 139 | 152 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 155 GrTexture* createCachedMask(int width, int height, const GrUniqueKey& key, b
ool renderTarget); | 168 GrTexture* createCachedMask(int width, int height, const GrUniqueKey& key, b
ool renderTarget); |
| 156 | 169 |
| 157 static const int kMaxAnalyticElements = 4; | 170 static const int kMaxAnalyticElements = 4; |
| 158 | 171 |
| 159 GrDrawTarget* fDrawTarget; // This is our owning draw target. | 172 GrDrawTarget* fDrawTarget; // This is our owning draw target. |
| 160 StencilClipMode fClipMode; | 173 StencilClipMode fClipMode; |
| 161 | 174 |
| 162 typedef SkNoncopyable INHERITED; | 175 typedef SkNoncopyable INHERITED; |
| 163 }; | 176 }; |
| 164 #endif // GrClipMaskManager_DEFINED | 177 #endif // GrClipMaskManager_DEFINED |
| OLD | NEW |