diff options
author | MerryMage <MerryMage@users.noreply.github.com> | 2016-05-12 22:49:02 +0200 |
---|---|---|
committer | MerryMage <MerryMage@users.noreply.github.com> | 2016-05-12 22:49:02 +0200 |
commit | 9b4187974ba3226aa8175467c80ebf0d45ec5d77 (patch) | |
tree | 1731f761de898e9c48f588ae94564b0250b0a227 /src/citra_qt/debugger/profiler.cpp | |
parent | Merge pull request #1690 from JayFoxRox/tex-type-3 (diff) | |
download | yuzu-9b4187974ba3226aa8175467c80ebf0d45ec5d77.tar yuzu-9b4187974ba3226aa8175467c80ebf0d45ec5d77.tar.gz yuzu-9b4187974ba3226aa8175467c80ebf0d45ec5d77.tar.bz2 yuzu-9b4187974ba3226aa8175467c80ebf0d45ec5d77.tar.lz yuzu-9b4187974ba3226aa8175467c80ebf0d45ec5d77.tar.xz yuzu-9b4187974ba3226aa8175467c80ebf0d45ec5d77.tar.zst yuzu-9b4187974ba3226aa8175467c80ebf0d45ec5d77.zip |
Diffstat (limited to 'src/citra_qt/debugger/profiler.cpp')
-rw-r--r-- | src/citra_qt/debugger/profiler.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/citra_qt/debugger/profiler.cpp b/src/citra_qt/debugger/profiler.cpp index 7bb010f77..585ac049a 100644 --- a/src/citra_qt/debugger/profiler.cpp +++ b/src/citra_qt/debugger/profiler.cpp @@ -151,6 +151,8 @@ private: /// This timer is used to redraw the widget's contents continuously. To save resources, it only /// runs while the widget is visible. QTimer update_timer; + /// Scale the coordinate system appropriately when physical DPI != logical DPI. + qreal x_scale, y_scale; }; #endif @@ -220,11 +222,17 @@ MicroProfileWidget::MicroProfileWidget(QWidget* parent) : QWidget(parent) { MicroProfileInitUI(); connect(&update_timer, SIGNAL(timeout()), SLOT(update())); + + QPainter painter(this); + x_scale = qreal(painter.device()->physicalDpiX()) / qreal(painter.device()->logicalDpiX()); + y_scale = qreal(painter.device()->physicalDpiY()) / qreal(painter.device()->logicalDpiY()); } void MicroProfileWidget::paintEvent(QPaintEvent* ev) { QPainter painter(this); + painter.scale(x_scale, y_scale); + painter.setBackground(Qt::black); painter.eraseRect(rect()); @@ -248,24 +256,24 @@ void MicroProfileWidget::hideEvent(QHideEvent* ev) { } void MicroProfileWidget::mouseMoveEvent(QMouseEvent* ev) { - MicroProfileMousePosition(ev->x(), ev->y(), 0); + MicroProfileMousePosition(ev->x() / x_scale, ev->y() / y_scale, 0); ev->accept(); } void MicroProfileWidget::mousePressEvent(QMouseEvent* ev) { - MicroProfileMousePosition(ev->x(), ev->y(), 0); + MicroProfileMousePosition(ev->x() / x_scale, ev->y() / y_scale, 0); MicroProfileMouseButton(ev->buttons() & Qt::LeftButton, ev->buttons() & Qt::RightButton); ev->accept(); } void MicroProfileWidget::mouseReleaseEvent(QMouseEvent* ev) { - MicroProfileMousePosition(ev->x(), ev->y(), 0); + MicroProfileMousePosition(ev->x() / x_scale, ev->y() / y_scale, 0); MicroProfileMouseButton(ev->buttons() & Qt::LeftButton, ev->buttons() & Qt::RightButton); ev->accept(); } void MicroProfileWidget::wheelEvent(QWheelEvent* ev) { - MicroProfileMousePosition(ev->x(), ev->y(), ev->delta() / 120); + MicroProfileMousePosition(ev->x() / x_scale, ev->y() / y_scale, ev->delta() / 120); ev->accept(); } |