diff --git a/base/BlackberryDisplay.cpp b/base/BlackberryDisplay.cpp index 7d02f5d2bc..89001b200f 100644 --- a/base/BlackberryDisplay.cpp +++ b/base/BlackberryDisplay.cpp @@ -76,7 +76,7 @@ void BlackberryMain::startDisplays() { realiseDisplay(i); } screen_get_display_property_iv(screen_dpy[0], SCREEN_PROPERTY_DPI, &dpi); // Only internal display has DPI - dpi_scale = ((pixel_xres == pixel_yres) ? 300.0f : 213.6f) / dpi; + g_dpi_scale = ((pixel_xres == pixel_yres) ? 300.0f : 213.6f) / dpi; switchDisplay(screen_ui); } @@ -121,8 +121,8 @@ void BlackberryMain::switchDisplay(int idx) { if (idx != screen_curr) { pixel_xres = displays[idx].width; pixel_yres = displays[idx].height; - dp_xres = (int)(pixel_xres * dpi_scale); - dp_yres = (int)(pixel_yres * dpi_scale); + dp_xres = (int)(pixel_xres * g_dpi_scale); + dp_yres = (int)(pixel_yres * g_dpi_scale); screen_curr = idx; eglMakeCurrent(egl_disp[idx], egl_surf[idx], egl_surf[idx], egl_cont); } diff --git a/base/BlackberryMain.cpp b/base/BlackberryMain.cpp index 2caa26f8ef..6263fa3498 100644 --- a/base/BlackberryMain.cpp +++ b/base/BlackberryMain.cpp @@ -73,21 +73,21 @@ void BlackberryMain::handleInput(screen_event_t screen_event) case SCREEN_EVENT_MTOUCH_TOUCH: case SCREEN_EVENT_MTOUCH_RELEASE: // Up, down input_state.pointer_down[pointerId] = (val == SCREEN_EVENT_MTOUCH_TOUCH); - input_state.pointer_x[pointerId] = pair[0] * dpi_scale; - input_state.pointer_y[pointerId] = pair[1] * dpi_scale; + input_state.pointer_x[pointerId] = pair[0] * g_dpi_scale; + input_state.pointer_y[pointerId] = pair[1] * g_dpi_scale; - input.x = pair[0] * dpi_scale; - input.y = pair[1] * dpi_scale; + input.x = pair[0] * g_dpi_scale; + input.y = pair[1] * g_dpi_scale; input.flags = (val == SCREEN_EVENT_MTOUCH_TOUCH) ? TOUCH_DOWN : TOUCH_UP; input.id = pointerId; NativeTouch(input); break; case SCREEN_EVENT_MTOUCH_MOVE: - input_state.pointer_x[pointerId] = pair[0] * dpi_scale; - input_state.pointer_y[pointerId] = pair[1] * dpi_scale; + input_state.pointer_x[pointerId] = pair[0] * g_dpi_scale; + input_state.pointer_y[pointerId] = pair[1] * g_dpi_scale; - input.x = pair[0] * dpi_scale; - input.y = pair[1] * dpi_scale; + input.x = pair[0] * g_dpi_scale; + input.y = pair[1] * g_dpi_scale; input.flags = TOUCH_MOVE; input.id = pointerId; NativeTouch(input); @@ -97,22 +97,22 @@ void BlackberryMain::handleInput(screen_event_t screen_event) screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_BUTTONS, &buttons); if (buttons == SCREEN_LEFT_MOUSE_BUTTON) { // Down - input_state.pointer_x[pointerId] = pair[0] * dpi_scale; - input_state.pointer_y[pointerId] = pair[1] * dpi_scale; + input_state.pointer_x[pointerId] = pair[0] * g_dpi_scale; + input_state.pointer_y[pointerId] = pair[1] * g_dpi_scale; input_state.pointer_down[pointerId] = true; - input.x = pair[0] * dpi_scale; - input.y = pair[1] * dpi_scale; + input.x = pair[0] * g_dpi_scale; + input.y = pair[1] * g_dpi_scale; input.flags = TOUCH_DOWN; input.id = pointerId; NativeTouch(input); } else if (input_state.pointer_down[pointerId]) { // Up - input_state.pointer_x[pointerId] = pair[0] * dpi_scale; - input_state.pointer_y[pointerId] = pair[1] * dpi_scale; + input_state.pointer_x[pointerId] = pair[0] * g_dpi_scale; + input_state.pointer_y[pointerId] = pair[1] * g_dpi_scale; input_state.pointer_down[pointerId] = false; - input.x = pair[0] * dpi_scale; - input.y = pair[1] * dpi_scale; + input.x = pair[0] * g_dpi_scale; + input.y = pair[1] * g_dpi_scale; input.flags = TOUCH_UP; input.id = pointerId; NativeTouch(input); diff --git a/base/BlackberryMain.h b/base/BlackberryMain.h index 01b4750699..78eb164c8f 100644 --- a/base/BlackberryMain.h +++ b/base/BlackberryMain.h @@ -31,7 +31,7 @@ #include "base/NativeApp.h" #include "input/input_state.h" #include "net/resolve.h" -#include "display.h" +#include "base/display.h" #include "BlackberryAudio.h" @@ -76,7 +76,6 @@ private: BlackberryAudio* audio; dispdata_t *displays; int dpi; - float dpi_scale; int ndisplays; int screen_ui, screen_emu; bool emulating; diff --git a/base/QtMain.cpp b/base/QtMain.cpp index ee08a84bb6..b4175a80dc 100644 --- a/base/QtMain.cpp +++ b/base/QtMain.cpp @@ -78,8 +78,8 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) pixel_xres = res.width(); pixel_yres = res.height(); - float dpi_scale = CalculateDPIScale(); - dp_xres = (int)(pixel_xres * dpi_scale); dp_yres = (int)(pixel_yres * dpi_scale); + g_dpi_scale = CalculateDPIScale(); + dp_xres = (int)(pixel_xres * g_dpi_scale); dp_yres = (int)(pixel_yres * g_dpi_scale); net::Init(); #ifdef __SYMBIAN32__ char* savegame_dir = "E:/PPSSPP/"; @@ -100,7 +100,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) NativeInit(argc, (const char **)argv, savegame_dir, assets_dir, "BADCOFFEE"); #if !defined(Q_WS_X11) || defined(ARM) - MainUI w(dpi_scale); + MainUI w; w.resize(pixel_xres, pixel_yres); w.showFullScreen(); #endif diff --git a/base/QtMain.h b/base/QtMain.h index 894de3caf6..74ea9da4df 100644 --- a/base/QtMain.h +++ b/base/QtMain.h @@ -52,8 +52,8 @@ class MainUI : public QGLWidget { Q_OBJECT public: - explicit MainUI(float scale, QWidget *parent = 0): - QGLWidget(parent), dpi_scale(scale) + explicit MainUI(QWidget *parent = 0): + QGLWidget(parent) { setAttribute(Qt::WA_AcceptTouchEvents); setAttribute(Qt::WA_LockLandscapeOrientation); @@ -74,8 +74,8 @@ protected: { pixel_xres = e->size().width(); pixel_yres = e->size().height(); - dp_xres = pixel_xres * dpi_scale; - dp_yres = pixel_yres * dpi_scale; + dp_xres = pixel_xres * g_dpi_scale; + dp_yres = pixel_yres * g_dpi_scale; } bool event(QEvent *e) @@ -95,21 +95,21 @@ protected: case Qt::TouchPointPressed: case Qt::TouchPointReleased: input_state.pointer_down[touchPoint.id()] = (touchPoint.state() == Qt::TouchPointPressed); - input_state.pointer_x[touchPoint.id()] = touchPoint.pos().x() * dpi_scale; - input_state.pointer_y[touchPoint.id()] = touchPoint.pos().y() * dpi_scale; + input_state.pointer_x[touchPoint.id()] = touchPoint.pos().x() * g_dpi_scale; + input_state.pointer_y[touchPoint.id()] = touchPoint.pos().y() * g_dpi_scale; - input.x = touchPoint.pos().x() * dpi_scale; - input.y = touchPoint.pos().y() * dpi_scale; + input.x = touchPoint.pos().x() * g_dpi_scale; + input.y = touchPoint.pos().y() * g_dpi_scale; input.flags = (touchPoint.state() == Qt::TouchPointPressed) ? TOUCH_DOWN : TOUCH_UP; input.id = touchPoint.id(); NativeTouch(input); break; case Qt::TouchPointMoved: - input_state.pointer_x[touchPoint.id()] = touchPoint.pos().x() * dpi_scale; - input_state.pointer_y[touchPoint.id()] = touchPoint.pos().y() * dpi_scale; + input_state.pointer_x[touchPoint.id()] = touchPoint.pos().x() * g_dpi_scale; + input_state.pointer_y[touchPoint.id()] = touchPoint.pos().y() * g_dpi_scale; - input.x = touchPoint.pos().x() * dpi_scale; - input.y = touchPoint.pos().y() * dpi_scale; + input.x = touchPoint.pos().x() * g_dpi_scale; + input.y = touchPoint.pos().y() * g_dpi_scale; input.flags = TOUCH_MOVE; input.id = touchPoint.id(); NativeTouch(input); @@ -122,21 +122,21 @@ protected: case QEvent::MouseButtonPress: case QEvent::MouseButtonRelease: input_state.pointer_down[0] = (e->type() == QEvent::MouseButtonPress); - input_state.pointer_x[0] = ((QMouseEvent*)e)->pos().x() * dpi_scale; - input_state.pointer_y[0] = ((QMouseEvent*)e)->pos().y() * dpi_scale; + input_state.pointer_x[0] = ((QMouseEvent*)e)->pos().x() * g_dpi_scale; + input_state.pointer_y[0] = ((QMouseEvent*)e)->pos().y() * g_dpi_scale; - input.x = ((QMouseEvent*)e)->pos().x() * dpi_scale; - input.y = ((QMouseEvent*)e)->pos().y() * dpi_scale; + input.x = ((QMouseEvent*)e)->pos().x() * g_dpi_scale; + input.y = ((QMouseEvent*)e)->pos().y() * g_dpi_scale; input.flags = (e->type() == QEvent::MouseButtonPress) ? TOUCH_DOWN : TOUCH_UP; input.id = 0; NativeTouch(input); break; case QEvent::MouseMove: - input_state.pointer_x[0] = ((QMouseEvent*)e)->pos().x() * dpi_scale; - input_state.pointer_y[0] = ((QMouseEvent*)e)->pos().y() * dpi_scale; + input_state.pointer_x[0] = ((QMouseEvent*)e)->pos().x() * g_dpi_scale; + input_state.pointer_y[0] = ((QMouseEvent*)e)->pos().y() * g_dpi_scale; - input.x = ((QMouseEvent*)e)->pos().x() * dpi_scale; - input.y = ((QMouseEvent*)e)->pos().y() * dpi_scale; + input.x = ((QMouseEvent*)e)->pos().x() * g_dpi_scale; + input.y = ((QMouseEvent*)e)->pos().y() * g_dpi_scale; input.flags = TOUCH_MOVE; input.id = 0; NativeTouch(input); @@ -192,7 +192,6 @@ private: #ifdef USING_GLES2 QAccelerometer* acc; #endif - float dpi_scale; }; // Audio