| 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 13 matching lines...) Expand all Loading... |
| 24 validator->GetStrategies(&strategies_); | 24 validator->GetStrategies(&strategies_); |
| 25 } | 25 } |
| 26 | 26 |
| 27 OverlayProcessor::~OverlayProcessor() {} | 27 OverlayProcessor::~OverlayProcessor() {} |
| 28 | 28 |
| 29 bool OverlayProcessor::ProcessForCALayers( | 29 bool OverlayProcessor::ProcessForCALayers( |
| 30 ResourceProvider* resource_provider, | 30 ResourceProvider* resource_provider, |
| 31 RenderPassList* render_passes, | 31 RenderPassList* render_passes, |
| 32 CALayerOverlayList* ca_layer_overlays, | 32 CALayerOverlayList* ca_layer_overlays, |
| 33 OverlayCandidateList* overlay_candidates) { | 33 OverlayCandidateList* overlay_candidates) { |
| 34 RenderPass* root_render_pass = render_passes->back(); | 34 RenderPass* root_render_pass = render_passes->back().get(); |
| 35 | 35 |
| 36 OverlayCandidateValidator* overlay_validator = | 36 OverlayCandidateValidator* overlay_validator = |
| 37 surface_->GetOverlayCandidateValidator(); | 37 surface_->GetOverlayCandidateValidator(); |
| 38 if (!overlay_validator || !overlay_validator->AllowCALayerOverlays()) | 38 if (!overlay_validator || !overlay_validator->AllowCALayerOverlays()) |
| 39 return false; | 39 return false; |
| 40 | 40 |
| 41 if (!ProcessForCALayerOverlays( | 41 if (!ProcessForCALayerOverlays( |
| 42 resource_provider, gfx::RectF(root_render_pass->output_rect), | 42 resource_provider, gfx::RectF(root_render_pass->output_rect), |
| 43 root_render_pass->quad_list, ca_layer_overlays)) | 43 root_render_pass->quad_list, ca_layer_overlays)) |
| 44 return false; | 44 return false; |
| 45 | 45 |
| 46 // CALayer overlays are all-or-nothing. If all quads were replaced with | 46 // CALayer overlays are all-or-nothing. If all quads were replaced with |
| 47 // layers then clear the list and remove the backbuffer from the overcandidate | 47 // layers then clear the list and remove the backbuffer from the overcandidate |
| 48 // list. | 48 // list. |
| 49 overlay_candidates->clear(); | 49 overlay_candidates->clear(); |
| 50 render_passes->back()->quad_list.clear(); | 50 render_passes->back()->quad_list.clear(); |
| 51 return true; | 51 return true; |
| 52 } | 52 } |
| 53 | 53 |
| 54 void OverlayProcessor::ProcessForOverlays(ResourceProvider* resource_provider, | 54 void OverlayProcessor::ProcessForOverlays(ResourceProvider* resource_provider, |
| 55 RenderPassList* render_passes, | 55 RenderPassList* render_passes, |
| 56 OverlayCandidateList* candidates, | 56 OverlayCandidateList* candidates, |
| 57 gfx::Rect* damage_rect) { | 57 gfx::Rect* damage_rect) { |
| 58 for (auto strategy : strategies_) { | 58 for (const auto& strategy : strategies_) { |
| 59 if (strategy->Attempt(resource_provider, render_passes, candidates, | 59 if (strategy->Attempt(resource_provider, render_passes, candidates, |
| 60 damage_rect)) { | 60 damage_rect)) { |
| 61 return; | 61 return; |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 } | 64 } |
| 65 | 65 |
| 66 } // namespace cc | 66 } // namespace cc |
| OLD | NEW |