Skip to content

Commit d0943b8

Browse files
author
wonder
committedMar 19, 2006
Draw to QImage instead of QPixmap. When rendering is done, it's converted
to QPixmap for fast onscreen drawing. git-svn-id: http://svn.osgeo.org/qgis/trunk@5063 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 7c9442a commit d0943b8

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed
 

‎src/gui/qgsmapcanvasmap.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,22 @@ void QgsMapCanvasMap::resize(QSize size)
4242

4343
void QgsMapCanvasMap::render()
4444
{
45-
mPixmap.fill(mBgColor);
45+
// use temporary image for rendering
46+
QImage image(size(), QImage::Format_RGB32);
4647

47-
QPainter paint(&mPixmap);
48+
image.fill(mBgColor.rgb());
49+
50+
QPainter paint;
51+
paint.begin(&image);
4852

4953
// antialiasing
5054
if (mAntiAliasing)
5155
paint.setRenderHint(QPainter::Antialiasing);
5256

5357
mRender->render(&paint);
5458

59+
paint.end();
60+
61+
// convert QImage to QPixmap to acheive faster drawing on screen
62+
mPixmap = QPixmap::fromImage(image);
5563
}

0 commit comments

Comments
 (0)
Please sign in to comment.