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

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

Issue 2844483004: Reset the state of the previous frame if overlay processing is skipped. (Closed)
Patch Set: Created 3 years, 8 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 | « no previous file | no next file » | 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 // If overlay processing was skipped for a frame there's no way to be sure 136 // If overlay processing was skipped for a frame there's no way to be sure
137 // of the state of the previous frame, so reset. 137 // of the state of the previous frame, so reset.
138 previous_frame_underlay_rect_ = gfx::Rect(); 138 previous_frame_underlay_rect_ = gfx::Rect();
139 return; 139 return;
140 } 140 }
141 141
142 // First attempt to process for CALayers. 142 // First attempt to process for CALayers.
143 if (ProcessForCALayers(resource_provider, render_pass, render_pass_filters, 143 if (ProcessForCALayers(resource_provider, render_pass, render_pass_filters,
144 render_pass_background_filters, candidates, 144 render_pass_background_filters, candidates,
145 ca_layer_overlays, damage_rect)) { 145 ca_layer_overlays, damage_rect)) {
146 previous_frame_underlay_rect_ = gfx::Rect();
liberato (no reviews please) 2017/04/26 18:40:31 clearing it seems to be the default (and safe) act
watk 2017/04/26 19:20:04 +1
AndyWu 2017/04/26 20:40:53 Done, thanks for your suggestion.
146 return; 147 return;
147 } 148 }
148 149
149 if (ProcessForDCLayers(resource_provider, render_pass, render_pass_filters, 150 if (ProcessForDCLayers(resource_provider, render_pass, render_pass_filters,
150 render_pass_background_filters, candidates, 151 render_pass_background_filters, candidates,
151 dc_layer_overlays, damage_rect)) { 152 dc_layer_overlays, damage_rect)) {
153 previous_frame_underlay_rect_ = gfx::Rect();
152 return; 154 return;
153 } 155 }
154 156
155 // Only if that fails, attempt hardware overlay strategies. 157 // Only if that fails, attempt hardware overlay strategies.
156 for (const auto& strategy : strategies_) { 158 for (const auto& strategy : strategies_) {
157 if (!strategy->Attempt(resource_provider, render_pass, candidates, 159 if (!strategy->Attempt(resource_provider, render_pass, candidates,
158 content_bounds)) 160 content_bounds))
159 continue; 161 continue;
160 162
161 UpdateDamageRect(candidates, damage_rect); 163 UpdateDamageRect(candidates, damage_rect);
162 return; 164 return;
163 } 165 }
166
167 previous_frame_underlay_rect_ = gfx::Rect();
164 } 168 }
165 169
166 // Subtract on-top overlays from the damage rect, unless the overlays use 170 // Subtract on-top overlays from the damage rect, unless the overlays use
167 // the backbuffer as their content (in which case, add their combined rect 171 // the backbuffer as their content (in which case, add their combined rect
168 // back to the damage at the end). 172 // back to the damage at the end).
169 // Also subtract unoccluded underlays from the damage rect if we know that the 173 // 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 174 // 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 175 // 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 176 // previous frame. This only handles the common case of a single underlay quad
173 // for fullscreen video. 177 // for fullscreen video.
(...skipping 16 matching lines...) Expand all
190 } 194 }
191 195
192 if (this_frame_underlay_rect == previous_frame_underlay_rect_) 196 if (this_frame_underlay_rect == previous_frame_underlay_rect_)
193 damage_rect->Subtract(this_frame_underlay_rect); 197 damage_rect->Subtract(this_frame_underlay_rect);
194 previous_frame_underlay_rect_ = this_frame_underlay_rect; 198 previous_frame_underlay_rect_ = this_frame_underlay_rect;
195 199
196 damage_rect->Union(output_surface_overlay_damage_rect); 200 damage_rect->Union(output_surface_overlay_damage_rect);
197 } 201 }
198 202
199 } // namespace cc 203 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698