sk_sp<GrRenderTarget> GrGpu::wrapBackendRenderTarget(const GrBackendRenderTarget& backendRT) { if (0 == this->caps()->getRenderTargetSampleCount(backendRT.sampleCnt(), backendRT.config())) { return nullptr; } this->handleDirtyContext(); return this->onWrapBackendRenderTarget(backendRT); }
bool validate_backend_render_target(GrContext* ctx, const GrBackendRenderTarget& rt, GrPixelConfig* config, SkColorType ct, sk_sp<SkColorSpace> cs) { // TODO: Create a SkImageColorInfo struct for color, alpha, and color space so we don't need to // create a fake image info here. SkImageInfo info = SkImageInfo::Make(1, 1, ct, kPremul_SkAlphaType, cs); if (!SkSurface_Gpu::Valid(info)) { return false; } if (!ctx->caps()->validateBackendRenderTarget(rt, ct, config)) { return false; } if (rt.sampleCnt() > 1) { if (ctx->caps()->maxRenderTargetSampleCount(*config) <= 1) { return false; } } else if (!ctx->caps()->isConfigRenderable(*config)) { return false; } return true; }