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

Unified Diff: cc/surfaces/surface_aggregator.cc

Issue 565313003: Support doing CopyOutputRequests on surfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/surfaces/surface.cc ('k') | cc/surfaces/surface_aggregator_test_helpers.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/surface_aggregator.cc
diff --git a/cc/surfaces/surface_aggregator.cc b/cc/surfaces/surface_aggregator.cc
index 050a2f0e0f3b999dcaab8c5a63b428fff4a444e0..ab51068155022c92350b460411ed7037306ef96a 100644
--- a/cc/surfaces/surface_aggregator.cc
+++ b/cc/surfaces/surface_aggregator.cc
@@ -176,8 +176,15 @@ void SurfaceAggregator::HandleSurfaceQuad(const SurfaceDrawQuad* surface_quad,
SurfaceSet::iterator it = referenced_surfaces_.insert(surface_id).first;
+ ScopedPtrVector<CopyOutputRequest> copy_requests;
+ surface->TakeCopyOutputRequests(&copy_requests);
+
+ bool merge_pass = copy_requests.empty();
+
const RenderPassList& referenced_passes = render_pass_list;
- for (size_t j = 0; j + 1 < referenced_passes.size(); ++j) {
+ size_t passes_to_copy =
+ merge_pass ? referenced_passes.size() - 1 : referenced_passes.size();
+ for (size_t j = 0; j < passes_to_copy; ++j) {
const RenderPass& source = *referenced_passes[j];
scoped_ptr<RenderPass> copy_pass(RenderPass::Create());
@@ -207,16 +214,37 @@ void SurfaceAggregator::HandleSurfaceQuad(const SurfaceDrawQuad* surface_quad,
dest_pass_list_->push_back(copy_pass.Pass());
}
- // TODO(jamesr): Clean up last pass special casing.
const RenderPass& last_pass = *render_pass_list.back();
- const QuadList& quads = last_pass.quad_list;
-
- // TODO(jamesr): Make sure clipping is enforced.
- CopyQuadsToPass(quads,
- last_pass.shared_quad_state_list,
- surface_quad->quadTransform(),
- dest_pass,
- surface_id);
+ if (merge_pass) {
+ // TODO(jamesr): Clean up last pass special casing.
+ const QuadList& quads = last_pass.quad_list;
+
+ // TODO(jamesr): Make sure clipping is enforced.
+ CopyQuadsToPass(quads,
+ last_pass.shared_quad_state_list,
+ surface_quad->quadTransform(),
+ dest_pass,
+ surface_id);
+ } else {
+ RenderPassId remapped_pass_id = RemapPassId(last_pass.id, surface_id);
+
+ dest_pass_list_->back()->copy_requests.swap(copy_requests);
+
+ SharedQuadState* shared_quad_state =
+ dest_pass->CreateAndAppendSharedQuadState();
+ shared_quad_state->CopyFrom(surface_quad->shared_quad_state);
+ scoped_ptr<RenderPassDrawQuad> quad(new RenderPassDrawQuad);
+ quad->SetNew(shared_quad_state,
+ surface_quad->rect,
+ surface_quad->visible_rect,
+ remapped_pass_id,
+ 0,
+ gfx::RectF(),
+ FilterOperations(),
+ gfx::Vector2dF(),
+ FilterOperations());
+ dest_pass->quad_list.push_back(quad.PassAs<DrawQuad>());
+ }
dest_pass->damage_rect =
gfx::UnionRects(dest_pass->damage_rect,
MathUtil::MapEnclosingClippedRect(
« no previous file with comments | « cc/surfaces/surface.cc ('k') | cc/surfaces/surface_aggregator_test_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698