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

Unified Diff: src/gpu/GrClipMaskManager.h

Issue 2035823002: Make GrClipMaskManager stateless and push GrPipelineBuilder construction downstack (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address code review comments Created 4 years, 6 months 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 side-by-side diff with in-line comments
Download patch
Index: src/gpu/GrClipMaskManager.h
diff --git a/src/gpu/GrClipMaskManager.h b/src/gpu/GrClipMaskManager.h
index f7f7e5c0e1e18f68fbef53fb1f0584b3ed538da8..0c71f7c384d0249dc10c5c420c346cb59e09810b 100644
--- a/src/gpu/GrClipMaskManager.h
+++ b/src/gpu/GrClipMaskManager.h
@@ -14,7 +14,8 @@
class GrAppliedClip;
class GrClipStackClip;
-class GrDrawTarget;
+class GrDrawContext;
+class GrFixedClip;
class GrPathRenderer;
class GrPathRendererChain;
class GrResourceProvider;
@@ -29,54 +30,42 @@ class GrTextureProvider;
* 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 : SkNoncopyable {
+// This has to remain a class, for now, so it can be friended (by GrDrawContext & GrContext)
+class GrClipMaskManager {
public:
- GrClipMaskManager(GrDrawTarget* owner) : fDrawTarget(owner) {}
-
/**
* 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. devBounds is optional but can help optimize
* clipping.
*/
- bool setupClipping(const GrPipelineBuilder&, const GrClipStackClip&, const SkRect* devBounds,
- GrAppliedClip*);
+ static bool SetupClipping(GrContext*, const GrPipelineBuilder&, GrDrawContext*,
+ const GrClipStackClip&, const SkRect* devBounds, GrAppliedClip*);
private:
- inline GrContext* getContext();
- inline const GrCaps* caps() const;
- inline GrResourceProvider* resourceProvider();
+ static void DrawNonAARect(GrDrawContext* drawContext,
+ const GrFixedClip& clip,
+ const SkMatrix& viewMatrix,
+ const SkRect& rect,
+ bool isAA,
+ const GrUserStencilSettings* stencilSettings);
static bool PathNeedsSWRenderer(GrContext* context,
bool hasUserStencilSettings,
- const GrRenderTarget* rt,
+ const GrDrawContext*,
const SkMatrix& viewMatrix,
const SkClipStack::Element* element,
GrPathRenderer** prOut,
bool needsStencil);
- static GrPathRenderer* GetPathRenderer(GrContext* context,
- GrTexture* texture,
- const SkMatrix& viewMatrix,
- const SkClipStack::Element* element);
-
- // Attempts to install a series of coverage effects to implement the clip. Return indicates
- // whether the element list was successfully converted to processors. *fp may be nullptr even
- // when the function succeeds because all the elements were ignored. TODO: Make clip reduction
- // bounds-aware and stop checking bounds in this function. Similarly, we shouldn't need to pass
- // abortIfAA, but we don't yet know if all the AA elements will be eliminated.
- bool getAnalyticClipProcessor(const GrReducedClip::ElementList&,
- bool abortIfAA,
- SkVector& clipOffset,
- const SkRect* devBounds,
- sk_sp<const GrFragmentProcessor>* fp);
// Draws the clip into the stencil buffer
- bool createStencilClipMask(GrRenderTarget*,
- int32_t elementsGenID,
- GrReducedClip::InitialState initialState,
- const GrReducedClip::ElementList& elements,
- const SkIRect& clipSpaceIBounds,
- const SkIPoint& clipSpaceToStencilOffset);
+ static bool CreateStencilClipMask(GrContext*,
+ GrDrawContext*,
+ int32_t elementsGenID,
+ GrReducedClip::InitialState initialState,
+ const GrReducedClip::ElementList& elements,
+ const SkIRect& clipSpaceIBounds,
+ const SkIPoint& clipSpaceToStencilOffset);
// Creates an alpha mask of the clip. The mask is a rasterization of elements through the
// rect specified by clipSpaceIBounds.
@@ -97,16 +86,12 @@ private:
static bool UseSWOnlyPath(GrContext*,
const GrPipelineBuilder&,
- const GrRenderTarget* rt,
+ const GrDrawContext*,
const SkVector& clipToMaskOffset,
const GrReducedClip::ElementList& elements);
- GrTexture* createCachedMask(int width, int height, const GrUniqueKey& key, bool renderTarget);
-
- static const int kMaxAnalyticElements = 4;
-
- GrDrawTarget* fDrawTarget; // This is our owning draw target.
-
- typedef SkNoncopyable INHERITED;
+ static GrTexture* CreateCachedMask(int width, int height, const GrUniqueKey& key,
+ bool renderTarget);
};
+
#endif // GrClipMaskManager_DEFINED
« no previous file with comments | « src/gpu/GrClip.cpp ('k') | src/gpu/GrClipMaskManager.cpp » ('j') | src/gpu/GrClipMaskManager.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698