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

Unified Diff: ash/wm/ash_native_cursor_manager.cc

Issue 562003002: Use the resource scale factor for cursor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cros only Created 6 years, 3 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 | ash/wm/ash_native_cursor_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/ash_native_cursor_manager.cc
diff --git a/ash/wm/ash_native_cursor_manager.cc b/ash/wm/ash_native_cursor_manager.cc
index 91f1161cf3119212832bad4a42171fa5d14b20b1..ae7bcd4e60350bf8032919554ab89592ee549e97 100644
--- a/ash/wm/ash_native_cursor_manager.cc
+++ b/ash/wm/ash_native_cursor_manager.cc
@@ -13,6 +13,7 @@
#include "ui/aura/window_tree_host.h"
#include "ui/base/cursor/cursor.h"
#include "ui/base/cursor/image_cursors.h"
+#include "ui/base/layout.h"
namespace ash {
namespace {
@@ -75,9 +76,17 @@ void AshNativeCursorManager::SetDisplay(
DCHECK(display.is_valid());
// Use the platform's device scale factor instead of the display's, which
// might have been adjusted for the UI scale.
- const float scale_factor = Shell::GetInstance()->display_manager()->
+ const float original_scale = Shell::GetInstance()->display_manager()->
GetDisplayInfo(display.id()).device_scale_factor();
- if (image_cursors_->SetDisplay(display, scale_factor))
+#if defined(OS_CHROMEOS)
+ // And use the nearest resource scale factor.
+ const float cursor_scale = ui::GetScaleForScaleFactor(
+ ui::GetSupportedScaleFactor(original_scale));
+#else
+ // TODO(oshima): crbug.com/143619
+ const float cursor_scale = original_scale;
+#endif
+ if (image_cursors_->SetDisplay(display, cursor_scale))
SetCursor(delegate->GetCursor(), delegate);
#if defined(OS_CHROMEOS)
Shell::GetInstance()->display_controller()->cursor_window_controller()->
« no previous file with comments | « no previous file | ash/wm/ash_native_cursor_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698