Chromium Code Reviews| Index: cc/output/overlay_processor.cc |
| diff --git a/cc/output/overlay_processor.cc b/cc/output/overlay_processor.cc |
| index 73e0a59a9b88dca34157e8f3e96ed3b99baca49d..e99d594d615c3c5df0bfcbb4a0959319c0fa8f3f 100644 |
| --- a/cc/output/overlay_processor.cc |
| +++ b/cc/output/overlay_processor.cc |
| @@ -128,14 +128,16 @@ void OverlayProcessor::ProcessForOverlays( |
| SendPromotionHintsBeforeReturning notifier(resource_provider, candidates); |
| #endif |
| + // Reset |previous_frame_underlay_rect_| in case |UpdateDamageRect| not being |
|
danakj
2017/04/27 16:26:19
nit: I don't think |style| is used for functions,
AndyWu
2017/04/27 16:42:28
Done, thanks for the correction.
|
| + // invoked. |
| + const gfx::Rect previous_frame_underlay_rect = previous_frame_underlay_rect_; |
|
reveman
2017/04/27 16:15:09
nit: don't think we typically use "const" for loca
AndyWu
2017/04/27 16:33:33
Well, I prefer to use "const" here. It says that t
|
| + previous_frame_underlay_rect_ = gfx::Rect(); |
| + |
| // If we have any copy requests, we can't remove any quads for overlays or |
| // CALayers because the framebuffer would be missing the removed quads' |
| // contents. |
| if (!render_pass->copy_requests.empty()) { |
| dc_processor_.ClearOverlayState(); |
| - // If overlay processing was skipped for a frame there's no way to be sure |
| - // of the state of the previous frame, so reset. |
| - previous_frame_underlay_rect_ = gfx::Rect(); |
| return; |
| } |
| @@ -158,7 +160,7 @@ void OverlayProcessor::ProcessForOverlays( |
| content_bounds)) |
| continue; |
| - UpdateDamageRect(candidates, damage_rect); |
| + UpdateDamageRect(candidates, previous_frame_underlay_rect, damage_rect); |
| return; |
| } |
| } |
| @@ -171,8 +173,10 @@ void OverlayProcessor::ProcessForOverlays( |
| // not to swap the framebuffer there will still be a transparent hole in the |
| // previous frame. This only handles the common case of a single underlay quad |
| // for fullscreen video. |
| -void OverlayProcessor::UpdateDamageRect(OverlayCandidateList* candidates, |
| - gfx::Rect* damage_rect) { |
| +void OverlayProcessor::UpdateDamageRect( |
| + OverlayCandidateList* candidates, |
| + const gfx::Rect& previous_frame_underlay_rect, |
| + gfx::Rect* damage_rect) { |
| gfx::Rect output_surface_overlay_damage_rect; |
| gfx::Rect this_frame_underlay_rect; |
| for (const OverlayCandidate& overlay : *candidates) { |
| @@ -189,7 +193,7 @@ void OverlayProcessor::UpdateDamageRect(OverlayCandidateList* candidates, |
| } |
| } |
| - if (this_frame_underlay_rect == previous_frame_underlay_rect_) |
| + if (this_frame_underlay_rect == previous_frame_underlay_rect) |
| damage_rect->Subtract(this_frame_underlay_rect); |
| previous_frame_underlay_rect_ = this_frame_underlay_rect; |