| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ozone/platform/egltest/ozone_platform_egltest.h" | 5 #include "ui/ozone/platform/egltest/ozone_platform_egltest.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/environment.h" | 9 #include "base/environment.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 if (env->GetVar(kEglplatformShim, &library)) | 49 if (env->GetVar(kEglplatformShim, &library)) |
| 50 return library; | 50 return library; |
| 51 return kEglplatformShimDefault; | 51 return kEglplatformShimDefault; |
| 52 } | 52 } |
| 53 | 53 |
| 54 // Touch events are reported in device coordinates. This scales the event to the | 54 // Touch events are reported in device coordinates. This scales the event to the |
| 55 // window's coordinate space. | 55 // window's coordinate space. |
| 56 void ScaleTouchEvent(TouchEvent* event, const gfx::SizeF& size) { | 56 void ScaleTouchEvent(TouchEvent* event, const gfx::SizeF& size) { |
| 57 for (const auto& device : | 57 for (const auto& device : |
| 58 DeviceDataManager::GetInstance()->touchscreen_devices()) { | 58 DeviceDataManager::GetInstance()->touchscreen_devices()) { |
| 59 if (device.id == static_cast<unsigned int>(event->source_device_id())) { | 59 if (device.id == event->source_device_id()) { |
| 60 gfx::SizeF touchscreen_size = device.size; | 60 gfx::SizeF touchscreen_size = device.size; |
| 61 gfx::PointF location = event->location_f(); | 61 gfx::PointF location = event->location_f(); |
| 62 | 62 |
| 63 location.Scale(size.width() / touchscreen_size.width(), | 63 location.Scale(size.width() / touchscreen_size.width(), |
| 64 size.height() / touchscreen_size.height()); | 64 size.height() / touchscreen_size.height()); |
| 65 double ratio = std::sqrt(size.GetArea() / touchscreen_size.GetArea()); | 65 double ratio = std::sqrt(size.GetArea() / touchscreen_size.GetArea()); |
| 66 | 66 |
| 67 event->set_location(location); | 67 event->set_location(location); |
| 68 event->set_radius_x(event->radius_x() * ratio); | 68 event->set_radius_x(event->radius_x() * ratio); |
| 69 event->set_radius_y(event->radius_y() * ratio); | 69 event->set_radius_y(event->radius_y() * ratio); |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 | 394 |
| 395 } // namespace | 395 } // namespace |
| 396 | 396 |
| 397 OzonePlatform* CreateOzonePlatformEgltest() { | 397 OzonePlatform* CreateOzonePlatformEgltest() { |
| 398 OzonePlatformEgltest* platform = new OzonePlatformEgltest; | 398 OzonePlatformEgltest* platform = new OzonePlatformEgltest; |
| 399 platform->Initialize(); | 399 platform->Initialize(); |
| 400 return platform; | 400 return platform; |
| 401 } | 401 } |
| 402 | 402 |
| 403 } // namespace ui | 403 } // namespace ui |
| OLD | NEW |