Commit 0760c958 authored by Luca Carlon's avatar Luca Carlon Committed by Albert Astals Cid
Browse files

Fix scale computation when fitting framebuffer to local view.

parent b9f0a172
Pipeline #227031 passed with stage
in 1 minute
......@@ -43,7 +43,7 @@ QWidget * FactorWidget::createWidget(QWidget * parent)
}
QSlider * s = new QSlider(Qt::Horizontal, _parent);
s->setRange(0, 100);
s->setRange(100, 200);
s->setMaximumWidth(100);
connect(s, &QSlider::valueChanged, m_receiver, &MainWindow::setFactor);
......
......@@ -121,11 +121,9 @@ void VncView::scaleResize(int w, int h)
qCDebug(KRDC) << w << h;
if (m_scale) {
const QSize frameSize = m_frame.size() / m_frame.devicePixelRatio();
const qreal _newW = (frameSize.width() - w) * m_factor + w;
const qreal _newH = (frameSize.height() - h) * m_factor + h;
m_verticalFactor = _newH / frameSize.height();
m_horizontalFactor = _newW / frameSize.width();
m_verticalFactor = static_cast<qreal>(h) / frameSize.height() * m_factor;
m_horizontalFactor = static_cast<qreal>(w) / frameSize.width() * m_factor;
#ifndef QTONLY
if (Settings::keepAspectRatio()) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment