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

Unified Diff: remoting/host/desktop_resizer_win.cc

Issue 12223124: When resizing-to-fit, prefer to match desktop rotation if possible. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698