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

Unified Diff: gpu/ipc/service/direct_composition_surface_win.cc

Issue 2888783002: Update scaling of video layers on every swap. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gpu/ipc/service/direct_composition_surface_win_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/ipc/service/direct_composition_surface_win.cc
diff --git a/gpu/ipc/service/direct_composition_surface_win.cc b/gpu/ipc/service/direct_composition_surface_win.cc
index 2bc0b0aaaf3383100d77f122d1d116074c05d3f4..e675fd9416167afb9515e980b59808b5ac8883f0 100644
--- a/gpu/ipc/service/direct_composition_surface_win.cc
+++ b/gpu/ipc/service/direct_composition_surface_win.cc
@@ -520,6 +520,36 @@ void DCLayerTree::SwapChainPresenter::PresentToSwapChain(
InitializeVideoProcessor(ceiled_input_size, swap_chain_size);
+ if (surface_->workarounds().disable_larger_than_screen_overlays) {
+ // Because of the rounding when converting between pixels and DIPs, a
+ // fullscreen video can become slightly larger than the monitor - e.g. on
+ // a 3000x2000 monitor with a scale factor of 1.75 a 1920x1079 video can
+ // become 3002x1689.
+ // On older Intel drivers, swapchains that are bigger than the monitor
+ // won't be put into overlays, which will hurt power usage a lot. On those
+ // systems, the scaling can be adjusted very slightly so that it's less
+ // than the monitor size. This should be close to imperceptible.
+ // TODO(jbauman): Remove when http://crbug.com/668278 is fixed.
+ const int kOversizeMargin = 3;
+
+ if ((bounds_rect.x() >= 0) &&
+ (bounds_rect.width() > g_overlay_monitor_size.width()) &&
+ (bounds_rect.width() <=
+ g_overlay_monitor_size.width() + kOversizeMargin)) {
+ bounds_rect.set_width(g_overlay_monitor_size.width());
+ }
+
+ if ((bounds_rect.y() >= 0) &&
+ (bounds_rect.height() > g_overlay_monitor_size.height()) &&
+ (bounds_rect.height() <=
+ g_overlay_monitor_size.height() + kOversizeMargin)) {
+ bounds_rect.set_height(g_overlay_monitor_size.height());
+ }
+ }
+
+ swap_chain_scale_x_ = bounds_rect.width() * 1.0f / swap_chain_size.width();
+ swap_chain_scale_y_ = bounds_rect.height() * 1.0f / swap_chain_size.height();
+
bool yuy2_swapchain = ShouldBeYUY2();
bool first_present = false;
if (!swap_chain_ || swap_chain_size_ != swap_chain_size ||
@@ -640,36 +670,6 @@ void DCLayerTree::SwapChainPresenter::PresentToSwapChain(
CHECK(SUCCEEDED(hr));
}
- if (surface_->workarounds().disable_larger_than_screen_overlays) {
- // Because of the rounding when converting between pixels and DIPs, a
- // fullscreen video can become slightly larger than the monitor - e.g. on
- // a 3000x2000 monitor with a scale factor of 1.75 a 1920x1079 video can
- // become 3002x1689.
- // On older Intel drivers, swapchains that are bigger than the monitor
- // won't be put into overlays, which will hurt power usage a lot. On those
- // systems, the scaling can be adjusted very slightly so that it's less
- // than the monitor size. This should be close to imperceptible.
- // TODO(jbauman): Remove when http://crbug.com/668278 is fixed.
- const int kOversizeMargin = 3;
-
- if ((bounds_rect.x() >= 0) &&
- (bounds_rect.width() > g_overlay_monitor_size.width()) &&
- (bounds_rect.width() <=
- g_overlay_monitor_size.width() + kOversizeMargin)) {
- bounds_rect.set_width(g_overlay_monitor_size.width());
- }
-
- if ((bounds_rect.y() >= 0) &&
- (bounds_rect.height() > g_overlay_monitor_size.height()) &&
- (bounds_rect.height() <=
- g_overlay_monitor_size.height() + kOversizeMargin)) {
- bounds_rect.set_height(g_overlay_monitor_size.height());
- }
- }
-
- swap_chain_scale_x_ = bounds_rect.width() * 1.0f / swap_chain_size.width();
- swap_chain_scale_y_ = bounds_rect.height() * 1.0f / swap_chain_size.height();
-
if (first_present) {
swap_chain_->Present(0, 0);
« no previous file with comments | « no previous file | gpu/ipc/service/direct_composition_surface_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698