Merge branch 'master' into plasma/mart/PageRow
This commit is contained in:
commit
724d96a81d
@ -105,6 +105,7 @@ void QImageItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
|
|||||||
painter->setRenderHint(QPainter::Antialiasing, m_smooth);
|
painter->setRenderHint(QPainter::Antialiasing, m_smooth);
|
||||||
painter->setRenderHint(QPainter::SmoothPixmapTransform, m_smooth);
|
painter->setRenderHint(QPainter::SmoothPixmapTransform, m_smooth);
|
||||||
|
|
||||||
|
QRect sourceRect = m_image.rect();
|
||||||
QRect destRect;
|
QRect destRect;
|
||||||
switch (m_fillMode) {
|
switch (m_fillMode) {
|
||||||
case PreserveAspectFit: {
|
case PreserveAspectFit: {
|
||||||
@ -112,13 +113,13 @@ void QImageItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
|
|||||||
|
|
||||||
scaled.scale(boundingRect().size().toSize(), Qt::KeepAspectRatio);
|
scaled.scale(boundingRect().size().toSize(), Qt::KeepAspectRatio);
|
||||||
destRect = QRect(QPoint(0, 0), scaled);
|
destRect = QRect(QPoint(0, 0), scaled);
|
||||||
|
destRect.moveCenter(boundingRect().center().toPoint());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PreserveAspectCrop: {
|
case PreserveAspectCrop: {
|
||||||
painter->setClipRect(boundingRect(), Qt::IntersectClip);
|
destRect = boundingRect().toRect();
|
||||||
QSize scaled = m_image.size();
|
sourceRect = destRect;
|
||||||
scaled.scale(boundingRect().size().toSize(), Qt::KeepAspectRatioByExpanding);
|
sourceRect.moveCenter(m_image.rect().center());
|
||||||
destRect = QRect(QPoint(0, 0), scaled);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TileVertically: {
|
case TileVertically: {
|
||||||
@ -142,7 +143,7 @@ void QImageItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
|
|||||||
if (m_fillMode >= Tile) {
|
if (m_fillMode >= Tile) {
|
||||||
painter->drawTiledPixmap(destRect, QPixmap::fromImage(m_image));
|
painter->drawTiledPixmap(destRect, QPixmap::fromImage(m_image));
|
||||||
} else {
|
} else {
|
||||||
painter->drawImage(destRect, m_image, m_image.rect());
|
painter->drawImage(destRect, m_image, sourceRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
painter->restore();
|
painter->restore();
|
||||||
|
@ -105,6 +105,7 @@ void QPixmapItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *optio
|
|||||||
painter->setRenderHint(QPainter::Antialiasing, m_smooth);
|
painter->setRenderHint(QPainter::Antialiasing, m_smooth);
|
||||||
painter->setRenderHint(QPainter::SmoothPixmapTransform, m_smooth);
|
painter->setRenderHint(QPainter::SmoothPixmapTransform, m_smooth);
|
||||||
|
|
||||||
|
QRect sourceRect = m_pixmap.rect();
|
||||||
QRect destRect;
|
QRect destRect;
|
||||||
switch (m_fillMode) {
|
switch (m_fillMode) {
|
||||||
case PreserveAspectFit: {
|
case PreserveAspectFit: {
|
||||||
@ -112,13 +113,13 @@ void QPixmapItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *optio
|
|||||||
|
|
||||||
scaled.scale(boundingRect().size().toSize(), Qt::KeepAspectRatio);
|
scaled.scale(boundingRect().size().toSize(), Qt::KeepAspectRatio);
|
||||||
destRect = QRect(QPoint(0, 0), scaled);
|
destRect = QRect(QPoint(0, 0), scaled);
|
||||||
|
destRect.moveCenter(boundingRect().center().toPoint());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PreserveAspectCrop: {
|
case PreserveAspectCrop: {
|
||||||
painter->setClipRect(boundingRect(), Qt::IntersectClip);
|
destRect = boundingRect().toRect();
|
||||||
QSize scaled = m_pixmap.size();
|
sourceRect = destRect;
|
||||||
scaled.scale(boundingRect().size().toSize(), Qt::KeepAspectRatioByExpanding);
|
sourceRect.moveCenter(m_pixmap.rect().center());
|
||||||
destRect = QRect(QPoint(0, 0), scaled);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TileVertically: {
|
case TileVertically: {
|
||||||
|
Loading…
Reference in New Issue
Block a user