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

Side by Side Diff: ash/display/mirror_window_controller.cc

Issue 24175004: Remove dependency on ui::ScaleFactor from ui/gfx (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 } 117 }
118 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE {} 118 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE {}
119 virtual void DidRecreateLayer(ui::Layer* old_layer, 119 virtual void DidRecreateLayer(ui::Layer* old_layer,
120 ui::Layer* new_layer) OVERRIDE {} 120 ui::Layer* new_layer) OVERRIDE {}
121 121
122 // Set the cursor image for the |display|'s scale factor. Note that 122 // Set the cursor image for the |display|'s scale factor. Note that
123 // mirror window's scale factor is always 1.0f, therefore we need to 123 // mirror window's scale factor is always 1.0f, therefore we need to
124 // take 2x's image and paint as if it's 1x image. 124 // take 2x's image and paint as if it's 1x image.
125 void SetCursorImage(const gfx::ImageSkia& image, 125 void SetCursorImage(const gfx::ImageSkia& image,
126 const gfx::Display& display) { 126 const gfx::Display& display) {
127 device_scale_factor_ =
128 ui::GetScaleFactorFromScale(display.device_scale_factor());
129 const gfx::ImageSkiaRep& image_rep = 127 const gfx::ImageSkiaRep& image_rep =
130 image.GetRepresentation(device_scale_factor_); 128 image.GetRepresentation(display.device_scale_factor());
131 size_ = image_rep.pixel_size(); 129 size_ = image_rep.pixel_size();
132 cursor_image_ = gfx::ImageSkia::CreateFrom1xBitmap(image_rep.sk_bitmap()); 130 cursor_image_ = gfx::ImageSkia::CreateFrom1xBitmap(image_rep.sk_bitmap());
133 } 131 }
134 132
135 const gfx::Size size() const { return size_; } 133 const gfx::Size size() const { return size_; }
136 134
137 private: 135 private:
138 gfx::ImageSkia cursor_image_; 136 gfx::ImageSkia cursor_image_;
139 ui::ScaleFactor device_scale_factor_;
140 gfx::Size size_; 137 gfx::Size size_;
141 138
142 DISALLOW_COPY_AND_ASSIGN(CursorWindowDelegate); 139 DISALLOW_COPY_AND_ASSIGN(CursorWindowDelegate);
143 }; 140 };
144 141
145 MirrorWindowController::MirrorWindowController() 142 MirrorWindowController::MirrorWindowController()
146 : current_cursor_type_(ui::kCursorNone), 143 : current_cursor_type_(ui::kCursorNone),
147 current_cursor_rotation_(gfx::Display::ROTATE_0), 144 current_cursor_rotation_(gfx::Display::ROTATE_0),
148 cursor_window_(NULL), 145 cursor_window_(NULL),
149 cursor_window_delegate_(new CursorWindowDelegate) { 146 cursor_window_delegate_(new CursorWindowDelegate) {
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 Shell::GetScreen()->GetPrimaryDisplay().id()); 330 Shell::GetScreen()->GetPrimaryDisplay().id());
334 DCHECK(display_manager->mirrored_display().is_valid()); 331 DCHECK(display_manager->mirrored_display().is_valid());
335 return scoped_ptr<aura::RootWindowTransformer>( 332 return scoped_ptr<aura::RootWindowTransformer>(
336 internal::CreateRootWindowTransformerForMirroredDisplay( 333 internal::CreateRootWindowTransformerForMirroredDisplay(
337 source_display_info, 334 source_display_info,
338 mirror_display_info)); 335 mirror_display_info));
339 } 336 }
340 337
341 } // namespace internal 338 } // namespace internal
342 } // namespace ash 339 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698