
Originally Posted by
gnuton
Looking at the MeeGo graphics system plugin [1] I can see those lines:
QEglProperties *properties = new QEglProperties();
properties->setValue(EGL_FIXED_WIDTH_NOK, width);
properties->setValue(EGL_FIXED_HEIGHT_NOK, height);
Where those are defined here [2] as:
#define EGL_FIXED_WIDTH_NOK 0x30DB
#define EGL_FIXED_HEIGHT_NOK 0x30DC
So, maybe 12000x12000 is maximum "allowed" size to not fall into performance penalty.
[1]
https://qt.gitorious.org/+grym/qt/gr...hicssystem.cpp
[2]
http://svn.netlabs.org/repos/qt4/tru...goextensions.h
OK, may be I'm wrong with that... However performance penalty is really exists. I wrapped call to drawImage() this way:
Code:
qint64 msec = QDateTime::currentMSecsSinceEpoch();
painter->drawImage(option->exposedRect, ScaledCurrentImage, option->exposedRect);
qDebug(QString("Image: %1 %2, exposedRect: %3 %4 %5 %6, drawImage time: %7").arg(ScaledCurrentImage.width()).arg(ScaledCurrentImage.height()).arg(option->exposedRect.x()).arg(option->exposedRect.y()).arg(option->exposedRect.width()).arg(option->exposedRect.height()).arg(QDateTime::currentMSecsSinceEpoch() - msec).toAscii());
On small QImage the following results are observed:
Code:
Image: 674 592, exposedRect: 0 0 480 592, drawImage time: 10
Image: 674 592, exposedRect: 0 0 480 592, drawImage time: 10
Image: 674 592, exposedRect: 0 0 480 592, drawImage time: 18
Image: 674 592, exposedRect: 0 0 480 592, drawImage time: 12
Image: 674 592, exposedRect: 0 0 480 592, drawImage time: 14
Image: 674 592, exposedRect: 0 0 480 592, drawImage time: 14
But on scaled (bigger) version of the same QImage we see the following:
Code:
Image: 1348 1184, exposedRect: 0 0 480 803, drawImage time: 36
Image: 1348 1184, exposedRect: 0 0 480 803, drawImage time: 45
Image: 1348 1184, exposedRect: 0 0 480 803, drawImage time: 42
Image: 1348 1184, exposedRect: 0 0 480 803, drawImage time: 43
Image: 1348 1184, exposedRect: 0 0 480 803, drawImage time: 42
Image: 1348 1184, exposedRect: 0 0 480 803, drawImage time: 41
Image: 1348 1184, exposedRect: 0 0 480 803, drawImage time: 40
We have about 3x performance penalty when drawing almost the same exposedRect! It seems, however, that problem lies in some preparations that Qt makes before painting an image, because I change QImage just before every draw. If I comment out this in my code, the results will be as follows:
Code:
Image: 674 592, exposedRect: 0 0 480 592, drawImage time: 13
Image: 674 592, exposedRect: 0 0 480 592, drawImage time: 0
Image: 674 592, exposedRect: 0 0 480 592, drawImage time: 0
Image: 674 592, exposedRect: 0 0 480 592, drawImage time: 0
Image: 674 592, exposedRect: 0 0 480 592, drawImage time: 0
Image: 674 592, exposedRect: 0 0 480 592, drawImage time: 0
Image: 674 592, exposedRect: 0 0 480 592, drawImage time: 0
Code:
Image: 1348 1184, exposedRect: 0 0 480 803, drawImage time: 45
Image: 1348 1184, exposedRect: 0 0 480 803, drawImage time: 0
Image: 1348 1184, exposedRect: 0 0 480 803, drawImage time: 0
Image: 1348 1184, exposedRect: 0 0 480 803, drawImage time: 1
Image: 1348 1184, exposedRect: 0 0 480 803, drawImage time: 0
Image: 1348 1184, exposedRect: 0 0 480 803, drawImage time: 1
Image: 1348 1184, exposedRect: 0 0 480 803, drawImage time: 0
Image: 1348 1184, exposedRect: 0 0 480 803, drawImage time: 0
As you can see, first call takes the same time, but consequent calls are take almost zero time. Can I somehow "help" Qt to prepare images for drawing? I tried to alter QImage format, but there was no result at all.