Fix MakeRenderContextCurrent to handle software rendering (#6827)

This commit is contained in:
Jason Simmons 2018-11-12 11:20:49 -08:00 committed by GitHub
parent 14db8b397a
commit faabf0ced3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -93,16 +93,16 @@ sk_sp<SkImage> Rasterizer::MakeRasterSnapshot(sk_sp<SkPicture> picture,
SkISize picture_size) {
TRACE_EVENT0("flutter", __FUNCTION__);
if (!surface_->MakeRenderContextCurrent()) {
return nullptr;
}
sk_sp<SkSurface> surface;
if (surface_ == nullptr || surface_->GetContext() == nullptr) {
// Raster surface is fine if there is no on screen surface. This might
// happen in case of software rendering.
surface = SkSurface::MakeRaster(SkImageInfo::MakeN32Premul(picture_size));
} else {
if (!surface_->MakeRenderContextCurrent()) {
return nullptr;
}
// When there is an on screen surface, we need a render target SkSurface
// because we want to access texture backed images.
surface = SkSurface::MakeRenderTarget(