forked from qt-creator/qt-creator
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 <eike.ziller@qt.io>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user