diff --git a/source/app/ViewArea.cpp b/source/app/ViewArea.cpp index a038fd2..09d11b4 100755 --- a/source/app/ViewArea.cpp +++ b/source/app/ViewArea.cpp @@ -53,6 +53,7 @@ ViewArea::ViewArea( QWidget *parent ) : // setAttribute( Qt::WA_NoBackground ); setMouseTracking( true ); + m_pcCurrFrame = NULL; m_pixmap = QPixmap(); m_grid = GridManager(); m_mask = QBitmap(); @@ -70,8 +71,9 @@ ViewArea::ViewArea( QWidget *parent ) : void ViewArea::setImage( PlaYUVerFrame* pcFrame ) { - pcFrame->FrametoRGB8(); - QImage qimg = QImage( pcFrame->getQImageBuffer(), pcFrame->getWidth(), pcFrame->getHeight(), QImage::Format_RGB888 ); + m_pcCurrFrame = pcFrame; + m_pcCurrFrame->FrametoRGB8(); + QImage qimg = QImage( m_pcCurrFrame->getQImageBuffer(), m_pcCurrFrame->getWidth(), m_pcCurrFrame->getHeight(), QImage::Format_RGB888 ); setImage( QPixmap::fromImage( qimg ) ); } @@ -363,7 +365,6 @@ void ViewArea::paintEvent( QPaintEvent *event ) { Int imageWidth = m_pixmap.width(); Int imageHeight = m_pixmap.height(); - PlaYUVerFrame *curFrame = getInputStream()->getCurrFrame(); Pixel sPixelValue; QFont font("Helvetica"); @@ -378,7 +379,7 @@ void ViewArea::paintEvent( QPaintEvent *event ) for(Int j=vr.y() ; j<=vr.bottom() ; j++) { QPoint pixelTopLeft(i,j); - sPixelValue = curFrame->getPixelValue( pixelTopLeft, PlaYUVerFrame::COLOR_YUV ); + sPixelValue = m_pcCurrFrame->getPixelValue( pixelTopLeft, PlaYUVerFrame::COLOR_YUV ); QRect pixelRect(viewToWindow(pixelTopLeft), QSize(m_zoomFactor,m_zoomFactor)); if( sPixelValue.Luma < 128 ) @@ -611,7 +612,7 @@ void ViewArea::mouseMoveEvent( QMouseEvent *event ) QPoint actualPos = windowToView( event->pos() ); QRect updateRect; - emit positionChanged( actualPos , getInputStream() ); + emit positionChanged( actualPos , m_pcCurrFrame ); // If mouse left button pressed if( event->buttons() == Qt::LeftButton && m_lastPos != QPoint( -1, -1 ) ) diff --git a/source/app/ViewArea.h b/source/app/ViewArea.h index ecc9f3f..86a8e20 100755 --- a/source/app/ViewArea.h +++ b/source/app/ViewArea.h @@ -110,7 +110,7 @@ public: signals: void selectionChanged( const QRect &rect ); - void positionChanged( const QPoint &pos, InputStream *stream ); + void positionChanged( const QPoint &pos, PlaYUVerFrame *frame ); void moveScroll( QPoint offset ); void zoomFactorChanged( double factor , QPoint center); @@ -148,6 +148,7 @@ private: QPoint viewToWindow( const QPoint& pt ) const; QRect viewToWindow( const QRect& rc ) const; + PlaYUVerFrame *m_pcCurrFrame; QPixmap m_pixmap; QBitmap m_mask; QRect m_selectedArea; diff --git a/source/app/plaYUVerApp.cpp b/source/app/plaYUVerApp.cpp index a09f2e4..9b39ace 100644 --- a/source/app/plaYUVerApp.cpp +++ b/source/app/plaYUVerApp.cpp @@ -147,10 +147,10 @@ Void plaYUVerApp::loadFile( QString fileName ) mdiArea->addSubWindow( interfaceChild ); statusBar()->showMessage( tr( "File loaded" ), 2000 ); interfaceChild->show(); - connect( interfaceChild->getViewArea(), SIGNAL( positionChanged(const QPoint &, InputStream *) ), this, - SLOT( updatePixelValueStatusBar(const QPoint &, InputStream *) ) ); + connect( interfaceChild->getViewArea(), SIGNAL( positionChanged(const QPoint &, PlaYUVerFrame *) ), this, + SLOT( updatePixelValueStatusBar(const QPoint &, PlaYUVerFrame *) ) ); // connect( interfaceChild->getViewArea(), SIGNAL( selectionChanged( QRect ) ), this, -// SLOT( updatePixelValueStatusBar(const QPoint &, InputStream *) ) ); +// SLOT( updatePixelValueStatusBar(const QPoint &, PlaYUVerFrame *) ) ); interfaceChild->zoomToFit(); interfaceChild->getViewArea()->setTool( m_appTool ); @@ -233,9 +233,9 @@ void plaYUVerApp::selectModule( QAction *curr_action ) mdiArea->addSubWindow( interfaceChild ); // connect( interfaceChild->getViewArea(), SIGNAL( positionChanged(const QPoint &, InputStream *) ), this, -// SLOT( updatePixelValueStatusBar(const QPoint &, InputStream *) ) ); +// SLOT( updatePixelValueStatusBar(const QPoint &, PlaYUVerFrame *) ) ); // connect( interfaceChild->getViewArea(), SIGNAL( selectionChanged( QRect ) ), this, - // SLOT( updatePixelValueStatusBar(const QPoint &, InputStream *) ) ); + // SLOT( updatePixelValueStatusBar(const QPoint &, PlaYUVerFrame *) ) ); m_pcCurrentSubWindow->setModuleSubWindow( interfaceChild ); m_pcCurrentSubWindow->enableModule( pcCurrMod ); interfaceChild->show(); @@ -582,17 +582,17 @@ void plaYUVerApp::chageSubWindowSelection() // ----------------------- Status bar Functions ----------------------- -void plaYUVerApp::updatePixelValueStatusBar( const QPoint & pos, InputStream* stream ) +void plaYUVerApp::updatePixelValueStatusBar( const QPoint & pos, PlaYUVerFrame* frame ) { Pixel sPixelValue; Int iWidth, iHeight; Int posX = pos.x(), posY = pos.y(); QString strPixel; QString strStatus = QString( "(%1,%2) " ).arg( posX ).arg( posY ); - PlaYUVerFrame *curFrame = stream->getCurrFrame(); + PlaYUVerFrame *curFrame = frame; - iWidth = stream->getWidth(); - iHeight = stream->getHeight(); + iWidth = frame->getWidth(); + iHeight = frame->getHeight(); if( ( posX < iWidth ) && ( posX >= 0 ) && ( posY < iHeight ) && ( posY >= 0 ) ) { diff --git a/source/app/plaYUVerApp.h b/source/app/plaYUVerApp.h index c6e0e1b..106a0be 100644 --- a/source/app/plaYUVerApp.h +++ b/source/app/plaYUVerApp.h @@ -97,7 +97,7 @@ private Q_SLOTS: void setActiveSubWindow( QWidget *window ); - void updatePixelValueStatusBar(const QPoint & pos, InputStream* stream); + void updatePixelValueStatusBar( const QPoint & pos, PlaYUVerFrame* frame ); void updatePropertiesSelectedArea( QRect area );