void ContentWindowController::_constrainAspectRatio( QSizeF& windowSize ) const
{
    const QSizeF currentSize = _contentWindow->getCoordinates().size();
    const auto mode = windowSize < currentSize ?
                           Qt::KeepAspectRatio : Qt::KeepAspectRatioByExpanding;
    windowSize = currentSize.scaled( windowSize, mode );
}
void ContentWindowController::_snapToContentAspectRatio( QSizeF&
                                                         windowSize ) const
{
    const QSizeF contentSize( _contentWindow->getContent()->getDimensions( ));
    const auto mode = windowSize < contentSize ?
                       Qt::KeepAspectRatio : Qt::KeepAspectRatioByExpanding;
    windowSize = contentSize.scaled( windowSize, mode );
}
Пример #3
0
QRect ARenderPrivate::fitRect(QSize size, QRect rect)
{
	QRect dest;
	QSizeF s = videoAspectRatio > 0 ? QSizeF(videoAspectRatio, 1) : QSizeF(size);
	dest.setSize(s.scaled(rect.size(), Qt::KeepAspectRatio).toSize() / 4 * 4);
	dest.moveCenter(rect.center());
	return dest;
}
QSizeF ContentWindowController::getMaxContentSize() const
{
    QSizeF maxContentSize = _contentWindow->getContent()->getMaxDimensions();
    if( maxContentSize.isValid( ))
        return maxContentSize;

    maxContentSize = _contentWindow->getContent()->getDimensions();
    return maxContentSize.scaled( _displayGroup->getCoordinates().size(),
                                  Qt::KeepAspectRatioByExpanding );
}