diff options
Diffstat (limited to 'src/gpu/gl/GrGLGpu.cpp')
-rw-r--r-- | src/gpu/gl/GrGLGpu.cpp | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index 8a4476644d..e057b3455c 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -504,17 +504,6 @@ void GrGLGpu::onResetContext(uint32_t resetBits) { } } -static GrSurfaceOrigin resolve_origin(GrSurfaceOrigin origin, bool renderTarget) { - // By default, GrRenderTargets are GL's normal orientation so that they - // can be drawn to by the outside world without the client having - // to render upside down. - if (kDefault_GrSurfaceOrigin == origin) { - return renderTarget ? kBottomLeft_GrSurfaceOrigin : kTopLeft_GrSurfaceOrigin; - } else { - return origin; - } -} - sk_sp<GrTexture> GrGLGpu::onWrapBackendTexture(const GrBackendTexture& backendTex, GrSurfaceOrigin origin, GrBackendTextureFlags flags, @@ -591,23 +580,30 @@ sk_sp<GrTexture> GrGLGpu::onWrapBackendTexture(const GrBackendTexture& backendTe } } -sk_sp<GrRenderTarget> GrGLGpu::onWrapBackendRenderTarget(const GrBackendRenderTargetDesc& wrapDesc){ +sk_sp<GrRenderTarget> GrGLGpu::onWrapBackendRenderTarget(const GrBackendRenderTarget& backendRT, + GrSurfaceOrigin origin) { + const GrGLFramebufferInfo* info = backendRT.getGLFramebufferInfo(); + if (!info) { + return nullptr; + } + GrGLRenderTarget::IDDesc idDesc; - idDesc.fRTFBOID = static_cast<GrGLuint>(wrapDesc.fRenderTargetHandle); + idDesc.fRTFBOID = info->fFBOID; idDesc.fMSColorRenderbufferID = 0; idDesc.fTexFBOID = GrGLRenderTarget::kUnresolvableFBOID; idDesc.fRTFBOOwnership = GrBackendObjectOwnership::kBorrowed; idDesc.fIsMixedSampled = false; GrSurfaceDesc desc; - desc.fConfig = wrapDesc.fConfig; + desc.fConfig = backendRT.config(); desc.fFlags = kCheckAllocation_GrSurfaceFlag | kRenderTarget_GrSurfaceFlag; - desc.fWidth = wrapDesc.fWidth; - desc.fHeight = wrapDesc.fHeight; - desc.fSampleCnt = SkTMin(wrapDesc.fSampleCnt, this->caps()->maxSampleCount()); - desc.fOrigin = resolve_origin(wrapDesc.fOrigin, true); + desc.fWidth = backendRT.width(); + desc.fHeight = backendRT.height(); + desc.fSampleCnt = SkTMin(backendRT.sampleCnt(), this->caps()->maxSampleCount()); + SkASSERT(kDefault_GrSurfaceOrigin != origin); + desc.fOrigin = origin; - return GrGLRenderTarget::MakeWrapped(this, desc, idDesc, wrapDesc.fStencilBits); + return GrGLRenderTarget::MakeWrapped(this, desc, idDesc, backendRT.stencilBits()); } sk_sp<GrRenderTarget> GrGLGpu::onWrapBackendTextureAsRenderTarget(const GrBackendTexture& tex, |