summaryrefslogtreecommitdiffstats
path: root/cc/surfaces/surface_aggregator.cc
diff options
context:
space:
mode:
authorjbauman <jbauman@chromium.org>2014-09-15 18:05:40 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-16 01:07:07 +0000
commit2cd9f8f5c3acf503ade180a5584a2c5c1e1004e1 (patch)
tree49880edfa4f972c695e58432e0f9dea045c59a78 /cc/surfaces/surface_aggregator.cc
parentcba3d2fec7493eeb9a22d712be62969299750c55 (diff)
downloadchromium_src-2cd9f8f5c3acf503ade180a5584a2c5c1e1004e1.zip
chromium_src-2cd9f8f5c3acf503ade180a5584a2c5c1e1004e1.tar.gz
chromium_src-2cd9f8f5c3acf503ade180a5584a2c5c1e1004e1.tar.bz2
Support doing CopyOutputRequests on surfaces.
If a surface has a copy output request pending, then the aggregator should avoid merging its root pass into its parent pass, and should instead place the copy request on it. BUG=397730 Review URL: https://codereview.chromium.org/565313003 Cr-Commit-Position: refs/heads/master@{#294957}
Diffstat (limited to 'cc/surfaces/surface_aggregator.cc')
-rw-r--r--cc/surfaces/surface_aggregator.cc48
1 files changed, 38 insertions, 10 deletions
diff --git a/cc/surfaces/surface_aggregator.cc b/cc/surfaces/surface_aggregator.cc
index 050a2f0e..ab51068 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(