1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CC_SURFACES_SURFACE_AGGREGATOR_H_
6 #define CC_SURFACES_SURFACE_AGGREGATOR_H_
10 #include "base/containers/scoped_ptr_hash_map.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "cc/quads/render_pass.h"
13 #include "cc/surfaces/surfaces_export.h"
17 class CompositorFrame;
18 class DelegatedFrameData;
19 class SurfaceDrawQuad;
22 class CC_SURFACES_EXPORT SurfaceAggregator {
24 explicit SurfaceAggregator(SurfaceManager* manager);
27 scoped_ptr<CompositorFrame> Aggregate(int surface_id);
30 DelegatedFrameData* GetReferencedDataForSurfaceID(int surface_id);
31 RenderPass::Id RemapPassId(RenderPass::Id surface_local_pass_id,
34 void HandleSurfaceQuad(const SurfaceDrawQuad* surface_quad,
35 RenderPass* dest_pass);
36 void CopySharedQuadState(const SharedQuadState& source_sqs,
37 const gfx::Transform& content_to_target_transform,
38 SharedQuadStateList* dest_sqs_list);
39 void CopyQuadsToPass(const QuadList& source_quad_list,
40 const SharedQuadStateList& source_shared_quad_state_list,
41 const gfx::Transform& content_to_target_transform,
42 RenderPass* dest_pass,
44 void CopyPasses(const RenderPassList& source_pass_list, int surface_id);
46 SurfaceManager* manager_;
48 class RenderPassIdAllocator;
49 typedef base::ScopedPtrHashMap<int, RenderPassIdAllocator>
50 RenderPassIdAllocatorMap;
51 RenderPassIdAllocatorMap render_pass_allocator_map_;
53 // The following state is only valid for the duration of one Aggregate call
54 // and is only stored on the class to avoid having to pass through every
57 // This is the set of surfaces referenced in the aggregation so far, used to
59 std::set<int> referenced_surfaces_;
61 // This is the pass list for the aggregated frame.
62 RenderPassList* dest_pass_list_;
64 DISALLOW_COPY_AND_ASSIGN(SurfaceAggregator);
69 #endif // CC_SURFACES_SURFACE_AGGREGATOR_H_