Fix frame size in monitor overlay with non square pixels

parent 9633446d
Pipeline #14566 passed with stage
in 26 minutes and 31 seconds
......@@ -1924,8 +1924,7 @@ void Monitor::loadQmlScene(MonitorSceneType type)
pCore->displayMessage(i18n("Enable edit mode in monitor to edit effect"), InformationMessage, 500);
type = MonitorSceneDefault;
}
double ratio = (double)m_glMonitor->profileSize().width() / (int)(m_glMonitor->profileSize().height() * pCore->getCurrentProfile()->dar() + 0.5);
m_qmlManager->setScene(m_id, type, pCore->getCurrentFrameSize(), ratio, m_glMonitor->displayRect(), m_glMonitor->zoom(), m_timePos->maximum());
m_qmlManager->setScene(m_id, type, pCore->getCurrentFrameSize(), pCore->getCurrentDar(), m_glMonitor->displayRect(), m_glMonitor->zoom(), m_timePos->maximum());
QQuickItem *root = m_glMonitor->rootObject();
switch (type) {
case MonitorSceneSplit:
......
......@@ -56,6 +56,10 @@ void QmlManager::setScene(Kdenlive::MonitorId id, MonitorSceneType type, QSize p
QQuickItem *root = nullptr;
const QFont ft = QFontDatabase::systemFont(QFontDatabase::FixedFont);
m_view->rootContext()->setContextProperty("fixedFont", ft);
double scalex = (double)displayRect.width() / profile.width() * zoom;
double scaley = displayRect.width() /
((double)profile.height() * profileStretch / profile.width()) /
profile.width() * zoom;
switch (type) {
case MonitorSceneGeometry:
m_view->setSource(QUrl(QStringLiteral("qrc:/qml/kdenlivemonitoreffectscene.qml")));
......@@ -64,19 +68,18 @@ void QmlManager::setScene(Kdenlive::MonitorId id, MonitorSceneType type, QSize p
QObject::connect(root, SIGNAL(centersChanged()), this, SLOT(effectPolygonChanged()), Qt::UniqueConnection);
root->setProperty("profile", QPoint(profile.width(), profile.height()));
root->setProperty("framesize", QRect(0, 0, profile.width(), profile.height()));
root->setProperty("scalex", (double)displayRect.width() / profile.width() * zoom);
root->setProperty("scaley", (double)displayRect.width() / profileStretch / profile.width() * zoom);
root->setProperty("scalex", scalex);
root->setProperty("scaley", scaley);
root->setProperty("center", displayRect.center());
break;
case MonitorSceneCorners:
qDebug() << "/// LOADING CORNERS SCENE\n\n+++++++++++++++++++++++++\n------------------\n+++++++++++++++++";
m_view->setSource(QUrl(QStringLiteral("qrc:/qml/kdenlivemonitorcornerscene.qml")));
root = m_view->rootObject();
QObject::connect(root, SIGNAL(effectPolygonChanged()), this, SLOT(effectPolygonChanged()), Qt::UniqueConnection);
root->setProperty("profile", QPoint(profile.width(), profile.height()));
root->setProperty("framesize", QRect(0, 0, profile.width(), profile.height()));
root->setProperty("scalex", (double)displayRect.width() / profile.width() * zoom);
root->setProperty("scaley", (double)displayRect.width() / profileStretch / profile.width() * zoom);
root->setProperty("scalex", scalex);
root->setProperty("scaley", scaley);
root->setProperty("stretch", profileStretch);
root->setProperty("center", displayRect.center());
break;
......@@ -86,8 +89,8 @@ void QmlManager::setScene(Kdenlive::MonitorId id, MonitorSceneType type, QSize p
QObject::connect(root, SIGNAL(effectPolygonChanged()), this, SLOT(effectRotoChanged()), Qt::UniqueConnection);
root->setProperty("profile", QPoint(profile.width(), profile.height()));
root->setProperty("framesize", QRect(0, 0, profile.width(), profile.height()));
root->setProperty("scalex", (double)displayRect.width() / profile.width() * zoom);
root->setProperty("scaley", (double)displayRect.width() / profileStretch / profile.width() * zoom);
root->setProperty("scalex", scalex);
root->setProperty("scaley", scaley);
root->setProperty("stretch", profileStretch);
root->setProperty("center", displayRect.center());
break;
......@@ -95,8 +98,8 @@ void QmlManager::setScene(Kdenlive::MonitorId id, MonitorSceneType type, QSize p
m_view->setSource(QUrl(QStringLiteral("qrc:/qml/kdenlivemonitorsplit.qml")));
root = m_view->rootObject();
root->setProperty("profile", QPoint(profile.width(), profile.height()));
root->setProperty("scalex", (double)displayRect.width() / profile.width() * zoom);
root->setProperty("scaley", (double)displayRect.width() / profileStretch / profile.width() * zoom);
root->setProperty("scalex", scalex);
root->setProperty("scaley", scaley);
break;
case MonitorSceneRipple:
m_view->setSource(QUrl(QStringLiteral("qrc:/qml/kdenlivemonitorripple.qml")));
......@@ -107,8 +110,8 @@ void QmlManager::setScene(Kdenlive::MonitorId id, MonitorSceneType type, QSize p
QUrl(id == Kdenlive::ClipMonitor ? QStringLiteral("qrc:/qml/kdenliveclipmonitor.qml") : QStringLiteral("qrc:/qml/kdenlivemonitor.qml")));
root = m_view->rootObject();
root->setProperty("profile", QPoint(profile.width(), profile.height()));
root->setProperty("scalex", (double)displayRect.width() / profile.width() * zoom);
root->setProperty("scaley", (double)displayRect.width() / profileStretch / profile.width() * zoom);
root->setProperty("scalex", scalex);
root->setProperty("scaley", scaley);
break;
}
if (root && duration > 0) {
......
Markdown is supported
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