diff options
Diffstat (limited to 'chromium/third_party/skia/src/gpu/GrClipMaskManager.h')
-rw-r--r-- | chromium/third_party/skia/src/gpu/GrClipMaskManager.h | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/chromium/third_party/skia/src/gpu/GrClipMaskManager.h b/chromium/third_party/skia/src/gpu/GrClipMaskManager.h index f44a8e7b227..c3a21fd8a2b 100644 --- a/chromium/third_party/skia/src/gpu/GrClipMaskManager.h +++ b/chromium/third_party/skia/src/gpu/GrClipMaskManager.h @@ -36,7 +36,7 @@ class SkPath; * mask can be represented as a rectangle then scissoring is used. In all * cases scissoring is used to bound the range of the clip mask. */ -class GrClipMaskManager : public SkNoncopyable { +class GrClipMaskManager : SkNoncopyable { public: GrClipMaskManager() : fGpu(NULL) @@ -46,9 +46,12 @@ public: /** * Creates a clip mask if necessary as a stencil buffer or alpha texture * and sets the GrGpu's scissor and stencil state. If the return is false - * then the draw can be skipped. + * then the draw can be skipped. The AutoRestoreEffects is initialized by + * the manager when it must install additional effects to implement the + * clip. devBounds is optional but can help optimize clipping. */ - bool setupClipping(const GrClipData* clipDataIn, GrDrawState::AutoRestoreEffects*); + bool setupClipping(const GrClipData* clipDataIn, GrDrawState::AutoRestoreEffects*, + const SkRect* devBounds); void releaseResources(); @@ -102,6 +105,13 @@ private: GrClipMaskCache fAACache; // cache for the AA path + // Attempts to install a series of coverage effects to implement the clip. Return indicates + // whether the element list was successfully converted to effects. + bool installClipEffects(const GrReducedClip::ElementList&, + GrDrawState::AutoRestoreEffects*, + const SkVector& clipOffset, + const SkRect* devBounds); + // Draws the clip into the stencil buffer bool createStencilClipMask(int32_t elementsGenID, GrReducedClip::InitialState initialState, @@ -120,13 +130,16 @@ private: const GrReducedClip::ElementList& elements, const SkIRect& clipSpaceIBounds); - // Gets a texture to use for the clip mask. If true is returned then a cached mask was found - // that already contains the rasterization of the clip stack, otherwise an uninitialized texture - // is returned. 'willUpload' is set when the alpha mask needs to be uploaded from the CPU. - bool getMaskTexture(int32_t elementsGenID, - const SkIRect& clipSpaceIBounds, - GrTexture** result, - bool willUpload); + // Returns the cached mask texture if it matches the elementsGenID and the clipSpaceIBounds. + // Returns NULL if not found. + GrTexture* getCachedMaskTexture(int32_t elementsGenID, const SkIRect& clipSpaceIBounds); + + + // Handles allocation (if needed) of a clip alpha-mask texture for both the sw-upload + // or gpu-rendered cases. + GrTexture* allocMaskTexture(int32_t elementsGenID, + const SkIRect& clipSpaceIBounds, + bool willUpload); bool useSWOnlyPath(const GrReducedClip::ElementList& elements); |