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

Unified Diff: src/gpu/GrFixedClip.h

Issue 2262473003: Define clear regions in terms of GrFixedClip (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_fixedcliptosrc
Patch Set: rebase Created 4 years, 4 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/GrDrawTarget.cpp ('k') | src/gpu/GrFixedClip.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrFixedClip.h
diff --git a/src/gpu/GrFixedClip.h b/src/gpu/GrFixedClip.h
index 705b2eada9ebe657163a59a4563e27d5e0c58ebe..8b3a9c1c9e9d7827f687a22be23b9f010502b0e8 100644
--- a/src/gpu/GrFixedClip.h
+++ b/src/gpu/GrFixedClip.h
@@ -12,37 +12,30 @@
#include "GrTypesPriv.h"
/**
- * GrFixedClip is a clip that can be represented by fixed-function hardware. It never modifies the
- * stencil buffer itself, but can be configured to use whatever clip is already there.
+ * GrFixedClip is a clip that gets implemented by fixed-function hardware.
*/
class GrFixedClip final : public GrClip {
public:
- GrFixedClip() : fHasStencilClip(false) {}
- GrFixedClip(const SkIRect& scissorRect)
- : fScissorState(scissorRect)
- , fHasStencilClip(false) {}
+ GrFixedClip() = default;
+ explicit GrFixedClip(const SkIRect& scissorRect) : fScissorState(scissorRect) {}
- void reset() {
- fScissorState.setDisabled();
- fHasStencilClip = false;
- }
+ const GrScissorState& scissorState() const { return fScissorState; }
+ bool scissorEnabled() const { return fScissorState.enabled(); }
+ const SkIRect& scissorRect() const { SkASSERT(scissorEnabled()); return fScissorState.rect(); }
- void reset(const SkIRect& scissorRect) {
- fScissorState.set(scissorRect);
- fHasStencilClip = false;
- }
+ void disableScissor() { fScissorState.setDisabled(); }
- void enableStencilClip() { fHasStencilClip = true; }
- void disableStencilClip() { fHasStencilClip = false; }
+ bool SK_WARN_UNUSED_RESULT intersect(const SkIRect& irect) {
+ return fScissorState.intersect(irect);
+ }
- bool quickContains(const SkRect&) const final;
+ bool quickContains(const SkRect& rect) const final {
+ return !fScissorState.enabled() || GrClip::IsInsideClip(fScissorState.rect(), rect);
+ }
void getConservativeBounds(int width, int height, SkIRect* devResult,
bool* isIntersectionOfRects) const final;
bool isRRect(const SkRect& rtBounds, SkRRect* rr, bool* aa) const override {
- if (fHasStencilClip) {
- return false;
- }
if (fScissorState.enabled()) {
SkRect rect = SkRect::Make(fScissorState.rect());
if (!rect.intersects(rtBounds)) {
@@ -55,12 +48,13 @@ public:
return false;
};
-private:
bool apply(GrContext*, GrDrawContext*, bool useHWAA, bool hasUserStencilSettings,
GrAppliedClip* out) const final;
+ static const GrFixedClip& Disabled();
+
+private:
GrScissorState fScissorState;
- bool fHasStencilClip;
};
#endif
« no previous file with comments | « src/gpu/GrDrawTarget.cpp ('k') | src/gpu/GrFixedClip.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698