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

Unified Diff: src/gpu/GrClipStackClip.h

Issue 2138083002: skip call to clip::apply when clip is wide open Base URL: https://chromium.googlesource.com/skia.git@llist
Patch Set: rm gcmm Created 4 years, 5 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
« no previous file with comments | « src/gpu/GrClipMaskManager.cpp ('k') | src/gpu/GrClipStackClip.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrClipStackClip.h
diff --git a/src/gpu/GrClipStackClip.h b/src/gpu/GrClipStackClip.h
new file mode 100644
index 0000000000000000000000000000000000000000..9ff6c581ffc97f2f763ec757ff74525a47367b43
--- /dev/null
+++ b/src/gpu/GrClipStackClip.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrClipStackClip_DEFINED
+#define GrClipStackClip_DEFINED
+
+#include "GrClip.h"
+#include "GrReducedClip.h"
+#include "GrTypesPriv.h"
+#include "SkClipStack.h"
+
+class GrDrawContext;
+class GrPathRenderer;
+
+/**
+ * GrClipStackClip can apply a generic SkClipStack to the draw state. It may generate clip masks or
+ * write to the stencil buffer during apply().
+ */
+class GrClipStackClip final : public GrClip {
+public:
+ GrClipStackClip(const SkClipStack* stack = nullptr, const SkIPoint* origin = nullptr)
+ : INHERITED(!stack || stack->isWideOpen()) {
+ this->reset(stack, origin);
+ }
+
+ void reset(const SkClipStack* stack = nullptr, const SkIPoint* origin = nullptr) {
+ fIsWideOpen = !stack || stack->isWideOpen();
+ fOrigin = origin ? *origin : SkIPoint::Make(0, 0);
+ fStack.reset(SkSafeRef(stack));
+ }
+
+ const SkIPoint& origin() const { return fOrigin; }
+ const SkClipStack* clipStack() const { return fStack; }
+
+ bool quickContains(const SkRect&) const final;
+ void getConservativeBounds(int width, int height, SkIRect* devResult,
+ bool* isIntersectionOfRects) const final;
+ bool apply(GrContext*, const GrPipelineBuilder&, GrDrawContext*,
+ const SkRect* devBounds, GrAppliedClip*) const final;
+
+private:
+ static bool UseSWOnlyPath(GrContext* context,
+ const GrPipelineBuilder& pipelineBuilder,
+ const GrDrawContext* drawContext,
+ const SkVector& clipToMaskOffset,
+ const GrReducedClip::ElementList& elements);
+ static bool PathNeedsSWRenderer(GrContext* context, bool hasUserStencilSettings,
+ const GrDrawContext*, const SkMatrix& viewMatrix,
+ const SkClipStack::Element* element, GrPathRenderer** prOut,
+ bool needsStencil);
+ static bool CreateStencilClipMask(GrContext* context,
+ GrDrawContext* drawContext,
+ int32_t elementsGenID,
+ GrReducedClip::InitialState initialState,
+ const GrReducedClip::ElementList& elements,
+ const SkIRect& clipSpaceIBounds,
+ const SkIPoint& clipSpaceToStencilOffset);
+
+ SkIPoint fOrigin;
+ SkAutoTUnref<const SkClipStack> fStack;
+ typedef GrClip INHERITED;
+};
+
+#endif
« no previous file with comments | « src/gpu/GrClipMaskManager.cpp ('k') | src/gpu/GrClipStackClip.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698