Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: cc/raster/gpu_rasterizer.cc

Issue 1653983002: cc: Avoid extra flush calls to Skia GrContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | cc/raster/scoped_gpu_raster.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/raster/gpu_rasterizer.h" 5 #include "cc/raster/gpu_rasterizer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 SkSurface* sk_surface = write_lock->sk_surface(); 73 SkSurface* sk_surface = write_lock->sk_surface();
74 74
75 // Allocating an SkSurface will fail after a lost context. Pretend we 75 // Allocating an SkSurface will fail after a lost context. Pretend we
76 // rasterized, as the contents of the resource don't matter anymore. 76 // rasterized, as the contents of the resource don't matter anymore.
77 if (!sk_surface) 77 if (!sk_surface)
78 return; 78 return;
79 79
80 SkMultiPictureDraw multi_picture_draw; 80 SkMultiPictureDraw multi_picture_draw;
81 multi_picture_draw.add(sk_surface->getCanvas(), picture.get()); 81 multi_picture_draw.add(sk_surface->getCanvas(), picture.get());
82 multi_picture_draw.draw(msaa_sample_count_ > 0); 82 // This is undocumented:
bsalomon 2016/02/01 14:55:59 What is undocumented? Are we missing something on
83 // SkCanvas::flush must be explicitly called in order to flush possibly
84 // deferred rendering in SkGpuDevice.
85 // This also prepares the GrRenderTarget of the sk_surface for external
86 // read.
87 // Correct point of preparing would be in
88 // ScopedWriteLockGr::ReleaseSkSurface, but this would be redundant, as
89 // SkGpuDevice::flush forces it.
90 // Passing true SkMultiPictureDraw::draw(bool flush) makes this happen.
91 multi_picture_draw.draw(true);
83 write_lock->ReleaseSkSurface(); 92 write_lock->ReleaseSkSurface();
84 } 93 }
85 } 94 }
86 95
87 } // namespace cc 96 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/raster/scoped_gpu_raster.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698