Fix QPixmapItem::PreserveAspectCrop
This case was broken and would scale the image, while what we want is a centered piece, from Qt::KeepAspectRatioByExpanding.
This commit is contained in:
parent
a8e31e1593
commit
566e2a8a42
@ -114,9 +114,11 @@ void QPixmapItem::paint(QPainter *painter)
|
||||
break;
|
||||
}
|
||||
case PreserveAspectCrop: {
|
||||
destRect = boundingRect().toRect();
|
||||
sourceRect = destRect;
|
||||
sourceRect.moveCenter(m_pixmap.rect().center());
|
||||
QSize scaled = m_pixmap.size();
|
||||
|
||||
scaled.scale(boundingRect().size().toSize(), Qt::KeepAspectRatioByExpanding);
|
||||
destRect = QRect(QPoint(0, 0), scaled);
|
||||
destRect.moveCenter(boundingRect().center().toPoint());
|
||||
break;
|
||||
}
|
||||
case TileVertically: {
|
||||
|
Loading…
Reference in New Issue
Block a user