Commit ce088cb7 authored by Friedemann Kleint's avatar Friedemann Kleint

Call QPainter::end() prior to QPixmapCache::insert()

Inserting a QPixmap with active painters on it causes it to
do a deep copy of it, which is unnecessary.

Task-number: QTBUG-58653
Change-Id: I49123ffcec2e12a01c87974b7a513d68a11185d4
Reviewed-by: Eike Ziller's avatarEike Ziller <eike.ziller@qt.io>
parent 148e793d
......@@ -455,6 +455,7 @@ void StyleHelper::drawIconWithShadow(const QIcon &icon, const QRect &rect,
// Draw the actual pixmap...
cachePainter.drawPixmap(QRect(QPoint(radius, radius) + offset, QSize(px.width(), px.height())), px);
cachePainter.end();
cache.setDevicePixelRatio(devicePixelRatio);
QPixmapCache::insert(pixmapName, cache);
}
......
......@@ -326,6 +326,7 @@ void FancyToolButton::hoverOverlay(QPainter *painter, const QRect &spanRect)
p.setPen(QPen(grad, 1.0));
p.drawLine(borderRect.topLeft(), borderRect.topRight());
p.drawLine(borderRect.bottomLeft(), borderRect.bottomRight());
p.end();
QPixmapCache::insert(cacheKey, overlay);
}
......
......@@ -273,6 +273,7 @@ static void paintSelectedTabBackground(QPainter *painter, const QRect &spanRect)
p.drawLine(borderRect.topLeft() + QPointF(0, 0), borderRect.topRight());
p.drawLine(borderRect.topRight() + QPointF(0, 1), borderRect.bottomRight() - QPointF(0, 1));
p.drawLine(borderRect.bottomLeft() + QPointF(0, -1), borderRect.bottomRight() - QPointF(0, 1));
p.end();
QPixmapCache::insert(cacheKey, selection);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment