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

Unified Diff: ui/events/ozone/evdev/touch_event_converter_evdev.cc

Issue 131373007: ozone: Use gfx::Display size for touch scaling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test crash Created 6 years, 10 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 | « no previous file | ui/gfx/ozone/surface_factory_ozone.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/ozone/evdev/touch_event_converter_evdev.cc
diff --git a/ui/events/ozone/evdev/touch_event_converter_evdev.cc b/ui/events/ozone/evdev/touch_event_converter_evdev.cc
index 0bfe0b79c84a82e3ac1aa9cf72e00238afc31480..46eda1bf6e5e6730a39f6f0c47fd4343e07f4c70 100644
--- a/ui/events/ozone/evdev/touch_event_converter_evdev.cc
+++ b/ui/events/ozone/evdev/touch_event_converter_evdev.cc
@@ -21,7 +21,7 @@
#include "ui/events/event.h"
#include "ui/events/event_constants.h"
#include "ui/events/ozone/event_factory_ozone.h"
-#include "ui/gfx/ozone/surface_factory_ozone.h"
+#include "ui/gfx/screen.h"
namespace {
@@ -56,23 +56,15 @@ TouchEventConverterEvdev::~TouchEventConverterEvdev() {
}
void TouchEventConverterEvdev::Init() {
- if (x_max_ && y_max_ && gfx::SurfaceFactoryOzone::GetInstance()) {
- const char* display =
- gfx::SurfaceFactoryOzone::GetInstance()->DefaultDisplaySpec();
- int screen_width, screen_height;
- int sc = sscanf(display, "%dx%d", &screen_width, &screen_height);
- if (sc == 2) {
- x_scale_ = (double)screen_width / (x_max_ - x_min_);
- y_scale_ = (double)screen_height / (y_max_ - y_min_);
- x_max_ = screen_width - 1;
- y_max_ = screen_height - 1;
- VLOG(1) << "touch input x_scale=" << x_scale_
- << " y_scale=" << y_scale_;
- } else {
- LOG(WARNING) << "malformed display spec from "
- << "SurfaceFactoryOzone::DefaultDisplaySpec";
- }
- }
+ gfx::Screen *screen = gfx::Screen::GetScreenByType(gfx::SCREEN_TYPE_NATIVE);
+ if (!screen)
+ return; // No scaling.
+ gfx::Display display = screen->GetPrimaryDisplay();
+ gfx::Size size = display.GetSizeInPixel();
+
+ x_scale_ = (double)size.width() / (x_max_ - x_min_);
+ y_scale_ = (double)size.height() / (y_max_ - y_min_);
+ VLOG(1) << "touch scaling x_scale=" << x_scale_ << " y_scale=" << y_scale_;
}
void TouchEventConverterEvdev::Start() {
« no previous file with comments | « no previous file | ui/gfx/ozone/surface_factory_ozone.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698