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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 for (const auto& strategy : strategies_) { | 156 for (const auto& strategy : strategies_) { |
157 if (!strategy->Attempt(resource_provider, render_pass, candidates, | 157 if (!strategy->Attempt(resource_provider, render_pass, candidates, |
158 content_bounds)) | 158 content_bounds)) |
159 continue; | 159 continue; |
160 | 160 |
161 UpdateDamageRect(candidates, damage_rect); | 161 UpdateDamageRect(candidates, damage_rect); |
162 return; | 162 return; |
163 } | 163 } |
164 } | 164 } |
165 | 165 |
166 // Subtract on-top overlays from the damage rect, unless the overlays use | 166 // Subtract on-top opaque overlays from the damage rect, unless the overlays use |
167 // the backbuffer as their content (in which case, add their combined rect | 167 // the backbuffer as their content (in which case, add their combined rect |
168 // back to the damage at the end). | 168 // back to the damage at the end). |
169 // Also subtract unoccluded underlays from the damage rect if we know that the | 169 // Also subtract unoccluded underlays from the damage rect if we know that the |
170 // same underlay was scheduled on the previous frame. If the renderer decides | 170 // same underlay was scheduled on the previous frame. If the renderer decides |
171 // not to swap the framebuffer there will still be a transparent hole in the | 171 // not to swap the framebuffer there will still be a transparent hole in the |
172 // previous frame. This only handles the common case of a single underlay quad | 172 // previous frame. This only handles the common case of a single underlay quad |
173 // for fullscreen video. | 173 // for fullscreen video. |
174 void OverlayProcessor::UpdateDamageRect(OverlayCandidateList* candidates, | 174 void OverlayProcessor::UpdateDamageRect(OverlayCandidateList* candidates, |
175 gfx::Rect* damage_rect) { | 175 gfx::Rect* damage_rect) { |
176 gfx::Rect output_surface_overlay_damage_rect; | 176 gfx::Rect output_surface_overlay_damage_rect; |
177 gfx::Rect this_frame_underlay_rect; | 177 gfx::Rect this_frame_underlay_rect; |
178 for (const OverlayCandidate& overlay : *candidates) { | 178 for (const OverlayCandidate& overlay : *candidates) { |
179 if (overlay.plane_z_order > 0) { | 179 if (overlay.plane_z_order > 0 && overlay.is_opaque) { |
180 const gfx::Rect overlay_display_rect = | 180 const gfx::Rect overlay_display_rect = |
181 ToEnclosedRect(overlay.display_rect); | 181 ToEnclosedRect(overlay.display_rect); |
182 overlay_damage_rect_.Union(overlay_display_rect); | 182 overlay_damage_rect_.Union(overlay_display_rect); |
183 damage_rect->Subtract(overlay_display_rect); | 183 damage_rect->Subtract(overlay_display_rect); |
184 if (overlay.use_output_surface_for_resource) | 184 if (overlay.use_output_surface_for_resource) |
185 output_surface_overlay_damage_rect.Union(overlay_display_rect); | 185 output_surface_overlay_damage_rect.Union(overlay_display_rect); |
186 } else if (overlay.plane_z_order < 0 && overlay.is_unoccluded && | 186 } else if (overlay.plane_z_order < 0 && overlay.is_unoccluded && |
187 this_frame_underlay_rect.IsEmpty()) { | 187 this_frame_underlay_rect.IsEmpty()) { |
188 this_frame_underlay_rect = ToEnclosedRect(overlay.display_rect); | 188 this_frame_underlay_rect = ToEnclosedRect(overlay.display_rect); |
189 } | 189 } |
190 } | 190 } |
191 | 191 |
192 if (this_frame_underlay_rect == previous_frame_underlay_rect_) | 192 if (this_frame_underlay_rect == previous_frame_underlay_rect_) |
193 damage_rect->Subtract(this_frame_underlay_rect); | 193 damage_rect->Subtract(this_frame_underlay_rect); |
194 previous_frame_underlay_rect_ = this_frame_underlay_rect; | 194 previous_frame_underlay_rect_ = this_frame_underlay_rect; |
195 | 195 |
196 damage_rect->Union(output_surface_overlay_damage_rect); | 196 damage_rect->Union(output_surface_overlay_damage_rect); |
197 } | 197 } |
198 | 198 |
199 } // namespace cc | 199 } // namespace cc |
OLD | NEW |