| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/display/mirror_window_controller.h" | 5 #include "ash/display/mirror_window_controller.h" |
| 6 | 6 |
| 7 #if defined(USE_X11) | 7 #if defined(USE_X11) |
| 8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
| 9 | 9 |
| 10 // Xlib.h defines RootWindow. | 10 // Xlib.h defines RootWindow. |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 } | 120 } |
| 121 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE {} | 121 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE {} |
| 122 virtual void DidRecreateLayer(ui::Layer* old_layer, | 122 virtual void DidRecreateLayer(ui::Layer* old_layer, |
| 123 ui::Layer* new_layer) OVERRIDE {} | 123 ui::Layer* new_layer) OVERRIDE {} |
| 124 | 124 |
| 125 // Set the cursor image for the |display|'s scale factor. Note that | 125 // Set the cursor image for the |display|'s scale factor. Note that |
| 126 // mirror window's scale factor is always 1.0f, therefore we need to | 126 // mirror window's scale factor is always 1.0f, therefore we need to |
| 127 // take 2x's image and paint as if it's 1x image. | 127 // take 2x's image and paint as if it's 1x image. |
| 128 void SetCursorImage(const gfx::ImageSkia& image, | 128 void SetCursorImage(const gfx::ImageSkia& image, |
| 129 const gfx::Display& display) { | 129 const gfx::Display& display) { |
| 130 device_scale_factor_ = | |
| 131 ui::GetScaleFactorFromScale(display.device_scale_factor()); | |
| 132 const gfx::ImageSkiaRep& image_rep = | 130 const gfx::ImageSkiaRep& image_rep = |
| 133 image.GetRepresentation(device_scale_factor_); | 131 image.GetRepresentation(display.device_scale_factor()); |
| 134 size_ = image_rep.pixel_size(); | 132 size_ = image_rep.pixel_size(); |
| 135 cursor_image_ = gfx::ImageSkia::CreateFrom1xBitmap(image_rep.sk_bitmap()); | 133 cursor_image_ = gfx::ImageSkia::CreateFrom1xBitmap(image_rep.sk_bitmap()); |
| 136 } | 134 } |
| 137 | 135 |
| 138 const gfx::Size size() const { return size_; } | 136 const gfx::Size size() const { return size_; } |
| 139 | 137 |
| 140 private: | 138 private: |
| 141 gfx::ImageSkia cursor_image_; | 139 gfx::ImageSkia cursor_image_; |
| 142 ui::ScaleFactor device_scale_factor_; | |
| 143 gfx::Size size_; | 140 gfx::Size size_; |
| 144 | 141 |
| 145 DISALLOW_COPY_AND_ASSIGN(CursorWindowDelegate); | 142 DISALLOW_COPY_AND_ASSIGN(CursorWindowDelegate); |
| 146 }; | 143 }; |
| 147 | 144 |
| 148 MirrorWindowController::MirrorWindowController() | 145 MirrorWindowController::MirrorWindowController() |
| 149 : current_cursor_type_(ui::kCursorNone), | 146 : current_cursor_type_(ui::kCursorNone), |
| 150 current_cursor_rotation_(gfx::Display::ROTATE_0), | 147 current_cursor_rotation_(gfx::Display::ROTATE_0), |
| 151 cursor_window_(NULL), | 148 cursor_window_(NULL), |
| 152 cursor_window_delegate_(new CursorWindowDelegate) { | 149 cursor_window_delegate_(new CursorWindowDelegate) { |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 Shell::GetScreen()->GetPrimaryDisplay().id()); | 333 Shell::GetScreen()->GetPrimaryDisplay().id()); |
| 337 DCHECK(display_manager->mirrored_display().is_valid()); | 334 DCHECK(display_manager->mirrored_display().is_valid()); |
| 338 return scoped_ptr<aura::RootWindowTransformer>( | 335 return scoped_ptr<aura::RootWindowTransformer>( |
| 339 internal::CreateRootWindowTransformerForMirroredDisplay( | 336 internal::CreateRootWindowTransformerForMirroredDisplay( |
| 340 source_display_info, | 337 source_display_info, |
| 341 mirror_display_info)); | 338 mirror_display_info)); |
| 342 } | 339 } |
| 343 | 340 |
| 344 } // namespace internal | 341 } // namespace internal |
| 345 } // namespace ash | 342 } // namespace ash |
| OLD | NEW |