aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--gm/windowrectangles.cpp3
-rw-r--r--include/private/GrRenderTargetProxy.h2
-rw-r--r--src/gpu/GrClipStackClip.cpp6
-rw-r--r--src/gpu/GrRenderTarget.cpp5
-rw-r--r--src/gpu/GrRenderTargetContext.cpp5
-rw-r--r--src/gpu/GrRenderTargetContextPriv.h2
-rw-r--r--src/gpu/GrRenderTargetPriv.h1
-rw-r--r--src/gpu/GrRenderTargetProxy.cpp4
-rw-r--r--tests/ProxyTest.cpp23
9 files changed, 28 insertions, 23 deletions
diff --git a/gm/windowrectangles.cpp b/gm/windowrectangles.cpp
index 47bc3c92e7..3949b3f41c 100644
--- a/gm/windowrectangles.cpp
+++ b/gm/windowrectangles.cpp
@@ -182,8 +182,7 @@ void WindowRectanglesMaskGM::onCoverClipStack(const SkClipStack& stack, SkCanvas
GrContext* ctx = canvas->getGrContext();
GrRenderTargetContext* rtc = canvas->internal_private_accessTopLayerRenderTargetContext();
- if (!ctx || !rtc ||
- rtc->accessRenderTarget()->renderTargetPriv().maxWindowRectangles() < kNumWindows) {
+ if (!ctx || !rtc || rtc->priv().maxWindowRectangles() < kNumWindows) {
this->fail(canvas);
return;
}
diff --git a/include/private/GrRenderTargetProxy.h b/include/private/GrRenderTargetProxy.h
index 3c2597b97e..bfc6e05973 100644
--- a/include/private/GrRenderTargetProxy.h
+++ b/include/private/GrRenderTargetProxy.h
@@ -49,6 +49,8 @@ public:
*/
int numColorSamples() const { return this->isMixedSampled() ? 0 : fDesc.fSampleCnt; }
+ int maxWindowRectangles(const GrCaps& caps) const;
+
GrRenderTarget::Flags testingOnly_getFlags() const;
GrRenderTargetOpList* getLastRenderTargetOpList() {
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp
index 669a9c23a6..133c4f706f 100644
--- a/src/gpu/GrClipStackClip.cpp
+++ b/src/gpu/GrClipStackClip.cpp
@@ -273,14 +273,12 @@ bool GrClipStackClip::apply(GrContext* context, GrRenderTargetContext* renderTar
return false;
}
- GrRenderTarget* rt = renderTargetContext->accessRenderTarget();
-
const SkScalar clipX = SkIntToScalar(fOrigin.x()),
clipY = SkIntToScalar(fOrigin.y());
SkRect clipSpaceDevBounds = devBounds.makeOffset(clipX, clipY);
const GrReducedClip reducedClip(*fStack, clipSpaceDevBounds,
- rt->renderTargetPriv().maxWindowRectangles());
+ renderTargetContext->priv().maxWindowRectangles());
if (reducedClip.hasIBounds() &&
!GrClip::IsInsideClip(reducedClip.ibounds(), clipSpaceDevBounds)) {
@@ -357,6 +355,8 @@ bool GrClipStackClip::apply(GrContext* context, GrRenderTargetContext* renderTar
// if alpha clip mask creation fails fall through to the non-AA code paths
}
+ GrRenderTarget* rt = renderTargetContext->accessRenderTarget();
+
// use the stencil clip if we can't represent the clip as a rectangle.
if (!context->resourceProvider()->attachStencilAttachment(rt)) {
SkDebugf("WARNING: failed to attach stencil buffer for clip mask. Clip will be ignored.\n");
diff --git a/src/gpu/GrRenderTarget.cpp b/src/gpu/GrRenderTarget.cpp
index f15e3b01bf..f495cd34bb 100644
--- a/src/gpu/GrRenderTarget.cpp
+++ b/src/gpu/GrRenderTarget.cpp
@@ -118,8 +118,3 @@ GrRenderTargetPriv::getMultisampleSpecs(const GrPipeline& pipeline) const {
return specs;
}
-int GrRenderTargetPriv::maxWindowRectangles() const {
- return (this->flags() & Flags::kWindowRectsSupport) ?
- fRenderTarget->getGpu()->caps()->maxWindowRectangles() : 0;
-}
-
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 4c86cbc464..3bc6ad369e 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -579,6 +579,11 @@ void GrRenderTargetContext::drawRect(const GrClip& clip,
this->internalDrawPath(clip, paint, viewMatrix, path, *style);
}
+int GrRenderTargetContextPriv::maxWindowRectangles() const {
+ return fRenderTargetContext->fRenderTargetProxy->maxWindowRectangles(
+ *fRenderTargetContext->fContext->caps());
+}
+
void GrRenderTargetContextPriv::clearStencilClip(const GrFixedClip& clip, bool insideStencilMask) {
ASSERT_SINGLE_OWNER_PRIV
RETURN_IF_ABANDONED_PRIV
diff --git a/src/gpu/GrRenderTargetContextPriv.h b/src/gpu/GrRenderTargetContextPriv.h
index 83a334b012..802cba0d3e 100644
--- a/src/gpu/GrRenderTargetContextPriv.h
+++ b/src/gpu/GrRenderTargetContextPriv.h
@@ -80,6 +80,8 @@ public:
SkBudgeted isBudgeted() const;
+ int maxWindowRectangles() const;
+
void testingOnly_drawBatch(const GrPaint&,
GrDrawBatch* batch,
const GrUserStencilSettings* = nullptr,
diff --git a/src/gpu/GrRenderTargetPriv.h b/src/gpu/GrRenderTargetPriv.h
index 19e72637f3..89f4d5289e 100644
--- a/src/gpu/GrRenderTargetPriv.h
+++ b/src/gpu/GrRenderTargetPriv.h
@@ -40,7 +40,6 @@ public:
typedef GrRenderTarget::Flags Flags;
Flags flags() const { return fRenderTarget->fFlags; }
- int maxWindowRectangles() const;
private:
explicit GrRenderTargetPriv(GrRenderTarget* renderTarget) : fRenderTarget(renderTarget) {}
diff --git a/src/gpu/GrRenderTargetProxy.cpp b/src/gpu/GrRenderTargetProxy.cpp
index 669f422371..8eb335de17 100644
--- a/src/gpu/GrRenderTargetProxy.cpp
+++ b/src/gpu/GrRenderTargetProxy.cpp
@@ -36,6 +36,10 @@ GrRenderTargetProxy::GrRenderTargetProxy(sk_sp<GrSurface> surf)
, fFlags(fTarget->asRenderTarget()->renderTargetPriv().flags()) {
}
+int GrRenderTargetProxy::maxWindowRectangles(const GrCaps& caps) const {
+ return (fFlags & GrRenderTarget::Flags::kWindowRectsSupport) ? caps.maxWindowRectangles() : 0;
+}
+
GrRenderTarget* GrRenderTargetProxy::instantiate(GrTextureProvider* texProvider) {
SkASSERT(fDesc.fFlags & GrSurfaceFlags::kRenderTarget_GrSurfaceFlag);
diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp
index 17a3dad3b8..618941e0be 100644
--- a/tests/ProxyTest.cpp
+++ b/tests/ProxyTest.cpp
@@ -34,10 +34,13 @@ static void check_surface(skiatest::Reporter* reporter,
}
static void check_rendertarget(skiatest::Reporter* reporter,
+ const GrCaps& caps,
GrTextureProvider* provider,
GrRenderTargetProxy* rtProxy,
int numSamples,
- SkBackingFit fit) {
+ SkBackingFit fit,
+ int expectedMaxWindowRects) {
+ REPORTER_ASSERT(reporter, rtProxy->maxWindowRectangles(caps) == expectedMaxWindowRects);
REPORTER_ASSERT(reporter, rtProxy->numStencilSamples() == numSamples);
GrRenderTarget* rt = rtProxy->instantiate(provider);
@@ -110,9 +113,9 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredProxyTest, reporter, ctxInfo) {
check_surface(reporter, sProxy.get(), origin,
widthHeight, widthHeight, config,
SK_InvalidUniqueID, budgeted);
- check_rendertarget(reporter, provider,
+ check_rendertarget(reporter, caps, provider,
sProxy->asRenderTargetProxy(),
- numSamples, fit);
+ numSamples, fit, caps.maxWindowRectangles());
}
desc.fFlags = kNone_GrSurfaceFlags;
@@ -166,15 +169,13 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) {
sk_sp<GrRenderTarget> defaultFBO(
provider->wrapBackendRenderTarget(backendDesc));
- REPORTER_ASSERT(reporter,
- !defaultFBO->renderTargetPriv().maxWindowRectangles());
sk_sp<GrSurfaceProxy> sProxy(GrSurfaceProxy::MakeWrapped(defaultFBO));
check_surface(reporter, sProxy.get(), origin,
kWidthHeight, kWidthHeight, config,
defaultFBO->uniqueID(), SkBudgeted::kNo);
- check_rendertarget(reporter, provider, sProxy->asRenderTargetProxy(),
- numSamples, SkBackingFit::kExact);
+ check_rendertarget(reporter, caps, provider, sProxy->asRenderTargetProxy(),
+ numSamples, SkBackingFit::kExact, 0);
}
sk_sp<GrTexture> tex;
@@ -184,16 +185,14 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) {
desc.fFlags = kRenderTarget_GrSurfaceFlag;
tex.reset(provider->createTexture(desc, budgeted));
sk_sp<GrRenderTarget> rt(sk_ref_sp(tex->asRenderTarget()));
- REPORTER_ASSERT(reporter,
- caps.maxWindowRectangles() ==
- rt->renderTargetPriv().maxWindowRectangles());
sk_sp<GrSurfaceProxy> sProxy(GrSurfaceProxy::MakeWrapped(rt));
check_surface(reporter, sProxy.get(), origin,
kWidthHeight, kWidthHeight, config,
rt->uniqueID(), budgeted);
- check_rendertarget(reporter, provider, sProxy->asRenderTargetProxy(),
- numSamples, SkBackingFit::kExact);
+ check_rendertarget(reporter, caps, provider, sProxy->asRenderTargetProxy(),
+ numSamples, SkBackingFit::kExact,
+ caps.maxWindowRectangles());
}
if (!tex) {