Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: cc/output/overlay_processor.cc

Issue 2845193003: cc: Don't subtract transparent overlay from damage. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/output/overlay_candidate.cc ('k') | cc/output/overlay_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 for (const auto& strategy : strategies_) { 153 for (const auto& strategy : strategies_) {
154 if (!strategy->Attempt(resource_provider, render_pass, candidates, 154 if (!strategy->Attempt(resource_provider, render_pass, candidates,
155 content_bounds)) 155 content_bounds))
156 continue; 156 continue;
157 157
158 UpdateDamageRect(candidates, damage_rect); 158 UpdateDamageRect(candidates, damage_rect);
159 return; 159 return;
160 } 160 }
161 } 161 }
162 162
163 // Subtract on-top overlays from the damage rect, unless the overlays use 163 // Subtract on-top opaque overlays from the damage rect, unless the overlays use
164 // the backbuffer as their content (in which case, add their combined rect 164 // the backbuffer as their content (in which case, add their combined rect
165 // back to the damage at the end). 165 // back to the damage at the end).
166 // Also subtract unoccluded underlays from the damage rect if we know that the 166 // Also subtract unoccluded underlays from the damage rect if we know that the
167 // same underlay was scheduled on the previous frame. If the renderer decides 167 // same underlay was scheduled on the previous frame. If the renderer decides
168 // not to swap the framebuffer there will still be a transparent hole in the 168 // not to swap the framebuffer there will still be a transparent hole in the
169 // previous frame. This only handles the common case of a single underlay quad 169 // previous frame. This only handles the common case of a single underlay quad
170 // for fullscreen video. 170 // for fullscreen video.
171 void OverlayProcessor::UpdateDamageRect(OverlayCandidateList* candidates, 171 void OverlayProcessor::UpdateDamageRect(OverlayCandidateList* candidates,
172 gfx::Rect* damage_rect) { 172 gfx::Rect* damage_rect) {
173 gfx::Rect output_surface_overlay_damage_rect; 173 gfx::Rect output_surface_overlay_damage_rect;
174 gfx::Rect this_frame_underlay_rect; 174 gfx::Rect this_frame_underlay_rect;
175 for (const OverlayCandidate& overlay : *candidates) { 175 for (const OverlayCandidate& overlay : *candidates) {
176 if (overlay.plane_z_order > 0) { 176 if (overlay.plane_z_order > 0 && overlay.is_opaque) {
177 const gfx::Rect overlay_display_rect = 177 const gfx::Rect overlay_display_rect =
178 ToEnclosedRect(overlay.display_rect); 178 ToEnclosedRect(overlay.display_rect);
179 overlay_damage_rect_.Union(overlay_display_rect); 179 overlay_damage_rect_.Union(overlay_display_rect);
180 damage_rect->Subtract(overlay_display_rect); 180 damage_rect->Subtract(overlay_display_rect);
181 if (overlay.use_output_surface_for_resource) 181 if (overlay.use_output_surface_for_resource)
182 output_surface_overlay_damage_rect.Union(overlay_display_rect); 182 output_surface_overlay_damage_rect.Union(overlay_display_rect);
183 } else if (overlay.plane_z_order < 0 && overlay.is_unoccluded && 183 } else if (overlay.plane_z_order < 0 && overlay.is_unoccluded &&
184 this_frame_underlay_rect.IsEmpty()) { 184 this_frame_underlay_rect.IsEmpty()) {
185 this_frame_underlay_rect = ToEnclosedRect(overlay.display_rect); 185 this_frame_underlay_rect = ToEnclosedRect(overlay.display_rect);
186 } 186 }
187 } 187 }
188 188
189 if (this_frame_underlay_rect == previous_frame_underlay_rect_) 189 if (this_frame_underlay_rect == previous_frame_underlay_rect_)
190 damage_rect->Subtract(this_frame_underlay_rect); 190 damage_rect->Subtract(this_frame_underlay_rect);
191 previous_frame_underlay_rect_ = this_frame_underlay_rect; 191 previous_frame_underlay_rect_ = this_frame_underlay_rect;
192 192
193 damage_rect->Union(output_surface_overlay_damage_rect); 193 damage_rect->Union(output_surface_overlay_damage_rect);
194 } 194 }
195 195
196 } // namespace cc 196 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/overlay_candidate.cc ('k') | cc/output/overlay_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698