Chromium Code Reviews| Index: components/exo/pointer.cc |
| diff --git a/components/exo/pointer.cc b/components/exo/pointer.cc |
| index 5d2b915e85b8e37c13916cec856420c72b182329..6e7b55f2f62a10175565c3408db886856f0b189c 100644 |
| --- a/components/exo/pointer.cc |
| +++ b/components/exo/pointer.cc |
| @@ -4,8 +4,8 @@ |
| #include "components/exo/pointer.h" |
| -#include <algorithm> |
| #include <numeric> |
| +#include <tuple> |
| #include <utility> |
| #include "ash/public/cpp/shell_window_ids.h" |
| @@ -272,12 +272,16 @@ void Pointer::OnDisplayConfigurationChanged() { |
| UpdatePointerSurface(surface_); |
| const auto& displays = display::Screen::GetScreen()->GetAllDisplays(); |
| - capture_scale_ = std::accumulate( |
| - displays.begin(), displays.end(), 1.0f, |
| - [](float scale, const display::Display& display) -> float { |
| + using ScalePair = std::pair<float, float>; |
| + std::tie(capture_scale_, capture_ratio_) = std::accumulate( |
|
reveman
2017/06/19 22:20:39
heh, cool; but I think you've crossed the line to
Dominik Laskowski
2017/06/20 15:52:35
Yeah, even the original was pushing it. Done.
|
| + displays.begin(), displays.end(), ScalePair(1.0f, 1.0f), |
| + [](const ScalePair& pair, const display::Display& display) -> ScalePair { |
| const auto& info = |
| WMHelper::GetInstance()->GetDisplayInfo(display.id()); |
| - return std::max(scale, info.device_scale_factor()); |
| + return info.device_scale_factor() > pair.first |
| + ? ScalePair(info.device_scale_factor(), |
| + info.GetDensityRatio()) |
| + : pair; |
| }); |
| } |
| @@ -389,12 +393,12 @@ void Pointer::UpdateCursor() { |
| cursor_ = ui::CursorType::kNone; |
| } else { |
| SkBitmap bitmap = cursor_bitmap_; |
| - gfx::Point hotspot = gfx::ScaleToFlooredPoint(hotspot_, capture_scale_); |
| + gfx::Point hotspot = gfx::ScaleToFlooredPoint(hotspot_, capture_ratio_); |
| auto* helper = WMHelper::GetInstance(); |
| const display::Display& display = helper->GetCursorDisplay(); |
| - float scale = helper->GetDisplayInfo(display.id()).device_scale_factor() / |
| - capture_scale_; |
| + float scale = |
| + helper->GetDisplayInfo(display.id()).GetDensityRatio() / capture_ratio_; |
| if (helper->GetCursorSet() == ui::CURSOR_SET_LARGE) |
| scale *= kLargeCursorScale; |