| 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 #include "cc/output/overlay_processor.h" | 5 #include "cc/output/overlay_processor.h" |
| 6 | 6 |
| 7 #include "cc/output/dc_layer_overlay.h" | 7 #include "cc/output/dc_layer_overlay.h" |
| 8 #include "cc/output/output_surface.h" | 8 #include "cc/output/output_surface.h" |
| 9 #include "cc/output/overlay_strategy_single_on_top.h" | 9 #include "cc/output/overlay_strategy_single_on_top.h" |
| 10 #include "cc/output/overlay_strategy_underlay.h" | 10 #include "cc/output/overlay_strategy_underlay.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 // list. | 84 // list. |
| 85 overlay_candidates->clear(); | 85 overlay_candidates->clear(); |
| 86 overlay_damage_rect_ = render_pass->output_rect; | 86 overlay_damage_rect_ = render_pass->output_rect; |
| 87 *damage_rect = gfx::Rect(); | 87 *damage_rect = gfx::Rect(); |
| 88 return true; | 88 return true; |
| 89 } | 89 } |
| 90 | 90 |
| 91 bool OverlayProcessor::ProcessForDCLayers( | 91 bool OverlayProcessor::ProcessForDCLayers( |
| 92 ResourceProvider* resource_provider, | 92 ResourceProvider* resource_provider, |
| 93 RenderPass* render_pass, | 93 RenderPass* render_pass, |
| 94 bool was_reshaped, |
| 94 const base::flat_map<int, FilterOperations*>& render_pass_filters, | 95 const base::flat_map<int, FilterOperations*>& render_pass_filters, |
| 95 const base::flat_map<int, FilterOperations*>& | 96 const base::flat_map<int, FilterOperations*>& |
| 96 render_pass_background_filters, | 97 render_pass_background_filters, |
| 97 OverlayCandidateList* overlay_candidates, | 98 OverlayCandidateList* overlay_candidates, |
| 98 DCLayerOverlayList* dc_layer_overlays, | 99 DCLayerOverlayList* dc_layer_overlays, |
| 99 gfx::Rect* damage_rect) { | 100 gfx::Rect* damage_rect) { |
| 100 OverlayCandidateValidator* overlay_validator = | 101 OverlayCandidateValidator* overlay_validator = |
| 101 surface_->GetOverlayCandidateValidator(); | 102 surface_->GetOverlayCandidateValidator(); |
| 102 if (!overlay_validator || !overlay_validator->AllowDCLayerOverlays()) | 103 if (!overlay_validator || !overlay_validator->AllowDCLayerOverlays()) |
| 103 return false; | 104 return false; |
| 104 | 105 |
| 105 dc_processor_.Process(resource_provider, gfx::RectF(render_pass->output_rect), | 106 dc_processor_.Process(resource_provider, was_reshaped, |
| 107 gfx::RectF(render_pass->output_rect), |
| 106 &render_pass->quad_list, &overlay_damage_rect_, | 108 &render_pass->quad_list, &overlay_damage_rect_, |
| 107 damage_rect, dc_layer_overlays); | 109 damage_rect, dc_layer_overlays); |
| 108 | 110 |
| 109 DCHECK(overlay_candidates->empty()); | 111 DCHECK(overlay_candidates->empty()); |
| 110 return true; | 112 return true; |
| 111 } | 113 } |
| 112 | 114 |
| 113 void OverlayProcessor::ProcessForOverlays( | 115 void OverlayProcessor::ProcessForOverlays( |
| 114 ResourceProvider* resource_provider, | 116 ResourceProvider* resource_provider, |
| 115 RenderPass* render_pass, | 117 RenderPass* render_pass, |
| 118 bool was_reshaped, |
| 116 const base::flat_map<int, FilterOperations*>& render_pass_filters, | 119 const base::flat_map<int, FilterOperations*>& render_pass_filters, |
| 117 const base::flat_map<int, FilterOperations*>& | 120 const base::flat_map<int, FilterOperations*>& |
| 118 render_pass_background_filters, | 121 render_pass_background_filters, |
| 119 OverlayCandidateList* candidates, | 122 OverlayCandidateList* candidates, |
| 120 CALayerOverlayList* ca_layer_overlays, | 123 CALayerOverlayList* ca_layer_overlays, |
| 121 DCLayerOverlayList* dc_layer_overlays, | 124 DCLayerOverlayList* dc_layer_overlays, |
| 122 gfx::Rect* damage_rect, | 125 gfx::Rect* damage_rect, |
| 123 std::vector<gfx::Rect>* content_bounds) { | 126 std::vector<gfx::Rect>* content_bounds) { |
| 124 #if defined(OS_ANDROID) | 127 #if defined(OS_ANDROID) |
| 125 // Be sure to send out notifications, regardless of whether we get to | 128 // Be sure to send out notifications, regardless of whether we get to |
| (...skipping 15 matching lines...) Expand all Loading... |
| 141 return; | 144 return; |
| 142 } | 145 } |
| 143 | 146 |
| 144 // First attempt to process for CALayers. | 147 // First attempt to process for CALayers. |
| 145 if (ProcessForCALayers(resource_provider, render_pass, render_pass_filters, | 148 if (ProcessForCALayers(resource_provider, render_pass, render_pass_filters, |
| 146 render_pass_background_filters, candidates, | 149 render_pass_background_filters, candidates, |
| 147 ca_layer_overlays, damage_rect)) { | 150 ca_layer_overlays, damage_rect)) { |
| 148 return; | 151 return; |
| 149 } | 152 } |
| 150 | 153 |
| 151 if (ProcessForDCLayers(resource_provider, render_pass, render_pass_filters, | 154 if (ProcessForDCLayers(resource_provider, render_pass, was_reshaped, |
| 152 render_pass_background_filters, candidates, | 155 render_pass_filters, render_pass_background_filters, |
| 153 dc_layer_overlays, damage_rect)) { | 156 candidates, dc_layer_overlays, damage_rect)) { |
| 154 return; | 157 return; |
| 155 } | 158 } |
| 156 | 159 |
| 157 // Only if that fails, attempt hardware overlay strategies. | 160 // Only if that fails, attempt hardware overlay strategies. |
| 158 for (const auto& strategy : strategies_) { | 161 for (const auto& strategy : strategies_) { |
| 159 if (!strategy->Attempt(resource_provider, render_pass, candidates, | 162 if (!strategy->Attempt(resource_provider, render_pass, candidates, |
| 160 content_bounds)) | 163 content_bounds)) |
| 161 continue; | 164 continue; |
| 162 | 165 |
| 163 UpdateDamageRect(candidates, previous_frame_underlay_rect, damage_rect); | 166 UpdateDamageRect(candidates, previous_frame_underlay_rect, damage_rect); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 194 } | 197 } |
| 195 | 198 |
| 196 if (this_frame_underlay_rect == previous_frame_underlay_rect) | 199 if (this_frame_underlay_rect == previous_frame_underlay_rect) |
| 197 damage_rect->Subtract(this_frame_underlay_rect); | 200 damage_rect->Subtract(this_frame_underlay_rect); |
| 198 previous_frame_underlay_rect_ = this_frame_underlay_rect; | 201 previous_frame_underlay_rect_ = this_frame_underlay_rect; |
| 199 | 202 |
| 200 damage_rect->Union(output_surface_overlay_damage_rect); | 203 damage_rect->Union(output_surface_overlay_damage_rect); |
| 201 } | 204 } |
| 202 | 205 |
| 203 } // namespace cc | 206 } // namespace cc |
| OLD | NEW |