| 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/output_surface.h" | 7 #include "cc/output/output_surface.h" |
| 8 #include "cc/output/overlay_strategy_single_on_top.h" | 8 #include "cc/output/overlay_strategy_single_on_top.h" |
| 9 #include "cc/output/overlay_strategy_underlay.h" | 9 #include "cc/output/overlay_strategy_underlay.h" |
| 10 #include "cc/quads/draw_quad.h" | 10 #include "cc/quads/draw_quad.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 return true; | 86 return true; |
| 87 } | 87 } |
| 88 | 88 |
| 89 void OverlayProcessor::ProcessForOverlays( | 89 void OverlayProcessor::ProcessForOverlays( |
| 90 ResourceProvider* resource_provider, | 90 ResourceProvider* resource_provider, |
| 91 RenderPass* render_pass, | 91 RenderPass* render_pass, |
| 92 const RenderPassFilterList& render_pass_filters, | 92 const RenderPassFilterList& render_pass_filters, |
| 93 const RenderPassFilterList& render_pass_background_filters, | 93 const RenderPassFilterList& render_pass_background_filters, |
| 94 OverlayCandidateList* candidates, | 94 OverlayCandidateList* candidates, |
| 95 CALayerOverlayList* ca_layer_overlays, | 95 CALayerOverlayList* ca_layer_overlays, |
| 96 gfx::Rect* damage_rect) { | 96 gfx::Rect* damage_rect, |
| 97 std::vector<gfx::Rect>* content_bounds) { |
| 97 #if defined(OS_ANDROID) | 98 #if defined(OS_ANDROID) |
| 98 // Be sure to send out notifications, regardless of whether we get to | 99 // Be sure to send out notifications, regardless of whether we get to |
| 99 // processing for overlays or not. If we don't, then we should notify that | 100 // processing for overlays or not. If we don't, then we should notify that |
| 100 // they are not promotable. | 101 // they are not promotable. |
| 101 SendPromotionHintsBeforeReturning notifier(resource_provider, candidates); | 102 SendPromotionHintsBeforeReturning notifier(resource_provider, candidates); |
| 102 #endif | 103 #endif |
| 103 | 104 |
| 104 // If we have any copy requests, we can't remove any quads for overlays or | 105 // If we have any copy requests, we can't remove any quads for overlays or |
| 105 // CALayers because the framebuffer would be missing the removed quads' | 106 // CALayers because the framebuffer would be missing the removed quads' |
| 106 // contents. | 107 // contents. |
| 107 if (!render_pass->copy_requests.empty()) { | 108 if (!render_pass->copy_requests.empty()) { |
| 108 // If overlay processing was skipped for a frame there's no way to be sure | 109 // If overlay processing was skipped for a frame there's no way to be sure |
| 109 // of the state of the previous frame, so reset. | 110 // of the state of the previous frame, so reset. |
| 110 previous_frame_underlay_rect_ = gfx::Rect(); | 111 previous_frame_underlay_rect_ = gfx::Rect(); |
| 111 return; | 112 return; |
| 112 } | 113 } |
| 113 | 114 |
| 114 // First attempt to process for CALayers. | 115 // First attempt to process for CALayers. |
| 115 if (ProcessForCALayers(resource_provider, render_pass, render_pass_filters, | 116 if (ProcessForCALayers(resource_provider, render_pass, render_pass_filters, |
| 116 render_pass_background_filters, candidates, | 117 render_pass_background_filters, candidates, |
| 117 ca_layer_overlays, damage_rect)) { | 118 ca_layer_overlays, damage_rect)) { |
| 118 return; | 119 return; |
| 119 } | 120 } |
| 120 | 121 |
| 121 // Only if that fails, attempt hardware overlay strategies. | 122 // Only if that fails, attempt hardware overlay strategies. |
| 122 for (const auto& strategy : strategies_) { | 123 for (const auto& strategy : strategies_) { |
| 123 if (!strategy->Attempt(resource_provider, render_pass, candidates)) | 124 if (!strategy->Attempt(resource_provider, render_pass, candidates, |
| 125 content_bounds)) |
| 124 continue; | 126 continue; |
| 125 | 127 |
| 126 UpdateDamageRect(candidates, damage_rect); | 128 UpdateDamageRect(candidates, damage_rect); |
| 127 return; | 129 return; |
| 128 } | 130 } |
| 129 } | 131 } |
| 130 | 132 |
| 131 // Subtract on-top overlays from the damage rect, unless the overlays use | 133 // Subtract on-top overlays from the damage rect, unless the overlays use |
| 132 // the backbuffer as their content (in which case, add their combined rect | 134 // the backbuffer as their content (in which case, add their combined rect |
| 133 // back to the damage at the end). | 135 // back to the damage at the end). |
| (...skipping 21 matching lines...) Expand all Loading... |
| 155 } | 157 } |
| 156 | 158 |
| 157 if (this_frame_underlay_rect == previous_frame_underlay_rect_) | 159 if (this_frame_underlay_rect == previous_frame_underlay_rect_) |
| 158 damage_rect->Subtract(this_frame_underlay_rect); | 160 damage_rect->Subtract(this_frame_underlay_rect); |
| 159 previous_frame_underlay_rect_ = this_frame_underlay_rect; | 161 previous_frame_underlay_rect_ = this_frame_underlay_rect; |
| 160 | 162 |
| 161 damage_rect->Union(output_surface_overlay_damage_rect); | 163 damage_rect->Union(output_surface_overlay_damage_rect); |
| 162 } | 164 } |
| 163 | 165 |
| 164 } // namespace cc | 166 } // namespace cc |
| OLD | NEW |