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.
This commit is contained in:
Adam Barth 2015-06-29 16:40:09 -07:00
parent 5b8c62476d
commit 240f909f91
2 changed files with 2 additions and 0 deletions

View File

@ -36,6 +36,7 @@ GaneshContext::GaneshContext(scoped_refptr<gfx::GLContext> gl_context)
}
GaneshContext::~GaneshContext() {
gr_context_->abandonContext();
}
} // namespace shell

View File

@ -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;