sk_sp<GrRenderTargetContext> GrDrawingManager::makeRenderTargetContext( sk_sp<GrSurfaceProxy> sProxy, sk_sp<SkColorSpace> colorSpace, const SkSurfaceProps* surfaceProps, bool managedOpList) { if (this->wasAbandoned() || !sProxy->asRenderTargetProxy()) { return nullptr; } // SkSurface catches bad color space usage at creation. This check handles anything that slips // by, including internal usage. if (!SkSurface_Gpu::Valid(fContext, sProxy->config(), colorSpace.get())) { SkDEBUGFAIL("Invalid config and colorspace combination"); return nullptr; } sk_sp<GrRenderTargetProxy> rtp(sk_ref_sp(sProxy->asRenderTargetProxy())); return sk_sp<GrRenderTargetContext>(new GrRenderTargetContext( fContext, this, std::move(rtp), std::move(colorSpace), surfaceProps, fContext->contextPriv().getAuditTrail(), fSingleOwner, managedOpList)); }
sk_sp<GrTextureContext> GrDrawingManager::makeTextureContext(sk_sp<GrSurfaceProxy> sProxy, sk_sp<SkColorSpace> colorSpace) { if (this->wasAbandoned() || !sProxy->asTextureProxy()) { return nullptr; } // SkSurface catches bad color space usage at creation. This check handles anything that slips // by, including internal usage. if (!SkSurface_Gpu::Valid(fContext, sProxy->config(), colorSpace.get())) { SkDEBUGFAIL("Invalid config and colorspace combination"); return nullptr; } // GrTextureRenderTargets should always be using a GrRenderTargetContext SkASSERT(!sProxy->asRenderTargetProxy()); sk_sp<GrTextureProxy> textureProxy(sk_ref_sp(sProxy->asTextureProxy())); return sk_sp<GrTextureContext>(new GrTextureContext(fContext, this, std::move(textureProxy), std::move(colorSpace), fContext->contextPriv().getAuditTrail(), fSingleOwner)); }