| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/aura/test/test_screen.h" | 5 #include "ui/aura/test/test_screen.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ui/aura/env.h" | 8 #include "ui/aura/env.h" |
| 9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
| 10 #include "ui/aura/window_event_dispatcher.h" | 10 #include "ui/aura/window_event_dispatcher.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 109 |
| 110 gfx::Transform TestScreen::GetUIScaleTransform() const { | 110 gfx::Transform TestScreen::GetUIScaleTransform() const { |
| 111 gfx::Transform ui_scale; | 111 gfx::Transform ui_scale; |
| 112 ui_scale.Scale(1.0f / ui_scale_, 1.0f / ui_scale_); | 112 ui_scale.Scale(1.0f / ui_scale_, 1.0f / ui_scale_); |
| 113 return ui_scale; | 113 return ui_scale; |
| 114 } | 114 } |
| 115 | 115 |
| 116 void TestScreen::OnWindowBoundsChanged( | 116 void TestScreen::OnWindowBoundsChanged( |
| 117 Window* window, const gfx::Rect& old_bounds, const gfx::Rect& new_bounds) { | 117 Window* window, const gfx::Rect& old_bounds, const gfx::Rect& new_bounds) { |
| 118 DCHECK_EQ(host_->window(), window); | 118 DCHECK_EQ(host_->window(), window); |
| 119 display_.SetSize(gfx::ToFlooredSize( | 119 display_.SetSize(gfx::ScaleToFlooredSize(new_bounds.size(), |
| 120 gfx::ScaleSize(new_bounds.size(), display_.device_scale_factor()))); | 120 display_.device_scale_factor())); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void TestScreen::OnWindowDestroying(Window* window) { | 123 void TestScreen::OnWindowDestroying(Window* window) { |
| 124 if (host_->window() == window) | 124 if (host_->window() == window) |
| 125 host_ = NULL; | 125 host_ = NULL; |
| 126 } | 126 } |
| 127 | 127 |
| 128 gfx::Point TestScreen::GetCursorScreenPoint() { | 128 gfx::Point TestScreen::GetCursorScreenPoint() { |
| 129 return Env::GetInstance()->last_mouse_location(); | 129 return Env::GetInstance()->last_mouse_location(); |
| 130 } | 130 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 170 |
| 171 TestScreen::TestScreen(const gfx::Rect& screen_bounds) | 171 TestScreen::TestScreen(const gfx::Rect& screen_bounds) |
| 172 : host_(NULL), | 172 : host_(NULL), |
| 173 ui_scale_(1.0f) { | 173 ui_scale_(1.0f) { |
| 174 static int64 synthesized_display_id = 2000; | 174 static int64 synthesized_display_id = 2000; |
| 175 display_.set_id(synthesized_display_id++); | 175 display_.set_id(synthesized_display_id++); |
| 176 display_.SetScaleAndBounds(1.0f, screen_bounds); | 176 display_.SetScaleAndBounds(1.0f, screen_bounds); |
| 177 } | 177 } |
| 178 | 178 |
| 179 } // namespace aura | 179 } // namespace aura |
| OLD | NEW |