From 240f909f9186fea2d00115dcfa42ac805cea8b3c Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Mon, 29 Jun 2015 16:40:09 -0700 Subject: [PATCH] Fix corrupted rendering of images When navigating from one app to another, we create a new Android window and destroy the old one. Previously, when we destroyed the old window after creating the new window, we would destroy the Ganesh context after making the GL context for the new window current, causing us to corrupt the GL state in the new window. After this CL, we call MakeCurrent before destroying the Ganesh context so that it interacts with the proper GL context. R=jackson@google.com Review URL: https://codereview.chromium.org/1214263002. --- engine/src/flutter/shell/gpu/ganesh_context.cc | 1 + engine/src/flutter/shell/gpu/rasterizer.cc | 1 + 2 files changed, 2 insertions(+) diff --git a/engine/src/flutter/shell/gpu/ganesh_context.cc b/engine/src/flutter/shell/gpu/ganesh_context.cc index 6f5de8b254..bd3bac33b0 100644 --- a/engine/src/flutter/shell/gpu/ganesh_context.cc +++ b/engine/src/flutter/shell/gpu/ganesh_context.cc @@ -36,6 +36,7 @@ GaneshContext::GaneshContext(scoped_refptr gl_context) } GaneshContext::~GaneshContext() { + gr_context_->abandonContext(); } } // namespace shell diff --git a/engine/src/flutter/shell/gpu/rasterizer.cc b/engine/src/flutter/shell/gpu/rasterizer.cc index cd22c560f2..4d4ded4aa4 100644 --- a/engine/src/flutter/shell/gpu/rasterizer.cc +++ b/engine/src/flutter/shell/gpu/rasterizer.cc @@ -68,6 +68,7 @@ void Rasterizer::DrawPicture(SkPicture* picture) { } void Rasterizer::OnOutputSurfaceDestroyed() { + CHECK(context_->MakeCurrent(surface_.get())); ganesh_surface_.reset(); ganesh_context_.reset(); context_ = nullptr;