| 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 <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 CompositorFrame Aggregate(const SurfaceId& surface_id); | 40 CompositorFrame Aggregate(const SurfaceId& surface_id); |
| 41 void ReleaseResources(const SurfaceId& surface_id); | 41 void ReleaseResources(const SurfaceId& surface_id); |
| 42 SurfaceIndexMap& previous_contained_surfaces() { | 42 SurfaceIndexMap& previous_contained_surfaces() { |
| 43 return previous_contained_surfaces_; | 43 return previous_contained_surfaces_; |
| 44 } | 44 } |
| 45 void SetFullDamageForSurface(const SurfaceId& surface_id); | 45 void SetFullDamageForSurface(const SurfaceId& surface_id); |
| 46 void set_output_is_secure(bool secure) { output_is_secure_ = secure; } | 46 void set_output_is_secure(bool secure) { output_is_secure_ = secure; } |
| 47 | 47 |
| 48 // Set the color spaces for the created RenderPasses, which is propagated | 48 // Set the color spaces for the created RenderPasses, which is propagated |
| 49 // to the output surface. | 49 // to the output surface. |
| 50 void SetOutputColorSpace(const gfx::ColorSpace& output_color_space); | 50 void SetOutputColorSpace(const gfx::ColorSpace& blending_color_space, |
| 51 const gfx::ColorSpace& output_color_space); |
| 51 | 52 |
| 52 private: | 53 private: |
| 53 struct ClipData { | 54 struct ClipData { |
| 54 ClipData() : is_clipped(false) {} | 55 ClipData() : is_clipped(false) {} |
| 55 ClipData(bool is_clipped, const gfx::Rect& rect) | 56 ClipData(bool is_clipped, const gfx::Rect& rect) |
| 56 : is_clipped(is_clipped), rect(rect) {} | 57 : is_clipped(is_clipped), rect(rect) {} |
| 57 | 58 |
| 58 bool is_clipped; | 59 bool is_clipped; |
| 59 gfx::Rect rect; | 60 gfx::Rect rect; |
| 60 }; | 61 }; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 const gfx::Transform& target_transform, | 101 const gfx::Transform& target_transform, |
| 101 const ClipData& clip_rect, | 102 const ClipData& clip_rect, |
| 102 RenderPass* dest_pass, | 103 RenderPass* dest_pass, |
| 103 const SurfaceId& surface_id); | 104 const SurfaceId& surface_id); |
| 104 gfx::Rect PrewalkTree(const SurfaceId& surface_id, | 105 gfx::Rect PrewalkTree(const SurfaceId& surface_id, |
| 105 bool in_moved_pixel_surface, | 106 bool in_moved_pixel_surface, |
| 106 int parent_pass, | 107 int parent_pass, |
| 107 PrewalkResult* result); | 108 PrewalkResult* result); |
| 108 void CopyUndrawnSurfaces(PrewalkResult* prewalk); | 109 void CopyUndrawnSurfaces(PrewalkResult* prewalk); |
| 109 void CopyPasses(const CompositorFrame& frame, Surface* surface); | 110 void CopyPasses(const CompositorFrame& frame, Surface* surface); |
| 111 void AddColorConversionPass(); |
| 110 | 112 |
| 111 // Remove Surfaces that were referenced before but aren't currently | 113 // Remove Surfaces that were referenced before but aren't currently |
| 112 // referenced from the ResourceProvider. | 114 // referenced from the ResourceProvider. |
| 113 // Also notifies SurfaceAggregatorClient of newly added and removed | 115 // Also notifies SurfaceAggregatorClient of newly added and removed |
| 114 // child surfaces. | 116 // child surfaces. |
| 115 void ProcessAddedAndRemovedSurfaces(); | 117 void ProcessAddedAndRemovedSurfaces(); |
| 116 | 118 |
| 117 void PropagateCopyRequestPasses(); | 119 void PropagateCopyRequestPasses(); |
| 118 | 120 |
| 119 int ChildIdForSurface(Surface* surface); | 121 int ChildIdForSurface(Surface* surface); |
| 120 gfx::Rect DamageRectForSurface(const Surface* surface, | 122 gfx::Rect DamageRectForSurface(const Surface* surface, |
| 121 const RenderPass& source, | 123 const RenderPass& source, |
| 122 const gfx::Rect& full_rect) const; | 124 const gfx::Rect& full_rect) const; |
| 123 | 125 |
| 124 SurfaceManager* manager_; | 126 SurfaceManager* manager_; |
| 125 ResourceProvider* provider_; | 127 ResourceProvider* provider_; |
| 126 | 128 |
| 127 // Every Surface has its own RenderPass ID namespace. This structure maps | 129 // Every Surface has its own RenderPass ID namespace. This structure maps |
| 128 // each source (SurfaceId, RenderPass id) to a unified ID namespace that's | 130 // each source (SurfaceId, RenderPass id) to a unified ID namespace that's |
| 129 // used in the aggregated frame. An entry is removed from the map if it's not | 131 // used in the aggregated frame. An entry is removed from the map if it's not |
| 130 // used for one output frame. | 132 // used for one output frame. |
| 131 using RenderPassIdAllocatorMap = | 133 using RenderPassIdAllocatorMap = |
| 132 std::map<std::pair<SurfaceId, int>, RenderPassInfo>; | 134 std::map<std::pair<SurfaceId, int>, RenderPassInfo>; |
| 133 RenderPassIdAllocatorMap render_pass_allocator_map_; | 135 RenderPassIdAllocatorMap render_pass_allocator_map_; |
| 134 int next_render_pass_id_; | 136 int next_render_pass_id_; |
| 135 const bool aggregate_only_damaged_; | 137 const bool aggregate_only_damaged_; |
| 136 bool output_is_secure_; | 138 bool output_is_secure_; |
| 139 |
| 140 // The color space for the root render pass. If this is different from |
| 141 // |blending_color_space_|, then a final render pass to convert between |
| 142 // the two will be added. |
| 137 gfx::ColorSpace output_color_space_; | 143 gfx::ColorSpace output_color_space_; |
| 144 // The color space in which blending is done, used for all non-root render |
| 145 // passes. |
| 146 gfx::ColorSpace blending_color_space_; |
| 147 // The id for the final color conversion render pass. |
| 148 int color_conversion_render_pass_id_ = 0; |
| 138 | 149 |
| 139 using SurfaceToResourceChildIdMap = | 150 using SurfaceToResourceChildIdMap = |
| 140 std::unordered_map<SurfaceId, int, SurfaceIdHash>; | 151 std::unordered_map<SurfaceId, int, SurfaceIdHash>; |
| 141 SurfaceToResourceChildIdMap surface_id_to_resource_child_id_; | 152 SurfaceToResourceChildIdMap surface_id_to_resource_child_id_; |
| 142 | 153 |
| 143 // The following state is only valid for the duration of one Aggregate call | 154 // The following state is only valid for the duration of one Aggregate call |
| 144 // and is only stored on the class to avoid having to pass through every | 155 // and is only stored on the class to avoid having to pass through every |
| 145 // function call. | 156 // function call. |
| 146 | 157 |
| 147 // This is the set of surfaces referenced in the aggregation so far, used to | 158 // This is the set of surfaces referenced in the aggregation so far, used to |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 TransferableResourceArray* dest_resource_list_; | 194 TransferableResourceArray* dest_resource_list_; |
| 184 | 195 |
| 185 base::WeakPtrFactory<SurfaceAggregator> weak_factory_; | 196 base::WeakPtrFactory<SurfaceAggregator> weak_factory_; |
| 186 | 197 |
| 187 DISALLOW_COPY_AND_ASSIGN(SurfaceAggregator); | 198 DISALLOW_COPY_AND_ASSIGN(SurfaceAggregator); |
| 188 }; | 199 }; |
| 189 | 200 |
| 190 } // namespace cc | 201 } // namespace cc |
| 191 | 202 |
| 192 #endif // CC_SURFACES_SURFACE_AGGREGATOR_H_ | 203 #endif // CC_SURFACES_SURFACE_AGGREGATOR_H_ |
| OLD | NEW |