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

Unified Diff: src/gpu/GrClipStackClip.cpp

Issue 2251573002: Implement difference clip rects with window rectangles (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: return type 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
Index: src/gpu/GrClipStackClip.cpp
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp
index 0d6270f8d05e54036b374cc32b19978beac6f827..975f56a7579741fcbdb8001ff17841ade82f7ce1 100644
--- a/src/gpu/GrClipStackClip.cpp
+++ b/src/gpu/GrClipStackClip.cpp
@@ -7,9 +7,11 @@
#include "GrClipStackClip.h"
+#include "GrAppliedClip.h"
#include "GrDrawingManager.h"
#include "GrDrawContextPriv.h"
#include "GrGpuResourcePriv.h"
+#include "GrRenderTargetPriv.h"
#include "GrStencilAttachment.h"
#include "GrSWMaskHelper.h"
#include "effects/GrConvexPolyEffect.h"
@@ -280,6 +282,23 @@ bool GrClipStackClip::apply(GrContext* context, GrDrawContext* drawContext, bool
SkASSERT(reducedClip.hasIBounds());
+ // Attempt to implement difference clip rects with window rectangles. This will eventually
+ // become more comprehensive.
+ if (drawContext->accessRenderTarget()->renderTargetPriv().supportsWindowRectangles() &&
+ 1 == reducedClip.elements().count() && !reducedClip.requiresAA() &&
+ InitialState::kAllIn == reducedClip.initialState()) {
+ const Element* element = reducedClip.elements().head();
+ SkRegion::Op op = element->getOp();
+ if (Element::kRect_Type == element->getType() &&
+ (SkRegion::kDifference_Op == op || SkRegion::kXOR_Op == op)) {
+ SkIRect window;
+ element->getRect().round(&window);
+ window.offset(-fOrigin);
+ out->addWindowRectangle(window);
+ return true;
+ }
+ }
+
// An element count of 4 was chosen because of the common pattern in Blink of:
// isect RR
// diff RR
« src/gpu/GrCaps.cpp ('K') | « src/gpu/GrClip.cpp ('k') | src/gpu/GrDrawTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698