| 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 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 class CC_SURFACES_EXPORT SurfaceAggregator { | 30 class CC_SURFACES_EXPORT SurfaceAggregator { |
| 31 public: | 31 public: |
| 32 using SurfaceIndexMap = std::unordered_map<SurfaceId, int, SurfaceIdHash>; | 32 using SurfaceIndexMap = std::unordered_map<SurfaceId, int, SurfaceIdHash>; |
| 33 | 33 |
| 34 SurfaceAggregator(SurfaceManager* manager, | 34 SurfaceAggregator(SurfaceManager* manager, |
| 35 ResourceProvider* provider, | 35 ResourceProvider* provider, |
| 36 bool aggregate_only_damaged); | 36 bool aggregate_only_damaged); |
| 37 ~SurfaceAggregator(); | 37 ~SurfaceAggregator(); |
| 38 | 38 |
| 39 CompositorFrame Aggregate(SurfaceId surface_id); | 39 CompositorFrame Aggregate(const SurfaceId& surface_id); |
| 40 void ReleaseResources(SurfaceId surface_id); | 40 void ReleaseResources(const SurfaceId& surface_id); |
| 41 SurfaceIndexMap& previous_contained_surfaces() { | 41 SurfaceIndexMap& previous_contained_surfaces() { |
| 42 return previous_contained_surfaces_; | 42 return previous_contained_surfaces_; |
| 43 } | 43 } |
| 44 void SetFullDamageForSurface(SurfaceId surface_id); | 44 void SetFullDamageForSurface(const SurfaceId& surface_id); |
| 45 void set_output_is_secure(bool secure) { output_is_secure_ = secure; } | 45 void set_output_is_secure(bool secure) { output_is_secure_ = secure; } |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 struct ClipData { | 48 struct ClipData { |
| 49 ClipData() : is_clipped(false) {} | 49 ClipData() : is_clipped(false) {} |
| 50 ClipData(bool is_clipped, const gfx::Rect& rect) | 50 ClipData(bool is_clipped, const gfx::Rect& rect) |
| 51 : is_clipped(is_clipped), rect(rect) {} | 51 : is_clipped(is_clipped), rect(rect) {} |
| 52 | 52 |
| 53 bool is_clipped; | 53 bool is_clipped; |
| 54 gfx::Rect rect; | 54 gfx::Rect rect; |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 struct PrewalkResult { | 57 struct PrewalkResult { |
| 58 PrewalkResult(); | 58 PrewalkResult(); |
| 59 ~PrewalkResult(); | 59 ~PrewalkResult(); |
| 60 // 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 |
| 61 // not included in a SurfaceDrawQuad. | 61 // not included in a SurfaceDrawQuad. |
| 62 std::set<SurfaceId> undrawn_surfaces; | 62 std::set<SurfaceId> undrawn_surfaces; |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 ClipData CalculateClipRect(const ClipData& surface_clip, | 65 ClipData CalculateClipRect(const ClipData& surface_clip, |
| 66 const ClipData& quad_clip, | 66 const ClipData& quad_clip, |
| 67 const gfx::Transform& target_transform); | 67 const gfx::Transform& target_transform); |
| 68 | 68 |
| 69 RenderPassId RemapPassId(RenderPassId surface_local_pass_id, | 69 RenderPassId RemapPassId(RenderPassId surface_local_pass_id, |
| 70 SurfaceId surface_id); | 70 const SurfaceId& surface_id); |
| 71 | 71 |
| 72 void HandleSurfaceQuad(const SurfaceDrawQuad* surface_quad, | 72 void HandleSurfaceQuad(const SurfaceDrawQuad* surface_quad, |
| 73 const gfx::Transform& target_transform, | 73 const gfx::Transform& target_transform, |
| 74 const ClipData& clip_rect, | 74 const ClipData& clip_rect, |
| 75 RenderPass* dest_pass); | 75 RenderPass* dest_pass); |
| 76 SharedQuadState* CopySharedQuadState(const SharedQuadState* source_sqs, | 76 SharedQuadState* CopySharedQuadState(const SharedQuadState* source_sqs, |
| 77 const gfx::Transform& target_transform, | 77 const gfx::Transform& target_transform, |
| 78 const ClipData& clip_rect, | 78 const ClipData& clip_rect, |
| 79 RenderPass* dest_render_pass); | 79 RenderPass* dest_render_pass); |
| 80 void CopyQuadsToPass( | 80 void CopyQuadsToPass( |
| 81 const QuadList& source_quad_list, | 81 const QuadList& source_quad_list, |
| 82 const SharedQuadStateList& source_shared_quad_state_list, | 82 const SharedQuadStateList& source_shared_quad_state_list, |
| 83 const std::unordered_map<ResourceId, ResourceId>& resource_to_child_map, | 83 const std::unordered_map<ResourceId, ResourceId>& resource_to_child_map, |
| 84 const gfx::Transform& target_transform, | 84 const gfx::Transform& target_transform, |
| 85 const ClipData& clip_rect, | 85 const ClipData& clip_rect, |
| 86 RenderPass* dest_pass, | 86 RenderPass* dest_pass, |
| 87 SurfaceId surface_id); | 87 const SurfaceId& surface_id); |
| 88 gfx::Rect PrewalkTree(SurfaceId surface_id, | 88 gfx::Rect PrewalkTree(const SurfaceId& surface_id, |
| 89 bool in_moved_pixel_pass, | 89 bool in_moved_pixel_pass, |
| 90 RenderPassId parent_pass, | 90 RenderPassId parent_pass, |
| 91 PrewalkResult* result); | 91 PrewalkResult* result); |
| 92 void CopyUndrawnSurfaces(PrewalkResult* prewalk); | 92 void CopyUndrawnSurfaces(PrewalkResult* prewalk); |
| 93 void CopyPasses(const DelegatedFrameData* frame_data, Surface* surface); | 93 void CopyPasses(const DelegatedFrameData* frame_data, Surface* surface); |
| 94 | 94 |
| 95 // Remove Surfaces that were referenced before but aren't currently | 95 // Remove Surfaces that were referenced before but aren't currently |
| 96 // referenced from the ResourceProvider. | 96 // referenced from the ResourceProvider. |
| 97 // Also notifies SurfaceAggregatorClient of newly added and removed | 97 // Also notifies SurfaceAggregatorClient of newly added and removed |
| 98 // child surfaces. | 98 // child surfaces. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 TransferableResourceArray* dest_resource_list_; | 168 TransferableResourceArray* dest_resource_list_; |
| 169 | 169 |
| 170 base::WeakPtrFactory<SurfaceAggregator> weak_factory_; | 170 base::WeakPtrFactory<SurfaceAggregator> weak_factory_; |
| 171 | 171 |
| 172 DISALLOW_COPY_AND_ASSIGN(SurfaceAggregator); | 172 DISALLOW_COPY_AND_ASSIGN(SurfaceAggregator); |
| 173 }; | 173 }; |
| 174 | 174 |
| 175 } // namespace cc | 175 } // namespace cc |
| 176 | 176 |
| 177 #endif // CC_SURFACES_SURFACE_AGGREGATOR_H_ | 177 #endif // CC_SURFACES_SURFACE_AGGREGATOR_H_ |
| OLD | NEW |