From 0e8016a849fefb1f62680b4438338869421af414 Mon Sep 17 00:00:00 2001 From: Amir Hardon Date: Mon, 5 Nov 2018 15:08:07 -0800 Subject: [PATCH] Clear the on-screen surface every frame. (flutter/engine#6753) 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 are blended with the current contents of the onscreen surface instead of replacing them. This is particularly noticeable when embedding platform views. --- engine/src/flutter/shell/gpu/gpu_surface_gl.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/engine/src/flutter/shell/gpu/gpu_surface_gl.cc b/engine/src/flutter/shell/gpu/gpu_surface_gl.cc index 7cc8892f88..6fd78d8ae6 100644 --- a/engine/src/flutter/shell/gpu/gpu_surface_gl.cc +++ b/engine/src/flutter/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); } {