diff --git a/Core/Core.cpp b/Core/Core.cpp index 39645ca5ec..55783375a8 100644 --- a/Core/Core.cpp +++ b/Core/Core.cpp @@ -132,8 +132,8 @@ bool Core_GetPowerSaving() { static bool IsWindowSmall(int pixelWidth, int pixelHeight) { // Can't take this from config as it will not be set if windows is maximized. - int w = (int)(pixelWidth * g_dpi_scale); - int h = (int)(pixelHeight * g_dpi_scale); + int w = (int)(pixelWidth * g_dpi_scale_x); + int h = (int)(pixelHeight * g_dpi_scale_y); return g_Config.IsPortrait() ? (h < 480 + 80) : (w < 480 + 80); } @@ -142,22 +142,27 @@ bool UpdateScreenScale(int width, int height) { bool smallWindow; #ifdef _WIN32 g_dpi = (float)System_GetPropertyInt(SYSPROP_DISPLAY_DPI); - g_dpi_scale = 96.0f / g_dpi; + g_dpi_scale_x = 96.0f / g_dpi; + g_dpi_scale_y = 96.0f / g_dpi; #else g_dpi = 96.0f; - g_dpi_scale = 1.0f; + g_dpi_scale_x = 1.0f; + g_dpi_scale_y = 1.0f; #endif - g_dpi_scale_real = g_dpi_scale; + g_dpi_scale_real_x = g_dpi_scale_x; + g_dpi_scale_real_y = g_dpi_scale_y; smallWindow = IsWindowSmall(width, height); if (smallWindow) { g_dpi /= 2.0f; - g_dpi_scale *= 2.0f; + g_dpi_scale_x *= 2.0f; + g_dpi_scale_y *= 2.0f; } - pixel_in_dps = 1.0f / g_dpi_scale; + pixel_in_dps_x = 1.0f / g_dpi_scale_x; + pixel_in_dps_y = 1.0f / g_dpi_scale_y; - int new_dp_xres = width * g_dpi_scale; - int new_dp_yres = height * g_dpi_scale; + int new_dp_xres = width * g_dpi_scale_x; + int new_dp_yres = height * g_dpi_scale_y; bool dp_changed = new_dp_xres != dp_xres || new_dp_yres != dp_yres; bool px_changed = pixel_xres != width || pixel_yres != height; diff --git a/UI/ReportScreen.cpp b/UI/ReportScreen.cpp index ae663fc2e9..697a86751d 100644 --- a/UI/ReportScreen.cpp +++ b/UI/ReportScreen.cpp @@ -248,7 +248,7 @@ void ReportScreen::CreateViews() { screenshotFilename_ = path + ".reporting.jpg"; int shotWidth = 0, shotHeight = 0; if (TakeGameScreenshot(screenshotFilename_.c_str(), SCREENSHOT_JPG, SCREENSHOT_DISPLAY, &shotWidth, &shotHeight, 4)) { - float scale = 340.0f * (1.0f / g_dpi_scale) * (1.0f / shotHeight); + float scale = 340.0f * (1.0f / g_dpi_scale_y) * (1.0f / shotHeight); leftColumnItems->Add(new CheckBox(&includeScreenshot_, rp->T("FeedbackIncludeScreen", "Include a screenshot")))->SetEnabledPtr(&enableReporting_); screenshot_ = leftColumnItems->Add(new AsyncImageFileView(screenshotFilename_, IS_DEFAULT, nullptr, new LinearLayoutParams(shotWidth * scale, shotHeight * scale, Margins(12, 0)))); } else { diff --git a/UWP/PPSSPP_UWPMain.cpp b/UWP/PPSSPP_UWPMain.cpp index cc839f29cb..59acf07c57 100644 --- a/UWP/PPSSPP_UWPMain.cpp +++ b/UWP/PPSSPP_UWPMain.cpp @@ -203,12 +203,14 @@ bool PPSSPP_UWPMain::Render() { // Boost DPI a bit to look better. g_dpi *= 96.0f / 136.0f; } - g_dpi_scale = 96.0f / g_dpi; + g_dpi_scale_x = 96.0f / g_dpi; + g_dpi_scale_y = 96.0f / g_dpi; - pixel_in_dps = 1.0f / g_dpi_scale; + pixel_in_dps_x = 1.0f / g_dpi_scale_x; + pixel_in_dps_y = 1.0f / g_dpi_scale_y; - dp_xres = pixel_xres * g_dpi_scale; - dp_yres = pixel_yres * g_dpi_scale; + dp_xres = pixel_xres * g_dpi_scale_x; + dp_yres = pixel_yres * g_dpi_scale_y; context->RSSetViewports(1, &viewport); @@ -281,13 +283,15 @@ bool PPSSPP_UWPMain::OnHardwareButton(HardwareButton button) { void PPSSPP_UWPMain::OnTouchEvent(int touchEvent, int touchId, float x, float y, double timestamp) { // We get the coordinate in Windows' device independent pixels already. So let's undo that, // and then apply our own "dpi". - float dpiFactor = m_deviceResources->GetActualDpi() / 96.0f; - dpiFactor /= pixel_in_dps; + float dpiFactor_x = m_deviceResources->GetActualDpi() / 96.0f; + float dpiFactor_y = dpiFactor_x; + dpiFactor_x /= pixel_in_dps_x; + dpiFactor_y /= pixel_in_dps_y; TouchInput input{}; input.id = touchId; - input.x = x * dpiFactor; - input.y = y * dpiFactor; + input.x = x * dpiFactor_x; + input.y = y * dpiFactor_y; input.flags = touchEvent; input.timestamp = timestamp; NativeTouch(input); diff --git a/Windows/GEDebugger/CtrlDisplayListView.cpp b/Windows/GEDebugger/CtrlDisplayListView.cpp index 85cd6f1e47..c428aca63f 100644 --- a/Windows/GEDebugger/CtrlDisplayListView.cpp +++ b/Windows/GEDebugger/CtrlDisplayListView.cpp @@ -46,7 +46,7 @@ CtrlDisplayListView::CtrlDisplayListView(HWND _wnd) instructionSize = 4; // In small window mode, g_dpi_scal may have been adjusted. - const float fontScale = 1.0f / g_dpi_scale_real; + const float fontScale = 1.0f / g_dpi_scale_real_y; int fontHeight = g_Config.iFontHeight * fontScale; int charWidth = g_Config.iFontWidth * fontScale; diff --git a/Windows/MainWindow.cpp b/Windows/MainWindow.cpp index ad3d46d8e8..054c63bc1e 100644 --- a/Windows/MainWindow.cpp +++ b/Windows/MainWindow.cpp @@ -574,8 +574,8 @@ namespace MainWindow // Hack: Take the opportunity to show the cursor. mouseButtonDown = true; - float x = GET_X_LPARAM(lParam) * g_dpi_scale; - float y = GET_Y_LPARAM(lParam) * g_dpi_scale; + float x = GET_X_LPARAM(lParam) * g_dpi_scale_x; + float y = GET_Y_LPARAM(lParam) * g_dpi_scale_y; WindowsRawInput::SetMousePos(x, y); TouchInput touch; @@ -615,8 +615,8 @@ namespace MainWindow prevCursorX = cursorX; prevCursorY = cursorY; - float x = GET_X_LPARAM(lParam) * g_dpi_scale; - float y = GET_Y_LPARAM(lParam) * g_dpi_scale; + float x = (float)cursorX * g_dpi_scale_x; + float y = (float)cursorY * g_dpi_scale_y; WindowsRawInput::SetMousePos(x, y); if (wParam & MK_LBUTTON) { @@ -637,8 +637,8 @@ namespace MainWindow // Hack: Take the opportunity to hide the cursor. mouseButtonDown = false; - float x = GET_X_LPARAM(lParam) * g_dpi_scale; - float y = GET_Y_LPARAM(lParam) * g_dpi_scale; + float x = (float)GET_X_LPARAM(lParam) * g_dpi_scale_x; + float y = (float)GET_Y_LPARAM(lParam) * g_dpi_scale_y; WindowsRawInput::SetMousePos(x, y); TouchInput touch; diff --git a/Windows/TouchInputHandler.cpp b/Windows/TouchInputHandler.cpp index fc6b3b85ef..cab9cf085f 100644 --- a/Windows/TouchInputHandler.cpp +++ b/Windows/TouchInputHandler.cpp @@ -10,20 +10,13 @@ #include "base/NativeApp.h" #include "Windows/MainWindow.h" -TouchInputHandler::TouchInputHandler() : - touchInfo(nullptr), - closeTouch(nullptr), - registerTouch(nullptr) -{ - +TouchInputHandler::TouchInputHandler() { touchInfo = (getTouchInputProc) GetProcAddress( GetModuleHandle(TEXT("User32.dll")), "GetTouchInputInfo"); - closeTouch = (closeTouchInputProc) GetProcAddress( GetModuleHandle(TEXT("User32.dll")), "CloseTouchInputHandle"); - registerTouch = (registerTouchProc) GetProcAddress( GetModuleHandle(TEXT("User32.dll")), "RegisterTouchWindow"); @@ -65,8 +58,8 @@ bool TouchInputHandler::GetTouchPoint(HWND hWnd, const TOUCHINPUT &input, float point.x = (LONG)(TOUCH_COORD_TO_PIXEL(input.x)); point.y = (LONG)(TOUCH_COORD_TO_PIXEL(input.y)); if (ScreenToClient(hWnd, &point)) { - x = point.x * g_dpi_scale; - y = point.y * g_dpi_scale; + x = point.x * g_dpi_scale_x; + y = point.y * g_dpi_scale_y; return true; } diff --git a/Windows/TouchInputHandler.h b/Windows/TouchInputHandler.h index 7477ae7fc6..7d2761ecb7 100644 --- a/Windows/TouchInputHandler.h +++ b/Windows/TouchInputHandler.h @@ -34,7 +34,7 @@ private: void touchDown(int id, float x, float y); void touchMove(int id, float x, float y); - int touchIds[10]; + int touchIds[10]{}; getTouchInputProc touchInfo; closeTouchInputProc closeTouch; registerTouchProc registerTouch; diff --git a/Windows/WindowsHost.cpp b/Windows/WindowsHost.cpp index e0eb554525..de2e7ff9bf 100644 --- a/Windows/WindowsHost.cpp +++ b/Windows/WindowsHost.cpp @@ -211,10 +211,11 @@ void WindowsHost::PollControllers() { doPad = false; } - float scaleFactor = g_dpi_scale * 0.1 * g_Config.fMouseSensitivity; + float scaleFactor_x = g_dpi_scale_x * 0.1 * g_Config.fMouseSensitivity; + float scaleFactor_y = g_dpi_scale_y * 0.1 * g_Config.fMouseSensitivity; - float mx = std::max(-1.0f, std::min(1.0f, g_mouseDeltaX * scaleFactor)); - float my = std::max(-1.0f, std::min(1.0f, g_mouseDeltaY * scaleFactor)); + float mx = std::max(-1.0f, std::min(1.0f, g_mouseDeltaX * scaleFactor_x)); + float my = std::max(-1.0f, std::min(1.0f, g_mouseDeltaY * scaleFactor_y)); AxisInput axisX, axisY; axisX.axisId = JOYSTICK_AXIS_MOUSE_REL_X; axisX.deviceId = DEVICE_ID_MOUSE; diff --git a/android/jni/app-android.cpp b/android/jni/app-android.cpp index 50787ff146..0833c41dca 100644 --- a/android/jni/app-android.cpp +++ b/android/jni/app-android.cpp @@ -705,21 +705,58 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeRenderer_displayResize(JNIEnv *, jo pixel_yres = h; g_dpi = display_dpi; - g_dpi_scale = 240.0f / g_dpi; - g_dpi_scale_real = g_dpi_scale; + g_dpi_scale_x = 240.0f / g_dpi; + g_dpi_scale_y = 240.0f / g_dpi; + g_dpi_scale_real_x = g_dpi_scale_x; + g_dpi_scale_real_y = g_dpi_scale_y; - dp_xres = display_xres * g_dpi_scale; - dp_yres = display_yres * g_dpi_scale; + dp_xres = display_xres * g_dpi_scale_x; + dp_yres = display_yres * g_dpi_scale_y; // Touch scaling is from display pixels to dp pixels. dp_xscale = (float)dp_xres / (float)display_xres; dp_yscale = (float)dp_yres / (float)display_yres; - pixel_in_dps = (float)pixel_xres / dp_xres; + pixel_in_dps_x = (float)pixel_xres / dp_xres; + pixel_in_dps_y = (float)pixel_yres / dp_yres; NativeResized(); } + +extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_backbufferResize(JNIEnv *, jclass, jint bufw, jint bufh, jint format) { + ILOG("NativeApp.backbufferResize(%d x %d)", bufw, bufh); + + // pixel_*res is the backbuffer resolution. + pixel_xres = bufw; + pixel_yres = bufh; + backbuffer_format = format; + + g_dpi = display_dpi; + g_dpi_scale_x = 240.0f / g_dpi; + g_dpi_scale_y = 240.0f / g_dpi; + g_dpi_scale_real_x = g_dpi_scale_x; + g_dpi_scale_real_y = g_dpi_scale_y; + + dp_xres = display_xres * g_dpi_scale_x; + dp_yres = display_yres * g_dpi_scale_y; + + // Touch scaling is from display pixels to dp pixels. + dp_xscale = (float)dp_xres / (float)display_xres; + dp_yscale = (float)dp_yres / (float)display_yres; + + pixel_in_dps_x = (float)pixel_xres / dp_xres; + pixel_in_dps_y = (float)pixel_yres / dp_yres; + + ILOG("dp_xscale=%f dp_yscale=%f", dp_xscale, dp_yscale); + ILOG("dp_xres=%d dp_yres=%d", dp_xres, dp_yres); + ILOG("pixel_xres=%d pixel_yres=%d", pixel_xres, pixel_yres); + ILOG("g_dpi=%d g_dpi_scale_x=%f g_dpi_scale_y", g_dpi, g_dpi_scale_x, g_dpi_scale_y); + + NativeResized(); +} + + // JavaEGL extern "C" void Java_org_ppsspp_ppsspp_NativeRenderer_displayRender(JNIEnv *env, jobject obj) { static bool hasSetThreadName = false; @@ -965,35 +1002,6 @@ extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_setDisplayParameters(JN display_hz = refreshRate; } -extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_backbufferResize(JNIEnv *, jclass, jint bufw, jint bufh, jint format) { - ILOG("NativeApp.backbufferResize(%d x %d)", bufw, bufh); - - // pixel_*res is the backbuffer resolution. - pixel_xres = bufw; - pixel_yres = bufh; - backbuffer_format = format; - - g_dpi = (float)display_dpi; - g_dpi_scale = 240.0f / g_dpi; - g_dpi_scale_real = g_dpi_scale; - - dp_xres = display_xres * g_dpi_scale; - dp_yres = display_yres * g_dpi_scale; - - // Touch scaling is from display pixels to dp pixels. - dp_xscale = (float)dp_xres / (float)display_xres; - dp_yscale = (float)dp_yres / (float)display_yres; - - pixel_in_dps = (float)pixel_xres / dp_xres; - - ILOG("dp_xscale=%f dp_yscale=%f", dp_xscale, dp_yscale); - ILOG("dp_xres=%d dp_yres=%d", dp_xres, dp_yres); - ILOG("pixel_xres=%d pixel_yres=%d", pixel_xres, pixel_yres); - ILOG("g_dpi=%d g_dpi_scale=%f", g_dpi, g_dpi_scale); - - NativeResized(); -} - extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_computeDesiredBackbufferDimensions() { getDesiredBackbufferSize(desiredBackbufferSizeX, desiredBackbufferSizeY); } diff --git a/ext/native/base/PCMain.cpp b/ext/native/base/PCMain.cpp index 256121384e..364c4a5876 100644 --- a/ext/native/base/PCMain.cpp +++ b/ext/native/base/PCMain.cpp @@ -631,9 +631,12 @@ int main(int argc, char *argv[]) { NativeInit(remain_argc, (const char **)remain_argv, path, "/tmp", nullptr); #endif - pixel_in_dps = (float)pixel_xres / dp_xres; - g_dpi_scale = dp_xres / (float)pixel_xres; - g_dpi_scale_real = g_dpi_scale; + pixel_in_dps_x = (float)pixel_xres / dp_xres; + pixel_in_dps_y = (float)pixel_yres / dp_yres; + g_dpi_scale_x = dp_xres / (float)pixel_xres; + g_dpi_scale_y = dp_yres / (float)pixel_yres; + g_dpi_scale_real_x = g_dpi_scale_x; + g_dpi_scale_real_y = g_dpi_scale_y; printf("Pixels: %i x %i\n", pixel_xres, pixel_yres); printf("Virtual pixels: %i x %i\n", dp_xres, dp_yres); diff --git a/ext/native/base/QtMain.cpp b/ext/native/base/QtMain.cpp index 586c973965..917f68acc7 100644 --- a/ext/native/base/QtMain.cpp +++ b/ext/native/base/QtMain.cpp @@ -263,15 +263,15 @@ bool MainUI::event(QEvent *e) break; case Qt::TouchPointPressed: case Qt::TouchPointReleased: - input.x = touchPoint.pos().x() * g_dpi_scale * xscale; - input.y = touchPoint.pos().y() * g_dpi_scale * yscale; + input.x = touchPoint.pos().x() * g_dpi_scale_x * xscale; + input.y = touchPoint.pos().y() * g_dpi_scale_y * yscale; input.flags = (touchPoint.state() == Qt::TouchPointPressed) ? TOUCH_DOWN : TOUCH_UP; input.id = touchPoint.id(); NativeTouch(input); break; case Qt::TouchPointMoved: - input.x = touchPoint.pos().x() * g_dpi_scale * xscale; - input.y = touchPoint.pos().y() * g_dpi_scale * yscale; + input.x = touchPoint.pos().x() * g_dpi_scale_x * xscale; + input.y = touchPoint.pos().y() * g_dpi_scale_y * yscale; input.flags = TOUCH_MOVE; input.id = touchPoint.id(); NativeTouch(input); @@ -287,15 +287,15 @@ bool MainUI::event(QEvent *e) break; case QEvent::MouseButtonPress: case QEvent::MouseButtonRelease: - input.x = ((QMouseEvent*)e)->pos().x() * g_dpi_scale * xscale; - input.y = ((QMouseEvent*)e)->pos().y() * g_dpi_scale * yscale; + input.x = ((QMouseEvent*)e)->pos().x() * g_dpi_scale_x * xscale; + input.y = ((QMouseEvent*)e)->pos().y() * g_dpi_scale_y * yscale; input.flags = (e->type() == QEvent::MouseButtonPress) ? TOUCH_DOWN : TOUCH_UP; input.id = 0; NativeTouch(input); break; case QEvent::MouseMove: - input.x = ((QMouseEvent*)e)->pos().x() * g_dpi_scale * xscale; - input.y = ((QMouseEvent*)e)->pos().y() * g_dpi_scale * yscale; + input.x = ((QMouseEvent*)e)->pos().x() * g_dpi_scale_x * xscale; + input.y = ((QMouseEvent*)e)->pos().y() * g_dpi_scale_y * yscale; input.flags = TOUCH_MOVE; input.id = 0; NativeTouch(input); @@ -437,8 +437,10 @@ int main(int argc, char *argv[]) res.transpose(); pixel_xres = res.width(); pixel_yres = res.height(); - g_dpi_scale = CalculateDPIScale(); - g_dpi_scale_real = g_dpi_scale; + g_dpi_scale_x = CalculateDPIScale(); + g_dpi_scale_y = CalculateDPIScale(); + g_dpi_scale_real_x = g_dpi_scale_x; + g_dpi_scale_real_y = g_dpi_scale_y; dp_xres = (int)(pixel_xres * g_dpi_scale); dp_yres = (int)(pixel_yres * g_dpi_scale); std::string savegame_dir = "."; std::string external_dir = "."; diff --git a/ext/native/base/display.cpp b/ext/native/base/display.cpp index c2ebd1d0f4..2223753a7d 100644 --- a/ext/native/base/display.cpp +++ b/ext/native/base/display.cpp @@ -7,9 +7,12 @@ int pixel_xres; int pixel_yres; float g_dpi = 1.0f; // will be overwritten with a value that makes sense. -float g_dpi_scale = 1.0f; -float g_dpi_scale_real = 1.0f; -float pixel_in_dps = 1.0f; +float g_dpi_scale_x = 1.0f; +float g_dpi_scale_y = 1.0f; +float g_dpi_scale_real_x = 1.0f; +float g_dpi_scale_real_y = 1.0f; +float pixel_in_dps_x = 1.0f; +float pixel_in_dps_y = 1.0f; float display_hz = 60.0f; DisplayRotation g_display_rotation; diff --git a/ext/native/base/display.h b/ext/native/base/display.h index 31fbf53cd8..ca01fe1997 100644 --- a/ext/native/base/display.h +++ b/ext/native/base/display.h @@ -11,9 +11,12 @@ extern int pixel_xres; extern int pixel_yres; extern float g_dpi; -extern float g_dpi_scale; -extern float g_dpi_scale_real; -extern float pixel_in_dps; +extern float g_dpi_scale_x; +extern float g_dpi_scale_y; +extern float g_dpi_scale_real_x; +extern float g_dpi_scale_real_y; +extern float pixel_in_dps_x; +extern float pixel_in_dps_y; extern float display_hz; // On some platforms (currently only Windows UWP) we need to manually rotate diff --git a/ext/native/gfx_es2/draw_buffer.cpp b/ext/native/gfx_es2/draw_buffer.cpp index b45f352949..bae8b2be9b 100644 --- a/ext/native/gfx_es2/draw_buffer.cpp +++ b/ext/native/gfx_es2/draw_buffer.cpp @@ -131,15 +131,15 @@ void DrawBuffer::Rect(float x, float y, float w, float h, uint32_t color, int al } void DrawBuffer::hLine(float x1, float y, float x2, uint32_t color) { - Rect(x1, y, x2 - x1, pixel_in_dps, color); + Rect(x1, y, x2 - x1, pixel_in_dps_y, color); } void DrawBuffer::vLine(float x, float y1, float y2, uint32_t color) { - Rect(x, y1, pixel_in_dps, y2 - y1, color); + Rect(x, y1, pixel_in_dps_x, y2 - y1, color); } void DrawBuffer::vLineAlpha50(float x, float y1, float y2, uint32_t color) { - Rect(x, y1, pixel_in_dps, y2 - y1, (color | 0xFF000000) & 0x7F000000); + Rect(x, y1, pixel_in_dps_x, y2 - y1, (color | 0xFF000000) & 0x7F000000); } void DrawBuffer::RectVGradient(float x, float y, float w, float h, uint32_t colorTop, uint32_t colorBottom) { @@ -152,11 +152,11 @@ void DrawBuffer::RectVGradient(float x, float y, float w, float h, uint32_t colo } void DrawBuffer::RectOutline(float x, float y, float w, float h, uint32_t color, int align) { - hLine(x, y, x + w + pixel_in_dps, color); - hLine(x, y + h, x + w + pixel_in_dps, color); + hLine(x, y, x + w + pixel_in_dps_x, color); + hLine(x, y + h, x + w + pixel_in_dps_x, color); - vLine(x, y, y + h + pixel_in_dps, color); - vLine(x + w, y, y + h + pixel_in_dps, color); + vLine(x, y, y + h + pixel_in_dps_y, color); + vLine(x + w, y, y + h + pixel_in_dps_y, color); } void DrawBuffer::MultiVGradient(float x, float y, float w, float h, GradientStop *stops, int numStops) { diff --git a/ext/native/gfx_es2/draw_text.cpp b/ext/native/gfx_es2/draw_text.cpp index 3666a765b7..fd3d347dbb 100644 --- a/ext/native/gfx_es2/draw_text.cpp +++ b/ext/native/gfx_es2/draw_text.cpp @@ -34,7 +34,7 @@ void TextDrawer::SetFontScale(float xscale, float yscale) { } float TextDrawer::CalculateDPIScale() { - float scale = g_dpi_scale; + float scale = g_dpi_scale_x; if (scale >= 1.0f) { scale = 1.0f; } diff --git a/ext/native/ui/ui_context.cpp b/ext/native/ui/ui_context.cpp index 4c9f5fd19b..fc36b16e9e 100644 --- a/ext/native/ui/ui_context.cpp +++ b/ext/native/ui/ui_context.cpp @@ -90,12 +90,13 @@ Bounds UIContext::GetScissorBounds() { void UIContext::ActivateTopScissor() { Bounds bounds; if (scissorStack_.size()) { - float scale = pixel_in_dps; + float scale_x = pixel_in_dps_x; + float scale_y = pixel_in_dps_y; bounds = scissorStack_.back(); - int x = floorf(scale * bounds.x); - int y = floorf(scale * bounds.y); - int w = ceilf(scale * bounds.w); - int h = ceilf(scale * bounds.h); + int x = floorf(scale_x * bounds.x); + int y = floorf(scale_y * bounds.y); + int w = ceilf(scale_x * bounds.w); + int h = ceilf(scale_y * bounds.h); draw_->SetScissorRect(x, y, w, h); } else { // Avoid rounding errors