diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/base/cursor/cursor_loader.h | 14 | ||||
-rw-r--r-- | ui/base/cursor/cursor_loader_ozone.cc | 2 | ||||
-rw-r--r-- | ui/base/cursor/cursor_loader_x11.cc | 11 | ||||
-rw-r--r-- | ui/views/widget/desktop_aura/desktop_native_cursor_manager.cc | 3 |
4 files changed, 17 insertions, 13 deletions
diff --git a/ui/base/cursor/cursor_loader.h b/ui/base/cursor/cursor_loader.h index 0e16237..8526e29 100644 --- a/ui/base/cursor/cursor_loader.h +++ b/ui/base/cursor/cursor_loader.h @@ -19,12 +19,14 @@ class UI_BASE_EXPORT CursorLoader { CursorLoader() : scale_(1.f) {} virtual ~CursorLoader() {} - gfx::Display::Rotation rotation() const { - return rotation_; + // Returns the display the loader loads images for. + const gfx::Display& display() const { + return display_; } - void set_rotation(gfx::Display::Rotation rotation) { - rotation_ = rotation; + // Sets the display the loader loads images for. + void set_display(const gfx::Display& display) { + display_ = display; } // Returns the current scale of the mouse cursor icon. @@ -62,8 +64,8 @@ class UI_BASE_EXPORT CursorLoader { static CursorLoader* Create(); private: - // The current rotation of the mouse cursor icon. - gfx::Display::Rotation rotation_; + // The display the loader loads images for. + gfx::Display display_; // The current scale of the mouse cursor icon. float scale_; diff --git a/ui/base/cursor/cursor_loader_ozone.cc b/ui/base/cursor/cursor_loader_ozone.cc index b56648f..19dddf5 100644 --- a/ui/base/cursor/cursor_loader_ozone.cc +++ b/ui/base/cursor/cursor_loader_ozone.cc @@ -21,7 +21,7 @@ void CursorLoaderOzone::LoadImageCursor(int id, const gfx::ImageSkia* image = ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id); const gfx::ImageSkiaRep& image_rep = - image->GetRepresentation(scale()); + image->GetRepresentation(display().device_scale_factor()); SkBitmap bitmap = image_rep.sk_bitmap(); cursors_[id] = CursorFactoryOzone::GetInstance()->CreateImageCursor(bitmap, hot); diff --git a/ui/base/cursor/cursor_loader_x11.cc b/ui/base/cursor/cursor_loader_x11.cc index 9c2f609..0161da2 100644 --- a/ui/base/cursor/cursor_loader_x11.cc +++ b/ui/base/cursor/cursor_loader_x11.cc @@ -159,11 +159,12 @@ void CursorLoaderX11::LoadImageCursor(int id, const gfx::Point& hot) { const gfx::ImageSkia* image = ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id); - const gfx::ImageSkiaRep& image_rep = image->GetRepresentation(scale()); + const gfx::ImageSkiaRep& image_rep = image->GetRepresentation( + display().device_scale_factor()); SkBitmap bitmap = image_rep.sk_bitmap(); gfx::Point hotpoint = hot; ScaleAndRotateCursorBitmapAndHotpoint( - scale(), rotation(), &bitmap, &hotpoint); + scale(), display().rotation(), &bitmap, &hotpoint); XcursorImage* x_image = SkBitmapToXcursorImage(&bitmap, hotpoint); cursors_[id] = CreateReffedCustomXCursor(x_image); @@ -176,7 +177,8 @@ void CursorLoaderX11::LoadAnimatedCursor(int id, int frame_delay_ms) { const gfx::ImageSkia* image = ResourceBundle::GetSharedInstance().GetImageSkiaNamed(resource_id); - const gfx::ImageSkiaRep& image_rep = image->GetRepresentation(scale()); + const gfx::ImageSkiaRep& image_rep = image->GetRepresentation( + display().device_scale_factor()); SkBitmap bitmap = image_rep.sk_bitmap(); int frame_width = bitmap.height(); int frame_height = frame_width; @@ -231,7 +233,8 @@ void CursorLoaderX11::SetPlatformCursor(gfx::NativeCursor* cursor) { xcursor = invisible_cursor_.get(); else if (*cursor == kCursorCustom) xcursor = cursor->platform(); - else if (scale() == 1.0f && rotation() == gfx::Display::ROTATE_0) { + else if (display().device_scale_factor() == 1.0f && + display().rotation() == gfx::Display::ROTATE_0) { xcursor = GetXCursor(CursorShapeFromNative(*cursor)); } else { xcursor = ImageCursorFromNative(kCursorPointer); diff --git a/ui/views/widget/desktop_aura/desktop_native_cursor_manager.cc b/ui/views/widget/desktop_aura/desktop_native_cursor_manager.cc index 187aa6e..ec898fb 100644 --- a/ui/views/widget/desktop_aura/desktop_native_cursor_manager.cc +++ b/ui/views/widget/desktop_aura/desktop_native_cursor_manager.cc @@ -40,8 +40,7 @@ void DesktopNativeCursorManager::SetDisplay( const gfx::Display& display, wm::NativeCursorManagerDelegate* delegate) { cursor_loader_->UnloadAll(); - cursor_loader_->set_rotation(display.rotation()); - cursor_loader_->set_scale(display.device_scale_factor()); + cursor_loader_->set_display(display); if (cursor_loader_updater_.get()) cursor_loader_updater_->OnDisplayUpdated(display, cursor_loader_.get()); |