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

Side by Side Diff: cc/surfaces/surface_aggregator.h

Issue 506273002: Aggregate damage rects in surface aggregator (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 unified diff | Download patch
« no previous file with comments | « cc/surfaces/surface.cc ('k') | cc/surfaces/surface_aggregator.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 2014 The Chromium Authors. All rights reserved. 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 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 #ifndef CC_SURFACES_SURFACE_AGGREGATOR_H_ 5 #ifndef CC_SURFACES_SURFACE_AGGREGATOR_H_
6 #define CC_SURFACES_SURFACE_AGGREGATOR_H_ 6 #define CC_SURFACES_SURFACE_AGGREGATOR_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
11 #include "base/containers/scoped_ptr_hash_map.h" 11 #include "base/containers/scoped_ptr_hash_map.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "cc/quads/render_pass.h" 13 #include "cc/quads/render_pass.h"
14 #include "cc/resources/transferable_resource.h" 14 #include "cc/resources/transferable_resource.h"
15 #include "cc/surfaces/surface_id.h" 15 #include "cc/surfaces/surface_id.h"
16 #include "cc/surfaces/surfaces_export.h" 16 #include "cc/surfaces/surfaces_export.h"
17 17
18 namespace cc { 18 namespace cc {
19 19
20 class CompositorFrame; 20 class CompositorFrame;
21 class DelegatedFrameData; 21 class DelegatedFrameData;
22 class ResourceProvider; 22 class ResourceProvider;
23 class Surface; 23 class Surface;
24 class SurfaceDrawQuad; 24 class SurfaceDrawQuad;
25 class SurfaceManager; 25 class SurfaceManager;
26 26
27 class CC_SURFACES_EXPORT SurfaceAggregator { 27 class CC_SURFACES_EXPORT SurfaceAggregator {
28 public: 28 public:
29 typedef base::hash_map<SurfaceId, int> SurfaceIndexMap;
30
29 SurfaceAggregator(SurfaceManager* manager, ResourceProvider* provider); 31 SurfaceAggregator(SurfaceManager* manager, ResourceProvider* provider);
30 ~SurfaceAggregator(); 32 ~SurfaceAggregator();
31 33
32 scoped_ptr<CompositorFrame> Aggregate( 34 scoped_ptr<CompositorFrame> Aggregate(SurfaceId surface_id);
33 SurfaceId surface_id, 35 SurfaceIndexMap& previous_contained_surfaces() {
34 std::set<SurfaceId>* contained_surfaces); 36 return previous_contained_surfaces_;
37 }
35 38
36 private: 39 private:
37 RenderPassId RemapPassId(RenderPassId surface_local_pass_id, 40 RenderPassId RemapPassId(RenderPassId surface_local_pass_id,
38 SurfaceId surface_id); 41 SurfaceId surface_id);
39 42
40 void HandleSurfaceQuad(const SurfaceDrawQuad* surface_quad, 43 void HandleSurfaceQuad(const SurfaceDrawQuad* surface_quad,
41 RenderPass* dest_pass); 44 RenderPass* dest_pass);
42 void CopySharedQuadState(const SharedQuadState* source_sqs, 45 void CopySharedQuadState(const SharedQuadState* source_sqs,
43 const gfx::Transform& content_to_target_transform, 46 const gfx::Transform& content_to_target_transform,
44 RenderPass* dest_render_pass); 47 RenderPass* dest_render_pass);
45 void CopyQuadsToPass(const QuadList& source_quad_list, 48 void CopyQuadsToPass(const QuadList& source_quad_list,
46 const SharedQuadStateList& source_shared_quad_state_list, 49 const SharedQuadStateList& source_shared_quad_state_list,
47 const gfx::Transform& content_to_target_transform, 50 const gfx::Transform& content_to_target_transform,
48 RenderPass* dest_pass, 51 RenderPass* dest_pass,
49 SurfaceId surface_id); 52 SurfaceId surface_id);
50 void CopyPasses(const RenderPassList& source_pass_list, SurfaceId surface_id); 53 void CopyPasses(const RenderPassList& source_pass_list,
54 const Surface* surface);
51 55
52 bool TakeResources(Surface* surface, 56 bool TakeResources(Surface* surface,
53 const DelegatedFrameData* frame_data, 57 const DelegatedFrameData* frame_data,
54 RenderPassList* render_pass_list); 58 RenderPassList* render_pass_list);
55 int ChildIdForSurface(Surface* surface); 59 int ChildIdForSurface(Surface* surface);
60 gfx::Rect DamageRectForSurface(const Surface* surface,
61 const RenderPass& source);
56 62
57 SurfaceManager* manager_; 63 SurfaceManager* manager_;
58 ResourceProvider* provider_; 64 ResourceProvider* provider_;
59 65
60 class RenderPassIdAllocator; 66 class RenderPassIdAllocator;
61 typedef base::ScopedPtrHashMap<SurfaceId, RenderPassIdAllocator> 67 typedef base::ScopedPtrHashMap<SurfaceId, RenderPassIdAllocator>
62 RenderPassIdAllocatorMap; 68 RenderPassIdAllocatorMap;
63 RenderPassIdAllocatorMap render_pass_allocator_map_; 69 RenderPassIdAllocatorMap render_pass_allocator_map_;
64 70
65 typedef base::hash_map<SurfaceId, int> SurfaceToResourceChildIdMap; 71 typedef base::hash_map<SurfaceId, int> SurfaceToResourceChildIdMap;
66 SurfaceToResourceChildIdMap surface_id_to_resource_child_id_; 72 SurfaceToResourceChildIdMap surface_id_to_resource_child_id_;
67 73
68 // The following state is only valid for the duration of one Aggregate call 74 // The following state is only valid for the duration of one Aggregate call
69 // and is only stored on the class to avoid having to pass through every 75 // and is only stored on the class to avoid having to pass through every
70 // function call. 76 // function call.
71 77
72 // This is the set of surfaces referenced in the aggregation so far, used to 78 // This is the set of surfaces referenced in the aggregation so far, used to
73 // detect cycles. 79 // detect cycles.
74 typedef std::set<SurfaceId> SurfaceSet; 80 typedef std::set<SurfaceId> SurfaceSet;
75 SurfaceSet referenced_surfaces_; 81 SurfaceSet referenced_surfaces_;
76 82
77 // This is the set of surfaces that were used in the last draw. 83 // For each Surface used in the last aggregation, gives the frame_index at
78 SurfaceSet* contained_surfaces_; 84 // that time.
85 SurfaceIndexMap previous_contained_surfaces_;
86 SurfaceIndexMap contained_surfaces_;
79 87
80 // This is the pass list for the aggregated frame. 88 // This is the pass list for the aggregated frame.
81 RenderPassList* dest_pass_list_; 89 RenderPassList* dest_pass_list_;
82 90
83 // Resource list for the aggregated frame. 91 // Resource list for the aggregated frame.
84 TransferableResourceArray* dest_resource_list_; 92 TransferableResourceArray* dest_resource_list_;
85 93
86 DISALLOW_COPY_AND_ASSIGN(SurfaceAggregator); 94 DISALLOW_COPY_AND_ASSIGN(SurfaceAggregator);
87 }; 95 };
88 96
89 } // namespace cc 97 } // namespace cc
90 98
91 #endif // CC_SURFACES_SURFACE_AGGREGATOR_H_ 99 #endif // CC_SURFACES_SURFACE_AGGREGATOR_H_
OLDNEW
« no previous file with comments | « cc/surfaces/surface.cc ('k') | cc/surfaces/surface_aggregator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698