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

Unified Diff: src/gpu/GrRenderTargetProxy.cpp

Issue 2225303002: Add flag for window rectangles to GrRenderTarget (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add GrRenderTarget flag for window rectangles 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/GrRenderTargetPriv.h ('k') | src/gpu/gl/GrGLGpu.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrRenderTargetProxy.cpp
diff --git a/src/gpu/GrRenderTargetProxy.cpp b/src/gpu/GrRenderTargetProxy.cpp
index 6c422c09cdec5b78dc362e32865fc6ddd8c07025..3d6587fefe398505dc69d570104b1935b97c001f 100644
--- a/src/gpu/GrRenderTargetProxy.cpp
+++ b/src/gpu/GrRenderTargetProxy.cpp
@@ -7,14 +7,34 @@
#include "GrRenderTargetProxy.h"
+#include "GrCaps.h"
#include "GrDrawTarget.h"
#include "GrGpuResourcePriv.h"
-#include "GrRenderTargetPriv.h"
-GrRenderTargetProxy::GrRenderTargetProxy(sk_sp<GrRenderTarget> rt)
+// Deferred version
+// TODO: we can probably munge the 'desc' in both the wrapped and deferred
+// cases to make the sampleConfig/numSamples stuff more rational.
+GrRenderTargetProxy::GrRenderTargetProxy(const GrCaps& caps, const GrSurfaceDesc& desc,
+ SkBackingFit fit, SkBudgeted budgeted)
+ : INHERITED(desc, fit, budgeted)
+ , fTarget(nullptr)
+ , fFlags(GrRenderTargetPriv::Flags::kNone)
+ , fLastDrawTarget(nullptr) {
+ // Since we know the newly created render target will be internal, we are able to precompute
+ // what the flags will ultimately end up being.
+ if (caps.usesMixedSamples() && fDesc.fSampleCnt > 0) {
+ fFlags |= GrRenderTargetPriv::Flags::kMixedSampled;
+ }
+ if (caps.maxWindowRectangles() > 0) {
+ fFlags |= GrRenderTargetPriv::Flags::kWindowRectsSupport;
+ }
+}
+
+// Wrapped version
+GrRenderTargetProxy::GrRenderTargetProxy(const GrCaps& caps, sk_sp<GrRenderTarget> rt)
: INHERITED(rt->desc(), SkBackingFit::kExact, rt->resourcePriv().isBudgeted())
, fTarget(std::move(rt))
- , fSampleConfig(fTarget->renderTargetPriv().sampleConfig())
+ , fFlags(fTarget->renderTargetPriv().flags())
, fLastDrawTarget(nullptr) {
}
@@ -47,7 +67,7 @@ GrRenderTarget* GrRenderTargetProxy::instantiate(GrTextureProvider* texProvider)
fTarget = sk_ref_sp(tex->asRenderTarget());
// Check that our a priori computation matched the ultimate reality
- SkASSERT(fSampleConfig == fTarget->renderTargetPriv().sampleConfig());
+ SkASSERT(fFlags == fTarget->renderTargetPriv().flags());
return fTarget.get();
}
@@ -71,7 +91,7 @@ sk_sp<GrRenderTargetProxy> GrRenderTargetProxy::Make(const GrCaps& caps,
return sk_sp<GrRenderTargetProxy>(new GrRenderTargetProxy(caps, desc, fit, budgeted));
}
-sk_sp<GrRenderTargetProxy> GrRenderTargetProxy::Make(sk_sp<GrRenderTarget> rt) {
- return sk_sp<GrRenderTargetProxy>(new GrRenderTargetProxy(rt));
+sk_sp<GrRenderTargetProxy> GrRenderTargetProxy::Make(const GrCaps& caps, sk_sp<GrRenderTarget> rt) {
+ return sk_sp<GrRenderTargetProxy>(new GrRenderTargetProxy(caps, rt));
}
« no previous file with comments | « src/gpu/GrRenderTargetPriv.h ('k') | src/gpu/gl/GrGLGpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698