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

Unified Diff: ui/events/device_data_manager.cc

Issue 412553005: Scale touch event radius (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comment Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/events/device_data_manager.h ('k') | ui/events/x/device_data_manager_x11.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/device_data_manager.cc
diff --git a/ui/events/device_data_manager.cc b/ui/events/device_data_manager.cc
index e4b6e39a641eaf58558378e6b153d775c0afe2bc..e7eb1147c8b339b741a0b6838ab8e87d93106621 100644
--- a/ui/events/device_data_manager.cc
+++ b/ui/events/device_data_manager.cc
@@ -22,8 +22,10 @@ DeviceDataManager::DeviceDataManager() {
base::AtExitManager::RegisterTask(
base::Bind(&base::DeletePointer<DeviceDataManager>, this));
- for (int i = 0; i < kMaxDeviceNum; ++i)
+ for (int i = 0; i < kMaxDeviceNum; ++i) {
touch_device_to_display_map_[i] = gfx::Display::kInvalidDisplayID;
+ touch_radius_scale_map_[i] = 1.0;
+ }
}
DeviceDataManager::~DeviceDataManager() {
@@ -57,6 +59,7 @@ void DeviceDataManager::ClearTouchTransformerRecord() {
for (int i = 0; i < kMaxDeviceNum; i++) {
touch_device_transformer_map_[i] = gfx::Transform();
touch_device_to_display_map_[i] = gfx::Display::kInvalidDisplayID;
+ touch_radius_scale_map_[i] = 1.0;
}
}
@@ -74,6 +77,18 @@ void DeviceDataManager::UpdateTouchInfoForDisplay(
}
}
+void DeviceDataManager::UpdateTouchRadiusScale(int touch_device_id,
+ double scale) {
+ if (IsTouchDeviceIdValid(touch_device_id))
+ touch_radius_scale_map_[touch_device_id] = scale;
+}
+
+void DeviceDataManager::ApplyTouchRadiusScale(int touch_device_id,
+ double* radius) {
+ if (IsTouchDeviceIdValid(touch_device_id))
+ *radius = (*radius) * touch_radius_scale_map_[touch_device_id];
+}
+
void DeviceDataManager::ApplyTouchTransformer(int touch_device_id,
float* x,
float* y) {
« no previous file with comments | « ui/events/device_data_manager.h ('k') | ui/events/x/device_data_manager_x11.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698