Index: cc/output/overlay_processor.cc |
diff --git a/cc/output/overlay_processor.cc b/cc/output/overlay_processor.cc |
index 73e0a59a9b88dca34157e8f3e96ed3b99baca49d..ba009874e91bb0661baa58794e83bd4b22585aa2 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 |
+ // invoked. |
+ const gfx::Rect previous_frame_underlay_rect = previous_frame_underlay_rect_; |
+ 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; |