Index: src/gpu/GrClipStackClip.cpp |
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp |
index a3a0de509c0db3e1567d195662a174e30f7d811a..9428d254327b386aedb2d20827de93a3b6618ee1 100644 |
--- a/src/gpu/GrClipStackClip.cpp |
+++ b/src/gpu/GrClipStackClip.cpp |
@@ -10,6 +10,7 @@ |
#include "GrDrawingManager.h" |
#include "GrDrawContextPriv.h" |
#include "GrGpuResourcePriv.h" |
+#include "GrRenderTargetPriv.h" |
#include "GrStencilAttachment.h" |
#include "GrSWMaskHelper.h" |
#include "effects/GrConvexPolyEffect.h" |
@@ -280,6 +281,22 @@ 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); |
csmartdalton
2016/08/16 18:38:47
Needs to be offset to screen space from clip space
csmartdalton
2016/08/16 23:38:34
Done.
|
+ out->addWindowRectangle(window, *context->caps()); |
+ return true; |
+ } |
+ } |
+ |
// An element count of 4 was chosen because of the common pattern in Blink of: |
// isect RR |
// diff RR |