| 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 "GrClipMaskCache.h" | 10 #include "GrClipMaskCache.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 const SkIRect& clipSpaceIBounds); | 109 const SkIRect& clipSpaceIBounds); |
| 110 | 110 |
| 111 // Similar to createAlphaClipMask but it rasterizes in SW and uploads to the
result texture. | 111 // Similar to createAlphaClipMask but it rasterizes in SW and uploads to the
result texture. |
| 112 GrTexture* createSoftwareClipMask(int32_t elementsGenID, | 112 GrTexture* createSoftwareClipMask(int32_t elementsGenID, |
| 113 GrReducedClip::InitialState initialState, | 113 GrReducedClip::InitialState initialState, |
| 114 const GrReducedClip::ElementList& elements
, | 114 const GrReducedClip::ElementList& elements
, |
| 115 const SkVector& clipToMaskOffset, | 115 const SkVector& clipToMaskOffset, |
| 116 const SkIRect& clipSpaceIBounds); | 116 const SkIRect& clipSpaceIBounds); |
| 117 | 117 |
| 118 // Returns the cached mask texture if it matches the elementsGenID and the c
lipSpaceIBounds. | 118 // Returns the cached mask texture if it matches the elementsGenID and the c
lipSpaceIBounds. |
| 119 // Returns NULL if not found. | 119 // Returns nullptr if not found. |
| 120 GrTexture* getCachedMaskTexture(int32_t elementsGenID, const SkIRect& clipSp
aceIBounds); | 120 GrTexture* getCachedMaskTexture(int32_t elementsGenID, const SkIRect& clipSp
aceIBounds); |
| 121 | 121 |
| 122 // Handles allocation (if needed) of a clip alpha-mask texture for both the
sw-upload | 122 // Handles allocation (if needed) of a clip alpha-mask texture for both the
sw-upload |
| 123 // or gpu-rendered cases. | 123 // or gpu-rendered cases. |
| 124 GrTexture* allocMaskTexture(int32_t elementsGenID, | 124 GrTexture* allocMaskTexture(int32_t elementsGenID, |
| 125 const SkIRect& clipSpaceIBounds, | 125 const SkIRect& clipSpaceIBounds, |
| 126 bool willUpload); | 126 bool willUpload); |
| 127 | 127 |
| 128 bool useSWOnlyPath(const GrPipelineBuilder&, | 128 bool useSWOnlyPath(const GrPipelineBuilder&, |
| 129 const SkVector& clipToMaskOffset, | 129 const SkVector& clipToMaskOffset, |
| 130 const GrReducedClip::ElementList& elements); | 130 const GrReducedClip::ElementList& elements); |
| 131 | 131 |
| 132 // Draws a clip element into the target alpha mask. The caller should have a
lready setup the | 132 // Draws a clip element into the target alpha mask. The caller should have a
lready setup the |
| 133 // desired blend operation. Optionally if the caller already selected a path
renderer it can | 133 // desired blend operation. Optionally if the caller already selected a path
renderer it can |
| 134 // be passed. Otherwise the function will select one if the element is a pat
h. | 134 // be passed. Otherwise the function will select one if the element is a pat
h. |
| 135 bool drawElement(GrPipelineBuilder*, | 135 bool drawElement(GrPipelineBuilder*, |
| 136 const SkMatrix& viewMatrix, | 136 const SkMatrix& viewMatrix, |
| 137 GrTexture* target, | 137 GrTexture* target, |
| 138 const SkClipStack::Element*, | 138 const SkClipStack::Element*, |
| 139 GrPathRenderer* pr = NULL); | 139 GrPathRenderer* pr = nullptr); |
| 140 | 140 |
| 141 // Determines whether it is possible to draw the element to both the stencil
buffer and the | 141 // Determines whether it is possible to draw the element to both the stencil
buffer and the |
| 142 // alpha mask simultaneously. If so and the element is a path a compatible p
ath renderer is | 142 // alpha mask simultaneously. If so and the element is a path a compatible p
ath renderer is |
| 143 // also returned. | 143 // also returned. |
| 144 bool canStencilAndDrawElement(GrPipelineBuilder*, | 144 bool canStencilAndDrawElement(GrPipelineBuilder*, |
| 145 GrTexture* target, | 145 GrTexture* target, |
| 146 GrPathRenderer**, | 146 GrPathRenderer**, |
| 147 const SkClipStack::Element*); | 147 const SkClipStack::Element*); |
| 148 | 148 |
| 149 void mergeMask(GrPipelineBuilder*, | 149 void mergeMask(GrPipelineBuilder*, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 kAlpha_ClipMaskType, | 183 kAlpha_ClipMaskType, |
| 184 } fCurrClipMaskType; | 184 } fCurrClipMaskType; |
| 185 | 185 |
| 186 GrClipMaskCache fAACache; // cache for the AA path | 186 GrClipMaskCache fAACache; // cache for the AA path |
| 187 GrClipTarget* fClipTarget; // This is our owning clip target. | 187 GrClipTarget* fClipTarget; // This is our owning clip target. |
| 188 StencilClipMode fClipMode; | 188 StencilClipMode fClipMode; |
| 189 | 189 |
| 190 typedef SkNoncopyable INHERITED; | 190 typedef SkNoncopyable INHERITED; |
| 191 }; | 191 }; |
| 192 #endif // GrClipMaskManager_DEFINED | 192 #endif // GrClipMaskManager_DEFINED |
| OLD | NEW |