1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-07 23:29:06 +00:00

Ensures proper output sizeing on HiDPI displays.

This commit is contained in:
Thomas Harte 2020-06-26 21:14:43 -04:00
parent 387500f01a
commit 3c896050fb

View File

@ -52,8 +52,11 @@ void ScanTargetWidget::paintGL() {
}
vsyncPredictor.begin_redraw();
scanTarget->update(width(), height());
scanTarget->draw(width(), height());
const int devicePixelRatio = QPaintDevice::devicePixelRatio();
const int outputWidth = width()*devicePixelRatio;
const int outputHeight = height()*devicePixelRatio;
scanTarget->update(outputWidth, outputHeight);
scanTarget->draw(outputWidth, outputHeight);
glFinish(); // Make sure all costs are properly accounted for in the vsync predictor.
vsyncPredictor.end_redraw();
}
@ -76,7 +79,8 @@ void ScanTargetWidget::vsync() {
}
void ScanTargetWidget::resizeGL(int w, int h) {
glViewport(0, 0, w, h);
const int devicePixelRatio = QPaintDevice::devicePixelRatio();
glViewport(0, 0, w*devicePixelRatio, h*devicePixelRatio);
}
void ScanTargetWidget::setScanProducer(MachineTypes::ScanProducer *producer) {