| OLD | NEW |
| 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 <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <unordered_map> | 10 #include <unordered_map> |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 ClipData(bool is_clipped, const gfx::Rect& rect) | 49 ClipData(bool is_clipped, const gfx::Rect& rect) |
| 50 : is_clipped(is_clipped), rect(rect) {} | 50 : is_clipped(is_clipped), rect(rect) {} |
| 51 | 51 |
| 52 bool is_clipped; | 52 bool is_clipped; |
| 53 gfx::Rect rect; | 53 gfx::Rect rect; |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 struct PrewalkResult { | 56 struct PrewalkResult { |
| 57 PrewalkResult(); | 57 PrewalkResult(); |
| 58 ~PrewalkResult(); | 58 ~PrewalkResult(); |
| 59 bool has_copy_requests = false; |
| 59 // This is the set of Surfaces that were referenced by another Surface, but | 60 // This is the set of Surfaces that were referenced by another Surface, but |
| 60 // not included in a SurfaceDrawQuad. | 61 // not included in a SurfaceDrawQuad. |
| 61 std::set<SurfaceId> undrawn_surfaces; | 62 std::set<SurfaceId> undrawn_surfaces; |
| 62 }; | 63 }; |
| 63 | 64 |
| 64 ClipData CalculateClipRect(const ClipData& surface_clip, | 65 ClipData CalculateClipRect(const ClipData& surface_clip, |
| 65 const ClipData& quad_clip, | 66 const ClipData& quad_clip, |
| 66 const gfx::Transform& target_transform); | 67 const gfx::Transform& target_transform); |
| 67 | 68 |
| 68 RenderPassId RemapPassId(RenderPassId surface_local_pass_id, | 69 RenderPassId RemapPassId(RenderPassId surface_local_pass_id, |
| 69 SurfaceId surface_id); | 70 SurfaceId surface_id); |
| 70 | 71 |
| 71 void HandleSurfaceQuad(const SurfaceDrawQuad* surface_quad, | 72 void HandleSurfaceQuad(const SurfaceDrawQuad* surface_quad, |
| 72 const gfx::Transform& target_transform, | 73 const gfx::Transform& target_transform, |
| 73 const ClipData& clip_rect, | 74 const ClipData& clip_rect, |
| 74 RenderPass* dest_pass); | 75 RenderPass* dest_pass); |
| 75 SharedQuadState* CopySharedQuadState(const SharedQuadState* source_sqs, | 76 SharedQuadState* CopySharedQuadState(const SharedQuadState* source_sqs, |
| 76 const gfx::Transform& target_transform, | 77 const gfx::Transform& target_transform, |
| 77 const ClipData& clip_rect, | 78 const ClipData& clip_rect, |
| 78 RenderPass* dest_render_pass); | 79 RenderPass* dest_render_pass); |
| 79 void CopyQuadsToPass( | 80 void CopyQuadsToPass( |
| 80 const QuadList& source_quad_list, | 81 const QuadList& source_quad_list, |
| 81 const SharedQuadStateList& source_shared_quad_state_list, | 82 const SharedQuadStateList& source_shared_quad_state_list, |
| 82 const std::unordered_map<ResourceId, ResourceId>& resource_to_child_map, | 83 const std::unordered_map<ResourceId, ResourceId>& resource_to_child_map, |
| 83 const gfx::Transform& target_transform, | 84 const gfx::Transform& target_transform, |
| 84 const ClipData& clip_rect, | 85 const ClipData& clip_rect, |
| 85 RenderPass* dest_pass, | 86 RenderPass* dest_pass, |
| 86 SurfaceId surface_id); | 87 SurfaceId surface_id); |
| 87 gfx::Rect PrewalkTree(SurfaceId surface_id, | 88 gfx::Rect PrewalkTree(SurfaceId surface_id, PrewalkResult* result); |
| 88 bool in_moved_pixel_pass, | |
| 89 RenderPassId parent_pass, | |
| 90 PrewalkResult* result); | |
| 91 void CopyUndrawnSurfaces(PrewalkResult* prewalk); | 89 void CopyUndrawnSurfaces(PrewalkResult* prewalk); |
| 92 void CopyPasses(const DelegatedFrameData* frame_data, Surface* surface); | 90 void CopyPasses(const DelegatedFrameData* frame_data, Surface* surface); |
| 93 | 91 |
| 94 // Remove Surfaces that were referenced before but aren't currently | 92 // Remove Surfaces that were referenced before but aren't currently |
| 95 // referenced from the ResourceProvider. | 93 // referenced from the ResourceProvider. |
| 96 // Also notifies SurfaceAggregatorClient of newly added and removed | 94 // Also notifies SurfaceAggregatorClient of newly added and removed |
| 97 // child surfaces. | 95 // child surfaces. |
| 98 void ProcessAddedAndRemovedSurfaces(); | 96 void ProcessAddedAndRemovedSurfaces(); |
| 99 | 97 |
| 100 void PropagateCopyRequestPasses(); | |
| 101 | |
| 102 int ChildIdForSurface(Surface* surface); | 98 int ChildIdForSurface(Surface* surface); |
| 103 gfx::Rect DamageRectForSurface(const Surface* surface, | 99 gfx::Rect DamageRectForSurface(const Surface* surface, |
| 104 const RenderPass& source, | 100 const RenderPass& source, |
| 105 const gfx::Rect& full_rect) const; | 101 const gfx::Rect& full_rect) const; |
| 106 | 102 |
| 107 SurfaceManager* manager_; | 103 SurfaceManager* manager_; |
| 108 ResourceProvider* provider_; | 104 ResourceProvider* provider_; |
| 109 | 105 |
| 110 class RenderPassIdAllocator; | 106 class RenderPassIdAllocator; |
| 111 using RenderPassIdAllocatorMap = | 107 using RenderPassIdAllocatorMap = |
| (...skipping 21 matching lines...) Expand all Loading... |
| 133 // that time. | 129 // that time. |
| 134 SurfaceIndexMap previous_contained_surfaces_; | 130 SurfaceIndexMap previous_contained_surfaces_; |
| 135 SurfaceIndexMap contained_surfaces_; | 131 SurfaceIndexMap contained_surfaces_; |
| 136 | 132 |
| 137 // After surface validation, every Surface in this set is valid. | 133 // After surface validation, every Surface in this set is valid. |
| 138 std::unordered_set<SurfaceId, SurfaceIdHash> valid_surfaces_; | 134 std::unordered_set<SurfaceId, SurfaceIdHash> valid_surfaces_; |
| 139 | 135 |
| 140 // This is the pass list for the aggregated frame. | 136 // This is the pass list for the aggregated frame. |
| 141 RenderPassList* dest_pass_list_; | 137 RenderPassList* dest_pass_list_; |
| 142 | 138 |
| 143 // This is the set of aggregated pass ids that are affected by filters that | |
| 144 // move pixels. | |
| 145 std::unordered_set<RenderPassId, RenderPassIdHash> moved_pixel_passes_; | |
| 146 | |
| 147 // This is the set of aggregated pass ids that are drawn by copy requests, so | |
| 148 // should not have their damage rects clipped to the root damage rect. | |
| 149 std::unordered_set<RenderPassId, RenderPassIdHash> copy_request_passes_; | |
| 150 | |
| 151 // This maps each aggregated pass id to the set of (aggregated) pass ids | |
| 152 // that its RenderPassDrawQuads depend on | |
| 153 std::unordered_map<RenderPassId, | |
| 154 std::unordered_set<RenderPassId, RenderPassIdHash>, | |
| 155 RenderPassIdHash> | |
| 156 render_pass_dependencies_; | |
| 157 | |
| 158 // The root damage rect of the currently-aggregating frame. | 139 // The root damage rect of the currently-aggregating frame. |
| 159 gfx::Rect root_damage_rect_; | 140 gfx::Rect root_damage_rect_; |
| 160 | 141 |
| 161 // True if the frame that's currently being aggregated has copy requests. | 142 // True if the frame that's currently being aggregated has copy requests. |
| 162 // This is valid during Aggregate after PrewalkTree is called. | 143 // This is valid during Aggregate after PrewalkTree is called. |
| 163 bool has_copy_requests_; | 144 bool has_copy_requests_; |
| 164 | 145 |
| 165 // Resource list for the aggregated frame. | 146 // Resource list for the aggregated frame. |
| 166 TransferableResourceArray* dest_resource_list_; | 147 TransferableResourceArray* dest_resource_list_; |
| 167 | 148 |
| 168 base::WeakPtrFactory<SurfaceAggregator> weak_factory_; | 149 base::WeakPtrFactory<SurfaceAggregator> weak_factory_; |
| 169 | 150 |
| 170 DISALLOW_COPY_AND_ASSIGN(SurfaceAggregator); | 151 DISALLOW_COPY_AND_ASSIGN(SurfaceAggregator); |
| 171 }; | 152 }; |
| 172 | 153 |
| 173 } // namespace cc | 154 } // namespace cc |
| 174 | 155 |
| 175 #endif // CC_SURFACES_SURFACE_AGGREGATOR_H_ | 156 #endif // CC_SURFACES_SURFACE_AGGREGATOR_H_ |
| OLD | NEW |