diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2010-03-18 13:30:36 (GMT) |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2010-03-22 12:44:26 (GMT) |
commit | 0d2f6432e7400dac20c71a01806cd787e5940eb2 (patch) | |
tree | 90d8e591e8de1a4e6545ca91faa1ad18f370f883 /src | |
parent | 51a98a583b33585a4dcf918cd8567978bf7c20ae (diff) | |
download | Qt-0d2f6432e7400dac20c71a01806cd787e5940eb2.zip Qt-0d2f6432e7400dac20c71a01806cd787e5940eb2.tar.gz Qt-0d2f6432e7400dac20c71a01806cd787e5940eb2.tar.bz2 |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/painting/qpainter.cpp | 9 |
1 files 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(); |