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

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

Issue 48593003: Avoid re-rendering stencil clip for every draw with reducable clip stack (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: gcc-4.2 mac os 10.6 fix Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/GrClipMaskCache.h ('k') | src/gpu/GrClipMaskManager.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7
8 #ifndef GrClipMaskManager_DEFINED 8 #ifndef GrClipMaskManager_DEFINED
9 #define GrClipMaskManager_DEFINED 9 #define GrClipMaskManager_DEFINED
10 10
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 */ 96 */
97 enum ClipMaskType { 97 enum ClipMaskType {
98 kNone_ClipMaskType, 98 kNone_ClipMaskType,
99 kStencil_ClipMaskType, 99 kStencil_ClipMaskType,
100 kAlpha_ClipMaskType, 100 kAlpha_ClipMaskType,
101 } fCurrClipMaskType; 101 } fCurrClipMaskType;
102 102
103 GrClipMaskCache fAACache; // cache for the AA path 103 GrClipMaskCache fAACache; // cache for the AA path
104 104
105 // Draws the clip into the stencil buffer 105 // Draws the clip into the stencil buffer
106 bool createStencilClipMask(GrReducedClip::InitialState initialState, 106 bool createStencilClipMask(int32_t elementsGenID,
107 GrReducedClip::InitialState initialState,
107 const GrReducedClip::ElementList& elements, 108 const GrReducedClip::ElementList& elements,
108 const SkIRect& clipSpaceIBounds, 109 const SkIRect& clipSpaceIBounds,
109 const SkIPoint& clipSpaceToStencilOffset); 110 const SkIPoint& clipSpaceToStencilOffset);
110 // Creates an alpha mask of the clip. The mask is a rasterization of element s through the 111 // Creates an alpha mask of the clip. The mask is a rasterization of element s through the
111 // rect specified by clipSpaceIBounds. 112 // rect specified by clipSpaceIBounds.
112 GrTexture* createAlphaClipMask(int32_t clipStackGenID, 113 GrTexture* createAlphaClipMask(int32_t elementsGenID,
113 GrReducedClip::InitialState initialState, 114 GrReducedClip::InitialState initialState,
114 const GrReducedClip::ElementList& elements, 115 const GrReducedClip::ElementList& elements,
115 const SkIRect& clipSpaceIBounds); 116 const SkIRect& clipSpaceIBounds);
116 // Similar to createAlphaClipMask but it rasterizes in SW and uploads to the result texture. 117 // Similar to createAlphaClipMask but it rasterizes in SW and uploads to the result texture.
117 GrTexture* createSoftwareClipMask(int32_t clipStackGenID, 118 GrTexture* createSoftwareClipMask(int32_t elementsGenID,
118 GrReducedClip::InitialState initialState, 119 GrReducedClip::InitialState initialState,
119 const GrReducedClip::ElementList& elements , 120 const GrReducedClip::ElementList& elements ,
120 const SkIRect& clipSpaceIBounds); 121 const SkIRect& clipSpaceIBounds);
121 122
122 // Gets a texture to use for the clip mask. If true is returned then a cache d mask was found 123 // Gets a texture to use for the clip mask. If true is returned then a cache d mask was found
123 // that already contains the rasterization of the clip stack, otherwise an u ninitialized texture 124 // that already contains the rasterization of the clip stack, otherwise an u ninitialized texture
124 // is returned. 'willUpload' is set when the alpha mask needs to be uploaded from the CPU. 125 // is returned. 'willUpload' is set when the alpha mask needs to be uploaded from the CPU.
125 bool getMaskTexture(int32_t clipStackGenID, 126 bool getMaskTexture(int32_t elementsGenID,
126 const SkIRect& clipSpaceIBounds, 127 const SkIRect& clipSpaceIBounds,
127 GrTexture** result, 128 GrTexture** result,
128 bool willUpload); 129 bool willUpload);
129 130
130 bool useSWOnlyPath(const GrReducedClip::ElementList& elements); 131 bool useSWOnlyPath(const GrReducedClip::ElementList& elements);
131 132
132 // Draws a clip element into the target alpha mask. The caller should have a lready setup the 133 // 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 134 // 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. 135 // be passed. Otherwise the function will select one if the element is a pat h.
135 bool drawElement(GrTexture* target, const SkClipStack::Element*, GrPathRende rer* = NULL); 136 bool drawElement(GrTexture* target, const SkClipStack::Element*, GrPathRende rer* = NULL);
(...skipping 26 matching lines...) Expand all
162 * clipping. 163 * clipping.
163 */ 164 */
164 void adjustStencilParams(GrStencilSettings* settings, 165 void adjustStencilParams(GrStencilSettings* settings,
165 StencilClipMode mode, 166 StencilClipMode mode,
166 int stencilBitCnt); 167 int stencilBitCnt);
167 168
168 typedef SkNoncopyable INHERITED; 169 typedef SkNoncopyable INHERITED;
169 }; 170 };
170 171
171 #endif // GrClipMaskManager_DEFINED 172 #endif // GrClipMaskManager_DEFINED
OLDNEW
« no previous file with comments | « src/gpu/GrClipMaskCache.h ('k') | src/gpu/GrClipMaskManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698