Index: remoting/host/desktop_resizer_win.cc |
diff --git a/remoting/host/desktop_resizer_win.cc b/remoting/host/desktop_resizer_win.cc |
index fff0355dd64d22c75df4567af313f58b06241097..8f74cc03eb018d78f88da7348d7742d79eb9ed14 100644 |
--- a/remoting/host/desktop_resizer_win.cc |
+++ b/remoting/host/desktop_resizer_win.cc |
@@ -33,7 +33,7 @@ class DesktopResizerWin : public DesktopResizer { |
static bool IsResizeSupported(); |
// Calls EnumDisplaySettingsEx() for the primary monitor. |
- // Returns a DEVMODE with no fields if |mode_number| does not exist. |
+ // Returns false if |mode_number| does not exist. |
static bool GetPrimaryDisplayMode( |
DWORD mode_number, DWORD flags, DEVMODE* mode); |
@@ -91,14 +91,28 @@ std::list<SkISize> DesktopResizerWin::GetSupportedSizes( |
if (candidate_mode.dmBitsPerPel != current_mode.dmBitsPerPel) |
continue; |
- // If there is an existing mode of the same dimensions, prefer the |
- // one with the higher frequency. |
+ // If there is an existing mode of the same dimensions, choose the |
+ // closest match to the current mode. |
SkISize candidate_size = GetModeSize(candidate_mode); |
if (modes_.count(candidate_size) != 0) { |
DEVMODE existing_mode = modes_[candidate_size]; |
Jamie
2013/02/13 18:21:01
Would best_mode_for_size be a better name for this
Wez
2013/02/13 22:44:55
You mean modes_ -> best_mode_for_size_?
Jamie
2013/02/14 00:10:34
I meant best_mode_for_size instead of existing_mod
|
- if (existing_mode.dmDisplayFrequency > |
- candidate_mode.dmDisplayFrequency) |
+ |
+ // Skip this mode if its rotation is a worse match for the current mode. |
+ if ((candidate_mode.dmDisplayOrientation != |
+ current_mode.dmDisplayOrientation) && |
+ (existing_mode.dmDisplayOrientation == |
+ current_mode.dmDisplayOrientation)) { |
Jamie
2013/02/13 18:21:01
This will never pick a portrait mode if the physic
Wez
2013/02/13 22:44:55
No. This logic applies iff the mode we're enumera
Jamie
2013/02/14 00:10:34
Oh, I see. I had it in mind that the API returned
|
+ continue; |
+ } |
+ |
+ // Skip this mode if its frequency does not match, and the existing |
+ // choice has a higher frequency. |
+ if ((candidate_mode.dmDisplayFrequency != |
+ current_mode.dmDisplayFrequency) && |
+ (existing_mode.dmDisplayFrequency >= |
+ candidate_mode.dmDisplayFrequency)) { |
continue; |
+ } |
} else { |
// If we haven't seen this size before, add it to those we return. |
sizes.push_back(candidate_size); |