From 0d2f6432e7400dac20c71a01806cd787e5940eb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 18 Mar 2010 14:30:36 +0100 Subject: Fixed performance issues when falling back to raster for sub-pixmaps. Copy the sub-pixmap so that we don't need to convert the entire pixmap to a QImage each time. Reviewed-by: Gunnar Sletta --- src/gui/painting/qpainter.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index a1ed8f5..db4ace4 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -5414,10 +5414,15 @@ void QPainter::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) scale(w / sw, h / sh); setBackgroundMode(Qt::TransparentMode); setRenderHint(Antialiasing, renderHints() & SmoothPixmapTransform); - QBrush brush(d->state->pen.color(), pm); + QBrush brush; + + if (sw == pm.width() && sh == pm.height()) + brush = QBrush(d->state->pen.color(), pm); + else + brush = QBrush(d->state->pen.color(), pm.copy(sx, sy, sw, sh)); + setBrush(brush); setPen(Qt::NoPen); - setBrushOrigin(QPointF(-sx, -sy)); drawRect(QRectF(0, 0, sw, sh)); restore(); -- cgit v0.12