wrong aspect ratio scaling fixed
This commit is contained in:
parent
9882dc61ee
commit
fff0389262
@ -102,32 +102,34 @@ QskBoxShapeMetrics QskBoxShapeMetrics::toAbsolute( const QSizeF& size ) const no
|
|||||||
{
|
{
|
||||||
auto& radius = absoluted.m_radii[ i ];
|
auto& radius = absoluted.m_radii[ i ];
|
||||||
|
|
||||||
const qreal rx = qskAbsoluted( size.width(), radius.width() );
|
qreal rx = qskAbsoluted( size.width(), radius.width() );
|
||||||
const qreal ry = qskAbsoluted( size.height(), radius.height() );
|
qreal ry = qskAbsoluted( size.height(), radius.height() );
|
||||||
|
|
||||||
switch ( m_aspectRatioMode )
|
if ( rx <= 0.0 || ry <= 0.0 )
|
||||||
{
|
{
|
||||||
case Qt::IgnoreAspectRatio:
|
radius.rwidth() = radius.rheight() = 0.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( m_aspectRatioMode != Qt::IgnoreAspectRatio )
|
||||||
{
|
{
|
||||||
radius.rwidth() = rx;
|
if ( ( m_aspectRatioMode == Qt::KeepAspectRatioByExpanding ) &&
|
||||||
radius.rheight() = ry;
|
( radius.width() >= radius.height() ) )
|
||||||
break;
|
{
|
||||||
}
|
rx = ry * radius.width() / radius.height();
|
||||||
case Qt::KeepAspectRatio:
|
}
|
||||||
{
|
else
|
||||||
radius.rwidth() = std::min( rx, ry );
|
{
|
||||||
radius.rheight() = std::min( rx, ry );
|
ry = rx * radius.height() / radius.width();
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
case Qt::KeepAspectRatioByExpanding:
|
|
||||||
{
|
|
||||||
radius.rwidth() = std::max( rx, ry );
|
|
||||||
radius.rheight() = std::max( rx, ry );
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
radius.rwidth() = rx;
|
||||||
|
radius.rheight() = ry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
absoluted.m_sizeMode = Qt::AbsoluteSize;
|
absoluted.m_sizeMode = Qt::AbsoluteSize;
|
||||||
|
|
||||||
return absoluted;
|
return absoluted;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user