| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 overlay_damage_rect_ = render_pass->output_rect; | 55 overlay_damage_rect_ = render_pass->output_rect; |
| 56 *damage_rect = gfx::Rect(); | 56 *damage_rect = gfx::Rect(); |
| 57 return true; | 57 return true; |
| 58 } | 58 } |
| 59 | 59 |
| 60 void OverlayProcessor::ProcessForOverlays(ResourceProvider* resource_provider, | 60 void OverlayProcessor::ProcessForOverlays(ResourceProvider* resource_provider, |
| 61 RenderPass* render_pass, | 61 RenderPass* render_pass, |
| 62 OverlayCandidateList* candidates, | 62 OverlayCandidateList* candidates, |
| 63 CALayerOverlayList* ca_layer_overlays, | 63 CALayerOverlayList* ca_layer_overlays, |
| 64 gfx::Rect* damage_rect) { | 64 gfx::Rect* damage_rect) { |
| 65 OverlayCandidateValidator* overlay_validator = |
| 66 surface_->GetOverlayCandidateValidator(); |
| 67 overlay_validator->ClearPromotableResources(); |
| 68 |
| 65 // If we have any copy requests, we can't remove any quads for overlays or | 69 // If we have any copy requests, we can't remove any quads for overlays or |
| 66 // CALayers because the framebuffer would be missing the removed quads' | 70 // CALayers because the framebuffer would be missing the removed quads' |
| 67 // contents. | 71 // contents. |
| 68 if (!render_pass->copy_requests.empty()) { | 72 if (!render_pass->copy_requests.empty()) { |
| 69 // If overlay processing was skipped for a frame there's no way to be sure | 73 // If overlay processing was skipped for a frame there's no way to be sure |
| 70 // of the state of the previous frame, so reset. | 74 // of the state of the previous frame, so reset. |
| 71 previous_frame_underlay_rect_ = gfx::Rect(); | 75 previous_frame_underlay_rect_ = gfx::Rect(); |
| 72 return; | 76 return; |
| 73 } | 77 } |
| 74 | 78 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 } | 118 } |
| 115 } | 119 } |
| 116 | 120 |
| 117 if (this_frame_underlay_rect == previous_frame_underlay_rect_) | 121 if (this_frame_underlay_rect == previous_frame_underlay_rect_) |
| 118 damage_rect->Subtract(this_frame_underlay_rect); | 122 damage_rect->Subtract(this_frame_underlay_rect); |
| 119 previous_frame_underlay_rect_ = this_frame_underlay_rect; | 123 previous_frame_underlay_rect_ = this_frame_underlay_rect; |
| 120 | 124 |
| 121 damage_rect->Union(output_surface_overlay_damage_rect); | 125 damage_rect->Union(output_surface_overlay_damage_rect); |
| 122 } | 126 } |
| 123 | 127 |
| 128 bool OverlayProcessor::IsResourcePromotable(ResourceId resource_id) { |
| 129 OverlayCandidateValidator* validator = |
| 130 surface_->GetOverlayCandidateValidator(); |
| 131 if (!validator) |
| 132 return false; |
| 133 |
| 134 return validator->IsResourcePromotable(resource_id); |
| 135 } |
| 136 |
| 124 } // namespace cc | 137 } // namespace cc |
| OLD | NEW |