qv4l2: QImage could be the wrong size
authorHans Verkuil <hans.verkuil@cisco.com>
Sat, 19 Jul 2014 22:23:46 +0000 (00:23 +0200)
committerHans Verkuil <hans.verkuil@cisco.com>
Sat, 19 Jul 2014 22:23:46 +0000 (00:23 +0200)
The QImage should be re-created every time the resolution changes, but
sometimes that didn't happen due to bad condition. Updated the condition
ensuring a correct QImage.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
utils/qv4l2/capture-win-qt.cpp

index 7891ed3..db85cd2 100644 (file)
@@ -60,7 +60,9 @@ void CaptureWinQt::setRenderFrame()
        if (!m_supportedFormat)
                dstFmt = QImage::Format_RGB888;
 
-       if (m_frame.updated || m_image->format() != dstFmt) {
+       if (m_frame.updated || m_image->format() != dstFmt ||
+           m_image->width() != m_frame.size.width() ||
+           m_image->height() != m_frame.size.height()) {
                delete m_image;
                m_image = new QImage(m_frame.size.width(),
                                     m_frame.size.height(),
@@ -91,7 +93,6 @@ void CaptureWinQt::paintFrame()
                        m_filled = true;
                        m_image->fill(0);
                        QPixmap img = QPixmap::fromImage(*m_image);
-                       printf("%d %d\n", img.width(), img.height());
                        m_videoSurface->setPixmap(img);
                }
                return;