Chromium Code Reviews| Index: ui/display/chromeos/x11/native_display_delegate_x11.cc |
| diff --git a/ui/display/chromeos/x11/native_display_delegate_x11.cc b/ui/display/chromeos/x11/native_display_delegate_x11.cc |
| index 3dff81bb31a6c4cf340b1cdbf9c5d27c52f9a3df..238d65e3122cb2e3b827e397be3d9cd5b4c897f3 100644 |
| --- a/ui/display/chromeos/x11/native_display_delegate_x11.cc |
| +++ b/ui/display/chromeos/x11/native_display_delegate_x11.cc |
| @@ -297,7 +297,7 @@ void NativeDisplayDelegateX11::CreateFrameBuffer(const gfx::Size& size) { |
| if (size.width() == current_width && size.height() == current_height) |
| return; |
| - DestroyUnusedCrtcs(); |
| + DestroyUnusedCrtcs(size); |
| int mm_width = size.width() * kPixelsToMmScale; |
| int mm_height = size.height() * kPixelsToMmScale; |
| XRRSetScreenSize( |
| @@ -518,7 +518,7 @@ bool NativeDisplayDelegateX11::SetHDCPState(const DisplaySnapshot& output, |
| } |
| } |
| -void NativeDisplayDelegateX11::DestroyUnusedCrtcs() { |
| +void NativeDisplayDelegateX11::DestroyUnusedCrtcs(const gfx::Size& new_size) { |
| CHECK(screen_) << "Server not grabbed"; |
| // Setting the screen size will fail if any CRTC doesn't fit afterwards. |
| // At the same time, turning CRTCs off and back on uses up a lot of time. |
| @@ -551,12 +551,15 @@ void NativeDisplayDelegateX11::DestroyUnusedCrtcs() { |
| if (mode_info) { |
| mode = static_cast<const DisplayModeX11*>(mode_info)->mode_id(); |
| - // In case our CRTC doesn't fit in our current framebuffer, disable it. |
| + // In case our CRTC doesn't fit in common area of our current and about |
| + // to be resized framebuffer, disable it. |
| // It'll get reenabled after we resize the framebuffer. |
| - int current_width = DisplayWidth(display_, DefaultScreen(display_)); |
| - int current_height = DisplayHeight(display_, DefaultScreen(display_)); |
| - if (mode_info->size().width() > current_width || |
| - mode_info->size().height() > current_height) { |
| + int max_width = std::min(DisplayWidth(display_, |
| + DefaultScreen(display_)), new_size.width()); |
|
Daniel Kurtz
2014/04/25 04:35:29
I think this would have been easier to read:
int
|
| + int max_height = std::min(DisplayHeight(display_, |
| + DefaultScreen(display_)), new_size.height()); |
| + if (mode_info->size().width() > max_width || |
| + mode_info->size().height() > max_height) { |
| mode = None; |
| output = None; |
| mode_info = NULL; |