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

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: 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 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
« no previous file with comments | « include/gpu/GrClip.h ('k') | src/gpu/GrDrawTarget.cpp » ('j') | src/gpu/GrWindowRectangles.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698