diff options
author | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-23 13:24:08 +0000 |
---|---|---|
committer | pfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-23 13:24:08 +0000 |
commit | db2f05dd09ab30b49356b01997501890c6e427ba (patch) | |
tree | 97f34b2d574039a60139539c2bcbeaa499157fcc /ash | |
parent | 0651dcf0c09e481b6aa3a5340b72ba30ecc58106 (diff) | |
download | chromium_src-db2f05dd09ab30b49356b01997501890c6e427ba.zip chromium_src-db2f05dd09ab30b49356b01997501890c6e427ba.tar.gz chromium_src-db2f05dd09ab30b49356b01997501890c6e427ba.tar.bz2 |
Revert of Use platform's device scale factor for cursor (https://codereview.chromium.org/226293005/)
Reason for revert:
There are no resize cursors in DevTools on Linux Aura anymore.
Original issue's description:
> Use platform's device scale factor for cursor instead of gfx::Display because gfx::Display's DSF may differ from
> platform's one when UI scaling is used.
>
> BUG=361672
> TEST=covered by unit test
>
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=265592
TBR=tdanderson@chromium.org,sky@chromium.org,oshima@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=361672
Review URL: https://codereview.chromium.org/249303002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@265625 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/display/display_controller_unittest.cc | 12 | ||||
-rw-r--r-- | ash/display/display_manager.cc | 2 | ||||
-rw-r--r-- | ash/display/mouse_cursor_event_filter_unittest.cc | 6 | ||||
-rw-r--r-- | ash/display/screen_ash.cc | 3 | ||||
-rw-r--r-- | ash/test/cursor_manager_test_api.cc | 11 | ||||
-rw-r--r-- | ash/test/cursor_manager_test_api.h | 8 | ||||
-rw-r--r-- | ash/wm/ash_native_cursor_manager.cc | 3 | ||||
-rw-r--r-- | ash/wm/ash_native_cursor_manager_interactive_uitest.cc | 4 | ||||
-rw-r--r-- | ash/wm/ash_native_cursor_manager_unittest.cc | 73 | ||||
-rw-r--r-- | ash/wm/drag_window_resizer_unittest.cc | 12 | ||||
-rw-r--r-- | ash/wm/image_cursors.cc | 54 | ||||
-rw-r--r-- | ash/wm/image_cursors.h | 15 |
12 files changed, 87 insertions, 116 deletions
diff --git a/ash/display/display_controller_unittest.cc b/ash/display/display_controller_unittest.cc index 95b7af6..3da1368 100644 --- a/ash/display/display_controller_unittest.cc +++ b/ash/display/display_controller_unittest.cc @@ -935,11 +935,11 @@ TEST_F(DisplayControllerTest, CursorDeviceScaleFactorSwapPrimary) { EXPECT_EQ(1.0f, primary_root->GetHost()->compositor()-> device_scale_factor()); primary_root->MoveCursorTo(gfx::Point(50, 50)); - EXPECT_EQ(1.0f, test_api.GetCurrentCursor().device_scale_factor()); + EXPECT_EQ(1.0f, test_api.GetDisplay().device_scale_factor()); EXPECT_EQ(2.0f, secondary_root->GetHost()->compositor()-> device_scale_factor()); secondary_root->MoveCursorTo(gfx::Point(50, 50)); - EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor()); + EXPECT_EQ(2.0f, test_api.GetDisplay().device_scale_factor()); // Switch primary and secondary display_controller->SetPrimaryDisplay(secondary_display); @@ -949,23 +949,23 @@ TEST_F(DisplayControllerTest, CursorDeviceScaleFactorSwapPrimary) { EXPECT_EQ(1.0f, secondary_root->GetHost()->compositor()-> device_scale_factor()); secondary_root->MoveCursorTo(gfx::Point(50, 50)); - EXPECT_EQ(1.0f, test_api.GetCurrentCursor().device_scale_factor()); + EXPECT_EQ(1.0f, test_api.GetDisplay().device_scale_factor()); primary_root->MoveCursorTo(gfx::Point(50, 50)); EXPECT_EQ(2.0f, primary_root->GetHost()->compositor()-> device_scale_factor()); - EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor()); + EXPECT_EQ(2.0f, test_api.GetDisplay().device_scale_factor()); // Deleting 2nd display. UpdateDisplay("200x200"); RunAllPendingInMessageLoop(); // RootWindow is deleted in a posted task. // Cursor's device scale factor should be updated even without moving cursor. - EXPECT_EQ(1.0f, test_api.GetCurrentCursor().device_scale_factor()); + EXPECT_EQ(1.0f, test_api.GetDisplay().device_scale_factor()); primary_root->MoveCursorTo(gfx::Point(50, 50)); EXPECT_EQ(1.0f, primary_root->GetHost()->compositor()-> device_scale_factor()); - EXPECT_EQ(1.0f, test_api.GetCurrentCursor().device_scale_factor()); + EXPECT_EQ(1.0f, test_api.GetDisplay().device_scale_factor()); } TEST_F(DisplayControllerTest, OverscanInsets) { diff --git a/ash/display/display_manager.cc b/ash/display/display_manager.cc index 7f6d713..83d747a 100644 --- a/ash/display/display_manager.cc +++ b/ash/display/display_manager.cc @@ -838,8 +838,6 @@ bool DisplayManager::IsMirrored() const { } const DisplayInfo& DisplayManager::GetDisplayInfo(int64 display_id) const { - DCHECK_NE(gfx::Display::kInvalidDisplayID, display_id); - std::map<int64, DisplayInfo>::const_iterator iter = display_info_.find(display_id); CHECK(iter != display_info_.end()) << display_id; diff --git a/ash/display/mouse_cursor_event_filter_unittest.cc b/ash/display/mouse_cursor_event_filter_unittest.cc index 3325d37..1b34456 100644 --- a/ash/display/mouse_cursor_event_filter_unittest.cc +++ b/ash/display/mouse_cursor_event_filter_unittest.cc @@ -368,11 +368,11 @@ TEST_F(MouseCursorEventFilterTest, CursorDeviceScaleFactor) { test::CursorManagerTestApi cursor_test_api( Shell::GetInstance()->cursor_manager()); - EXPECT_EQ(1.0f, cursor_test_api.GetCurrentCursor().device_scale_factor()); + EXPECT_EQ(1.0f, cursor_test_api.GetDisplay().device_scale_factor()); WarpMouseCursorIfNecessary(root_windows[0], gfx::Point(399, 200)); - EXPECT_EQ(2.0f, cursor_test_api.GetCurrentCursor().device_scale_factor()); + EXPECT_EQ(2.0f, cursor_test_api.GetDisplay().device_scale_factor()); WarpMouseCursorIfNecessary(root_windows[1], gfx::Point(400, 200)); - EXPECT_EQ(1.0f, cursor_test_api.GetCurrentCursor().device_scale_factor()); + EXPECT_EQ(1.0f, cursor_test_api.GetDisplay().device_scale_factor()); } } // namespace ash diff --git a/ash/display/screen_ash.cc b/ash/display/screen_ash.cc index 9d42e49e..d32deb8 100644 --- a/ash/display/screen_ash.cc +++ b/ash/display/screen_ash.cc @@ -234,8 +234,7 @@ gfx::Display ScreenAsh::GetDisplayNearestWindow(gfx::NativeView window) const { return GetPrimaryDisplay(); const RootWindowSettings* rws = GetRootWindowSettings(root_window); if (rws->shutdown) - return GetPrimaryDisplay(); - + return gfx::Display(1); int64 id = rws->display_id; // if id is |kInvaildDisplayID|, it's being deleted. DCHECK(id != gfx::Display::kInvalidDisplayID); diff --git a/ash/test/cursor_manager_test_api.cc b/ash/test/cursor_manager_test_api.cc index 4ff7cf7..22aa261 100644 --- a/ash/test/cursor_manager_test_api.cc +++ b/ash/test/cursor_manager_test_api.cc @@ -31,16 +31,9 @@ gfx::NativeCursor CursorManagerTestApi::GetCurrentCursor() const { return cursor_manager_->GetCursor(); } -gfx::Display::Rotation -CursorManagerTestApi::GetCurrentCursorRotation() const { +gfx::Display CursorManagerTestApi::GetDisplay() const { return ShellTestApi(Shell::GetInstance()).ash_native_cursor_manager()-> - image_cursors_->GetRotation(); -} - -float -CursorManagerTestApi::GetCurrentCursorScale() const { - return ShellTestApi(Shell::GetInstance()).ash_native_cursor_manager()-> - image_cursors_->GetScale(); + image_cursors_->GetDisplay(); } } // namespace test diff --git a/ash/test/cursor_manager_test_api.h b/ash/test/cursor_manager_test_api.h index fce98ca..1b9c6b8 100644 --- a/ash/test/cursor_manager_test_api.h +++ b/ash/test/cursor_manager_test_api.h @@ -7,9 +7,12 @@ #include "base/basictypes.h" #include "ui/base/cursor/cursor.h" -#include "ui/gfx/display.h" #include "ui/gfx/native_widget_types.h" +namespace gfx { +class Display; +} + namespace wm { class CursorManager; } @@ -25,8 +28,7 @@ class CursorManagerTestApi { ui::CursorSetType GetCurrentCursorSet() const; gfx::NativeCursor GetCurrentCursor() const; - gfx::Display::Rotation GetCurrentCursorRotation() const; - float GetCurrentCursorScale() const; + gfx::Display GetDisplay() const; private: ::wm::CursorManager* cursor_manager_; diff --git a/ash/wm/ash_native_cursor_manager.cc b/ash/wm/ash_native_cursor_manager.cc index e78eb94..98078ac 100644 --- a/ash/wm/ash_native_cursor_manager.cc +++ b/ash/wm/ash_native_cursor_manager.cc @@ -95,7 +95,8 @@ void AshNativeCursorManager::SetCursor( new_cursor.SetPlatformCursor(invisible_cursor.platform()); } } - new_cursor.set_device_scale_factor(image_cursors_->GetScale()); + new_cursor.set_device_scale_factor( + image_cursors_->GetDisplay().device_scale_factor()); delegate->CommitCursor(new_cursor); diff --git a/ash/wm/ash_native_cursor_manager_interactive_uitest.cc b/ash/wm/ash_native_cursor_manager_interactive_uitest.cc index 83df158..5eee024 100644 --- a/ash/wm/ash_native_cursor_manager_interactive_uitest.cc +++ b/ash/wm/ash_native_cursor_manager_interactive_uitest.cc @@ -102,10 +102,10 @@ TEST_F(AshNativeCursorManagerTest, MAYBE_CursorChangeOnEnterNotify) { display_manager->OnNativeDisplaysChanged(display_info_list); MoveMouseSync(Shell::GetAllRootWindows()[0], 10, 10); - EXPECT_EQ(1.0f, test_api.GetCurrentCursor().device_scale_factor()); + EXPECT_EQ(1.0f, test_api.GetDisplay().device_scale_factor()); MoveMouseSync(Shell::GetAllRootWindows()[0], 600, 10); - EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor()); + EXPECT_EQ(2.0f, test_api.GetDisplay().device_scale_factor()); } } // namespace ash diff --git a/ash/wm/ash_native_cursor_manager_unittest.cc b/ash/wm/ash_native_cursor_manager_unittest.cc index 5713fe3..812601f 100644 --- a/ash/wm/ash_native_cursor_manager_unittest.cc +++ b/ash/wm/ash_native_cursor_manager_unittest.cc @@ -4,8 +4,6 @@ #include "ash/wm/ash_native_cursor_manager.h" -#include "ash/display/display_info.h" -#include "ash/display/display_manager.h" #include "ash/shell.h" #include "ash/test/ash_test_base.h" #include "ash/test/cursor_manager_test_api.h" @@ -56,16 +54,18 @@ typedef test::AshTestBase AshNativeCursorManagerTest; TEST_F(AshNativeCursorManagerTest, LockCursor) { ::wm::CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager(); CursorManagerTestApi test_api(cursor_manager); - + gfx::Display display(0); #if defined(OS_WIN) ui::CursorLoaderWin::SetCursorResourceModule(L"ash_unittests.exe"); #endif cursor_manager->SetCursor(ui::kCursorCopy); EXPECT_EQ(ui::kCursorCopy, test_api.GetCurrentCursor().native_type()); - UpdateDisplay("800x800*2/r"); - EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor()); + display.set_device_scale_factor(2.0f); + display.set_rotation(gfx::Display::ROTATE_90); + cursor_manager->SetDisplay(display); + EXPECT_EQ(2.0f, test_api.GetDisplay().device_scale_factor()); EXPECT_EQ(ui::CURSOR_SET_NORMAL, test_api.GetCurrentCursorSet()); - EXPECT_EQ(gfx::Display::ROTATE_90, test_api.GetCurrentCursorRotation()); + EXPECT_EQ(gfx::Display::ROTATE_90, test_api.GetDisplay().rotation()); EXPECT_TRUE(test_api.GetCurrentCursor().platform()); cursor_manager->LockCursor(); @@ -85,16 +85,18 @@ TEST_F(AshNativeCursorManagerTest, LockCursor) { EXPECT_EQ(ui::kCursorCopy, test_api.GetCurrentCursor().native_type()); // Device scale factor and rotation do change even while cursor is locked. - UpdateDisplay("800x800/u"); - EXPECT_EQ(1.0f, test_api.GetCurrentCursor().device_scale_factor()); - EXPECT_EQ(gfx::Display::ROTATE_180, test_api.GetCurrentCursorRotation()); + display.set_device_scale_factor(1.0f); + display.set_rotation(gfx::Display::ROTATE_180); + cursor_manager->SetDisplay(display); + EXPECT_EQ(1.0f, test_api.GetDisplay().device_scale_factor()); + EXPECT_EQ(gfx::Display::ROTATE_180, test_api.GetDisplay().rotation()); cursor_manager->UnlockCursor(); EXPECT_FALSE(cursor_manager->IsCursorLocked()); // Cursor type changes to the one specified while cursor is locked. EXPECT_EQ(ui::kCursorPointer, test_api.GetCurrentCursor().native_type()); - EXPECT_EQ(1.0f, test_api.GetCurrentCursor().device_scale_factor()); + EXPECT_EQ(1.0f, test_api.GetDisplay().device_scale_factor()); EXPECT_TRUE(test_api.GetCurrentCursor().platform()); } @@ -131,47 +133,18 @@ TEST_F(AshNativeCursorManagerTest, SetCursorSet) { TEST_F(AshNativeCursorManagerTest, SetDeviceScaleFactorAndRotation) { ::wm::CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager(); CursorManagerTestApi test_api(cursor_manager); - UpdateDisplay("800x100*2"); - EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor()); - EXPECT_EQ(gfx::Display::ROTATE_0, test_api.GetCurrentCursorRotation()); - - UpdateDisplay("800x100/l"); - EXPECT_EQ(1.0f, test_api.GetCurrentCursor().device_scale_factor()); - EXPECT_EQ(gfx::Display::ROTATE_270, test_api.GetCurrentCursorRotation()); -} -TEST_F(AshNativeCursorManagerTest, UIScaleShouldNotChangeCursor) { - int64 display_id = Shell::GetScreen()->GetPrimaryDisplay().id(); - gfx::Display::SetInternalDisplayId(display_id); - - ::wm::CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager(); - CursorManagerTestApi test_api(cursor_manager); - DisplayManager* display_manager = Shell::GetInstance()->display_manager(); - - DisplayInfo::SetAllowUpgradeToHighDPI(false); - display_manager->SetDisplayUIScale(display_id, 0.5f); - EXPECT_EQ(1.0f, - Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); - EXPECT_EQ(1.0f, test_api.GetCurrentCursor().device_scale_factor()); - - display_manager->SetDisplayUIScale(display_id, 1.0f); - - DisplayInfo::SetAllowUpgradeToHighDPI(true); - // 1x display should keep using 1x cursor even if the DSF is upgraded to 2x. - display_manager->SetDisplayUIScale(display_id, 0.5f); - EXPECT_EQ(2.0f, - Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); - EXPECT_EQ(1.0f, test_api.GetCurrentCursor().device_scale_factor()); - - // 2x display should keep using 2x cursor regardless of the UI scale. - UpdateDisplay("800x800*2"); - EXPECT_EQ(2.0f, - Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); - EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor()); - display_manager->SetDisplayUIScale(display_id, 2.0f); - EXPECT_EQ(1.0f, - Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); - EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor()); + gfx::Display display(0); + display.set_device_scale_factor(2.0f); + cursor_manager->SetDisplay(display); + EXPECT_EQ(2.0f, test_api.GetDisplay().device_scale_factor()); + EXPECT_EQ(gfx::Display::ROTATE_0, test_api.GetDisplay().rotation()); + + display.set_device_scale_factor(1.0f); + display.set_rotation(gfx::Display::ROTATE_270); + cursor_manager->SetDisplay(display); + EXPECT_EQ(1.0f, test_api.GetDisplay().device_scale_factor()); + EXPECT_EQ(gfx::Display::ROTATE_270, test_api.GetDisplay().rotation()); } TEST_F(AshNativeCursorManagerTest, DisabledQueryMouseLocation) { diff --git a/ash/wm/drag_window_resizer_unittest.cc b/ash/wm/drag_window_resizer_unittest.cc index 369a285..dbb4da0 100644 --- a/ash/wm/drag_window_resizer_unittest.cc +++ b/ash/wm/drag_window_resizer_unittest.cc @@ -494,13 +494,13 @@ TEST_F(DragWindowResizerTest, CursorDeviceScaleFactor) { // Grab (0, 0) of the window. scoped_ptr<WindowResizer> resizer(CreateDragWindowResizer( window_.get(), gfx::Point(), HTCAPTION)); - EXPECT_EQ(1.0f, cursor_test_api.GetCurrentCursor().device_scale_factor()); + EXPECT_EQ(1.0f, cursor_test_api.GetDisplay().device_scale_factor()); ASSERT_TRUE(resizer.get()); resizer->Drag(CalculateDragPoint(*resizer, 399, 200), 0); WarpMouseCursorIfNecessary(root_windows[0], gfx::Point(399, 200)); - EXPECT_EQ(2.0f, cursor_test_api.GetCurrentCursor().device_scale_factor()); + EXPECT_EQ(2.0f, cursor_test_api.GetDisplay().device_scale_factor()); resizer->CompleteDrag(); - EXPECT_EQ(2.0f, cursor_test_api.GetCurrentCursor().device_scale_factor()); + EXPECT_EQ(2.0f, cursor_test_api.GetDisplay().device_scale_factor()); } // Move window from the root window with 2.0 device scale factor to the root @@ -518,13 +518,13 @@ TEST_F(DragWindowResizerTest, CursorDeviceScaleFactor) { // Grab (0, 0) of the window. scoped_ptr<WindowResizer> resizer(CreateDragWindowResizer( window_.get(), gfx::Point(), HTCAPTION)); - EXPECT_EQ(2.0f, cursor_test_api.GetCurrentCursor().device_scale_factor()); + EXPECT_EQ(2.0f, cursor_test_api.GetDisplay().device_scale_factor()); ASSERT_TRUE(resizer.get()); resizer->Drag(CalculateDragPoint(*resizer, -200, 200), 0); WarpMouseCursorIfNecessary(root_windows[1], gfx::Point(400, 200)); - EXPECT_EQ(1.0f, cursor_test_api.GetCurrentCursor().device_scale_factor()); + EXPECT_EQ(1.0f, cursor_test_api.GetDisplay().device_scale_factor()); resizer->CompleteDrag(); - EXPECT_EQ(1.0f, cursor_test_api.GetCurrentCursor().device_scale_factor()); + EXPECT_EQ(1.0f, cursor_test_api.GetDisplay().device_scale_factor()); } } diff --git a/ash/wm/image_cursors.cc b/ash/wm/image_cursors.cc index 2a41375..e63bece 100644 --- a/ash/wm/image_cursors.cc +++ b/ash/wm/image_cursors.cc @@ -6,9 +6,6 @@ #include <float.h> -#include "ash/display/display_info.h" -#include "ash/display/display_manager.h" -#include "ash/shell.h" #include "base/logging.h" #include "base/strings/string16.h" #include "ui/base/cursor/cursor.h" @@ -59,54 +56,41 @@ const int kAnimatedCursorIds[] = { ui::kCursorProgress }; -ImageCursors::ImageCursors() : cursor_set_(ui::CURSOR_SET_NORMAL) { +ImageCursors::ImageCursors() : scale_(1.f), cursor_set_(ui::CURSOR_SET_NORMAL) { } ImageCursors::~ImageCursors() { } -float ImageCursors::GetScale() const { +gfx::Display ImageCursors::GetDisplay() const { if (!cursor_loader_) { NOTREACHED(); // Returning default on release build as it's not serious enough to crash // even if this ever happens. - return 1.0f; + return gfx::Display(); } - return cursor_loader_->scale(); -} - -gfx::Display::Rotation ImageCursors::GetRotation() const { - if (!cursor_loader_) { - NOTREACHED(); - // Returning default on release build as it's not serious enough to crash - // even if this ever happens. - return gfx::Display::ROTATE_0; - } - return cursor_loader_->rotation(); + return cursor_loader_->display(); } bool ImageCursors::SetDisplay(const gfx::Display& display) { - DCHECK(display.is_valid()); - // Use the platform's device scale factor instead of display's - // that might have been adjusted for UI scale. - float scale_factor = Shell::GetInstance()->display_manager()-> - GetDisplayInfo(display.id()).device_scale_factor(); - + float device_scale_factor = display.device_scale_factor(); if (!cursor_loader_) { cursor_loader_.reset(ui::CursorLoader::Create()); - } else if (cursor_loader_->rotation() == display.rotation() && - cursor_loader_->scale() == scale_factor) { + cursor_loader_->set_scale(scale_); + } else if (cursor_loader_->display().rotation() == display.rotation() && + cursor_loader_->display().device_scale_factor() == + device_scale_factor) { return false; } - cursor_loader_->set_rotation(display.rotation()); - cursor_loader_->set_scale(scale_factor); + cursor_loader_->set_display(display); ReloadCursors(); return true; } void ImageCursors::ReloadCursors() { - float device_scale_factor = cursor_loader_->scale(); + const gfx::Display& display = cursor_loader_->display(); + float device_scale_factor = display.device_scale_factor(); cursor_loader_->UnloadAll(); @@ -137,6 +121,20 @@ void ImageCursors::ReloadCursors() { } } +void ImageCursors::SetScale(float scale) { + if (scale < FLT_EPSILON) { + NOTREACHED() << "Scale must be bigger than 0."; + scale = 1.0f; + } + + scale_ = scale; + + if (cursor_loader_.get()) { + cursor_loader_->set_scale(scale); + ReloadCursors(); + } +} + void ImageCursors::SetCursorSet(ui::CursorSetType cursor_set) { if (cursor_set_ == cursor_set) return; diff --git a/ash/wm/image_cursors.h b/ash/wm/image_cursors.h index 1a75f40..55bc34c 100644 --- a/ash/wm/image_cursors.h +++ b/ash/wm/image_cursors.h @@ -9,9 +9,12 @@ #include "base/memory/scoped_ptr.h" #include "base/strings/string16.h" #include "ui/base/cursor/cursor.h" -#include "ui/gfx/display.h" #include "ui/gfx/native_widget_types.h" +namespace gfx { +class Display; +} + namespace ui { class CursorLoader; } @@ -25,9 +28,9 @@ class ASH_EXPORT ImageCursors { ImageCursors(); ~ImageCursors(); - // Returns the scale and rotation of the currently loaded cursor. - float GetScale() const; - gfx::Display::Rotation GetRotation() const; + // Returns the display the cursors are loaded for. The display must + // be set by SetDisplay before using this. + gfx::Display GetDisplay() const; // Sets the display the cursors are loaded for. The device scale factor // determines the size of the image to load, and the rotation of the display @@ -35,6 +38,9 @@ class ASH_EXPORT ImageCursors { // Returns true if the cursor image is reloaded. bool SetDisplay(const gfx::Display& display); + // Sets the scale of the mouse cursor icon. + void SetScale(float scale); + // Sets the type of the mouse cursor icon. void SetCursorSet(ui::CursorSetType cursor_set); @@ -46,6 +52,7 @@ class ASH_EXPORT ImageCursors { void ReloadCursors(); scoped_ptr<ui::CursorLoader> cursor_loader_; + float scale_; ui::CursorSetType cursor_set_; DISALLOW_COPY_AND_ASSIGN(ImageCursors); |