From 1d8e67664558163294ae9573c82c172345861b20 Mon Sep 17 00:00:00 2001 From: Amir Hardon Date: Mon, 5 Nov 2018 14:36:01 -0800 Subject: [PATCH] Clear the on-screen surface every frame. We are currently clearing the offscreen surface before rasterizing, but as we draw the image snapshot of the offscreen surface into the onscreen surface transparent pixels may persist across frames. This is particulariy noticeable when embedding platform views. --- shell/gpu/gpu_surface_gl.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shell/gpu/gpu_surface_gl.cc b/shell/gpu/gpu_surface_gl.cc index 7cc8892f88ef4..6fd78d8ae6810 100644 --- a/shell/gpu/gpu_surface_gl.cc +++ b/shell/gpu/gpu_surface_gl.cc @@ -280,8 +280,10 @@ bool GPUSurfaceGL::PresentSurface(SkCanvas* canvas) { if (offscreen_surface_ != nullptr) { TRACE_EVENT0("flutter", "CopyTextureOnscreen"); SkPaint paint; - onscreen_surface_->getCanvas()->drawImage( - offscreen_surface_->makeImageSnapshot(), 0, 0, &paint); + SkCanvas* onscreen_canvas = onscreen_surface_->getCanvas(); + onscreen_canvas->clear(SK_ColorTRANSPARENT); + onscreen_canvas->drawImage(offscreen_surface_->makeImageSnapshot(), 0, 0, + &paint); } {