Fix MakeRenderContextCurrent to handle software rendering (flutter/engine#6827)

This commit is contained in:
Jason Simmons
2018-11-12 11:20:49 -08:00
committed by GitHub
parent 01e57d1939
commit 16a1ab8413

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(