Ensure that the EGL rendering context is bound to the GPU thread in Rasterizer::MakeRasterSnapshot (flutter/engine#6816)

Fixes https://github.com/flutter/flutter/issues/24083
This commit is contained in:
Jason Simmons
2018-11-09 17:05:05 -08:00
committed by GitHub
parent a03e311cb0
commit c1c5977c07
5 changed files with 18 additions and 0 deletions

View File

@@ -93,6 +93,10 @@ 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

View File

@@ -68,4 +68,8 @@ flow::ExternalViewEmbedder* Surface::GetExternalViewEmbedder() {
return nullptr;
}
bool Surface::MakeRenderContextCurrent() {
return true;
}
} // namespace shell

View File

@@ -58,6 +58,8 @@ class Surface {
virtual flow::ExternalViewEmbedder* GetExternalViewEmbedder();
virtual bool MakeRenderContextCurrent();
private:
FML_DISALLOW_COPY_AND_ASSIGN(Surface);
};

View File

@@ -363,4 +363,9 @@ flow::ExternalViewEmbedder* GPUSurfaceGL::GetExternalViewEmbedder() {
return delegate_->GetExternalViewEmbedder();
}
// |shell::Surface|
bool GPUSurfaceGL::MakeRenderContextCurrent() {
return delegate_->GLContextMakeCurrent();
}
} // namespace shell

View File

@@ -69,6 +69,9 @@ class GPUSurfaceGL : public Surface {
// |shell::Surface|
flow::ExternalViewEmbedder* GetExternalViewEmbedder() override;
// |shell::Surface|
bool MakeRenderContextCurrent() override;
private:
GPUSurfaceGLDelegate* delegate_;
GPUSurfaceGLDelegate::GLProcResolver proc_resolver_;