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:
Sebastian Kügler 2014-02-13 04:26:34 +01:00
parent a8e31e1593
commit 566e2a8a42

View File

@ -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: {