aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrRenderTargetProxy.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-07-18 14:49:38 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-19 11:43:54 +0000
commit5af44defbd5fc7ef0053ec4b61f0859170f2fb15 (patch)
treee25f9e3ff1bdd6a8ff57b717a8d6167cf07d080a /src/gpu/GrRenderTargetProxy.cpp
parent11f898f1548605a188fe3488b22ddc5f7620895d (diff)
Add GrResourceAllocator class + unit test
Change-Id: I2700e8cb4213479b680519ba67f078cc3fb71376 Reviewed-on: https://skia-review.googlesource.com/23661 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrRenderTargetProxy.cpp')
-rw-r--r--src/gpu/GrRenderTargetProxy.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gpu/GrRenderTargetProxy.cpp b/src/gpu/GrRenderTargetProxy.cpp
index 79d083d955..eef5f3ec31 100644
--- a/src/gpu/GrRenderTargetProxy.cpp
+++ b/src/gpu/GrRenderTargetProxy.cpp
@@ -61,6 +61,22 @@ bool GrRenderTargetProxy::instantiate(GrResourceProvider* resourceProvider) {
return true;
}
+sk_sp<GrSurface> GrRenderTargetProxy::createSurface(GrResourceProvider* resourceProvider) const {
+ static constexpr GrSurfaceFlags kFlags = kRenderTarget_GrSurfaceFlag;
+
+ sk_sp<GrSurface> surface = this->createSurfaceImpl(resourceProvider, fSampleCnt, kFlags,
+ /* isMipped = */ false,
+ SkDestinationSurfaceColorMode::kLegacy);
+ if (!surface) {
+ return nullptr;
+ }
+ SkASSERT(surface->asRenderTarget());
+ // Check that our a priori computation matched the ultimate reality
+ SkASSERT(fRenderTargetFlags == surface->asRenderTarget()->renderTargetPriv().flags());
+
+ return surface;
+}
+
int GrRenderTargetProxy::worstCaseWidth() const {
if (fTarget) {
return fTarget->width();