Skip to content

Commit

Permalink
Clear the on-screen surface every frame. (flutter#6753)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
amirh authored Nov 5, 2018
1 parent 3374f4c commit 124f20f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions shell/gpu/gpu_surface_gl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

{
Expand Down

0 comments on commit 124f20f

Please sign in to comment.