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

Side by Side Diff: ui/ozone/platform/egltest/ozone_platform_egltest.cc

Issue 1071193002: Change device IDs from unsigned to signed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more test fixes Created 5 years, 8 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
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698