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