summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-07-27 05:21:51 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-07-27 05:21:51 (GMT)
commit71f1a81d6f0cbc3c355885a1e65b58feffa97bf6 (patch)
tree114c79fc21655f2ea8dd44f0d3f47bf32e7a5067 /tools
parent903bc78d79a3f8536d61fd247b73939e80fd8bce (diff)
downloadQt-71f1a81d6f0cbc3c355885a1e65b58feffa97bf6.zip
Qt-71f1a81d6f0cbc3c355885a1e65b58feffa97bf6.tar.gz
Qt-71f1a81d6f0cbc3c355885a1e65b58feffa97bf6.tar.bz2
Optimize video frame grabbing.
Use QWidget::render instead of QPixmap::grabWidget
Diffstat (limited to 'tools')
-rw-r--r--tools/qmlviewer/qmlviewer.cpp5
-rw-r--r--tools/qmlviewer/qmlviewer.h1
2 files changed, 4 insertions, 2 deletions
diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp
index bc1333c..f4eff46 100644
--- a/tools/qmlviewer/qmlviewer.cpp
+++ b/tools/qmlviewer/qmlviewer.cpp
@@ -550,6 +550,7 @@ void QmlViewer::setRecording(bool on)
QProcess *proc = new QProcess(this);
connect(proc, SIGNAL(finished(int)), this, SLOT(ffmpegFinished(int)));
frame_stream = proc;
+ frame = QImage(canvas->width(),canvas->height(),QImage::Format_RGB32);
QStringList args;
args << "-sameq"; // ie. high
@@ -658,11 +659,11 @@ void QmlViewer::ffmpegFinished(int code)
void QmlViewer::timerEvent(QTimerEvent *event)
{
if (event->timerId() == recordTimer.timerId()) {
+ canvas->QWidget::render(&frame);
if (frame_stream) {
- QImage frame = QPixmap::grabWidget(canvas).toImage();
frame_stream->write((char*)frame.bits(),frame.numBytes());
} else {
- frames.append(new QImage(QPixmap::grabWidget(canvas).toImage()));
+ frames.append(new QImage(frame));
}
if (record_autotime && autoTimer.elapsed() >= record_autotime)
setRecording(false);
diff --git a/tools/qmlviewer/qmlviewer.h b/tools/qmlviewer/qmlviewer.h
index 62ee908..d671410 100644
--- a/tools/qmlviewer/qmlviewer.h
+++ b/tools/qmlviewer/qmlviewer.h
@@ -79,6 +79,7 @@ private:
QmlPalette *palette;
QmlPalette *disabledPalette;
QBasicTimer recordTimer;
+ QImage frame;
QList<QImage*> frames;
QProcess* frame_stream;
QBasicTimer autoStartTimer;