diff options
author | dnicoara <dnicoara@chromium.org> | 2014-10-10 08:01:28 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-10 15:01:46 +0000 |
commit | 28b5396f75570b021617b2f2c626a6116d322c7e (patch) | |
tree | 9f889be067bb21aba38e824c751d23246c5d8cc0 /ash/touch | |
parent | ef2725f7cb299cb4ea945c30e22d35285962d592 (diff) | |
download | chromium_src-28b5396f75570b021617b2f2c626a6116d322c7e.zip chromium_src-28b5396f75570b021617b2f2c626a6116d322c7e.tar.gz chromium_src-28b5396f75570b021617b2f2c626a6116d322c7e.tar.bz2 |
Preserve the native mode when parsing external display modes
If the native mode is interlaced it can be replaced by a non-interlaced
mode (which will not show as native).
BUG=none
Review URL: https://codereview.chromium.org/635403002
Cr-Commit-Position: refs/heads/master@{#299114}
Diffstat (limited to 'ash/touch')
-rw-r--r-- | ash/touch/touch_transformer_controller.cc | 37 |
1 files changed, 8 insertions, 29 deletions
diff --git a/ash/touch/touch_transformer_controller.cc b/ash/touch/touch_transformer_controller.cc index d05cc62..8ff8ad5 100644 --- a/ash/touch/touch_transformer_controller.cc +++ b/ash/touch/touch_transformer_controller.cc @@ -95,22 +95,11 @@ bool TouchTransformerController::ShouldComputeMirrorModeTouchTransformer( if (touch_display.touch_device_id() == 0) return false; - DisplayManager* display_manager = Shell::GetInstance()->display_manager(); - const std::vector<gfx::Display>& displays = display_manager->displays(); - const DisplayInfo* info = NULL; - for (size_t i = 0; i < displays.size(); i++) { - const DisplayInfo& current_info = - display_manager->GetDisplayInfo(displays[i].id()); - if (current_info.touch_device_id() == touch_display.touch_device_id()) { - info = ¤t_info; - break; - } - } - - if (!info || info->size_in_pixel() == info->GetNativeModeSize() || - !info->is_aspect_preserving_scaling()) { + if (touch_display.size_in_pixel() == touch_display.GetNativeModeSize() || + !touch_display.is_aspect_preserving_scaling()) { return false; } + return true; } @@ -129,26 +118,16 @@ gfx::Transform TouchTransformerController::GetMirrorModeTouchTransformer( float mirror_width = touch_display.bounds_in_native().width(); float mirror_height = touch_display.bounds_in_native().height(); - float native_width = 0; - float native_height = 0; - - std::vector<DisplayMode> modes = touch_display.display_modes(); - for (size_t i = 0; i < modes.size(); i++) { - if (modes[i].native) { - native_width = modes[i].size.width(); - native_height = modes[i].size.height(); - break; - } - } + gfx::Size native_mode_size = touch_display.GetNativeModeSize(); + float native_width = native_mode_size.width(); + float native_height = native_mode_size.height(); if (native_height == 0.0 || mirror_height == 0.0 || native_width == 0.0 || mirror_width == 0.0) return ctm; - float native_ar = static_cast<float>(native_width) / - static_cast<float>(native_height); - float mirror_ar = static_cast<float>(mirror_width) / - static_cast<float>(mirror_height); + float native_ar = native_width / native_height; + float mirror_ar = mirror_width / mirror_height; if (mirror_ar > native_ar) { // Letterboxing // Translate before scale. |