mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Fix MakeRenderContextCurrent to handle software rendering (#6827)
This commit is contained in:
parent
14db8b397a
commit
faabf0ced3
@ -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(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user