Reduce the use of C-pointers in CalypFrame and CalypStream
This commit is contained in:
@@ -579,7 +579,7 @@ void ModulesHandle::applyAllModuleIf( CalypAppModuleIf* pcCurrModuleIf )
|
||||
{
|
||||
pcCurrModuleIf->apply( false, true );
|
||||
QCoreApplication::processEvents();
|
||||
pcCurrModuleIf->m_pcModuleStream->writeFrame( pcCurrModuleIf->m_pcProcessedFrame );
|
||||
pcCurrModuleIf->m_pcModuleStream->writeFrame( *pcCurrModuleIf->m_pcProcessedFrame );
|
||||
for( unsigned int i = 0; i < numberOfWindows; i++ )
|
||||
{
|
||||
pcCurrModuleIf->m_pcSubWindow[i]->play();
|
||||
|
||||
@@ -800,7 +800,7 @@ bool VideoSubWindow::save( QString filename )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
iRet = CalypStream::saveFrame( filename.toStdString(), saveFrame );
|
||||
iRet = CalypStream::saveFrame( filename.toStdString(), *saveFrame );
|
||||
QApplication::restoreOverrideCursor();
|
||||
return iRet;
|
||||
}
|
||||
|
||||
@@ -365,7 +365,7 @@ void FramePropertiesDock::setFrame( CalypFrame* pcFrame, bool isPlaying )
|
||||
if( pcFrame )
|
||||
{
|
||||
m_bHasFrame = true;
|
||||
m_cFrame = CalypFrame( pcFrame );
|
||||
m_pcFrame = std::make_shared<CalypFrame>( *pcFrame );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -389,8 +389,10 @@ void FramePropertiesDock::setSelection( const QRect& selectionArea )
|
||||
*/
|
||||
if( bSelectionChanged )
|
||||
{
|
||||
m_cSelectedFrame = CalypFrame( m_cFrame, selectionArea.x(), selectionArea.y(), selectionArea.width(),
|
||||
selectionArea.height() );
|
||||
m_pcSelectedFrame = std::make_shared<CalypFrame>( *m_pcFrame, selectionArea.x(),
|
||||
selectionArea.y(),
|
||||
selectionArea.width(),
|
||||
selectionArea.height() );
|
||||
}
|
||||
updateDataHistogram();
|
||||
selectionImageButton->click();
|
||||
@@ -413,7 +415,11 @@ void FramePropertiesDock::updateDataHistogram()
|
||||
{
|
||||
if( m_cSelectionArea.isValid() )
|
||||
{
|
||||
m_cSelectedFrame = CalypFrame( m_cFrame, m_cSelectionArea.x(), m_cSelectionArea.y(), m_cSelectionArea.width(), m_cSelectionArea.height() );
|
||||
m_pcSelectedFrame = std::make_shared<CalypFrame>( *m_pcFrame,
|
||||
m_cSelectionArea.x(),
|
||||
m_cSelectionArea.y(),
|
||||
m_cSelectionArea.width(),
|
||||
m_cSelectionArea.height() );
|
||||
fullImageButton->show();
|
||||
selectionImageButton->show();
|
||||
}
|
||||
@@ -422,7 +428,7 @@ void FramePropertiesDock::updateDataHistogram()
|
||||
fullImageButton->hide();
|
||||
selectionImageButton->hide();
|
||||
}
|
||||
histogramWidget->updateData( &m_cFrame, m_cSelectionArea.isValid() ? &m_cSelectedFrame : nullptr );
|
||||
histogramWidget->updateData( m_pcFrame, m_cSelectionArea.isValid() ? m_pcSelectedFrame : nullptr );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -448,7 +454,7 @@ void FramePropertiesDock::updateStatistiques()
|
||||
if( channel == CalypFrame::HIST_ALL_CHANNELS )
|
||||
channel = colorsCB->itemData( colorsCB->currentIndex() ).toInt();
|
||||
|
||||
CalypFrame* frame;
|
||||
std::shared_ptr<CalypFrame> frame;
|
||||
|
||||
if( histogramWidget->m_renderingType == HistogramWidget::FullImageHistogram )
|
||||
frame = histogramWidget->m_fullImage;
|
||||
|
||||
@@ -49,8 +49,8 @@ public:
|
||||
void stopHistogram();
|
||||
|
||||
private:
|
||||
CalypFrame m_cFrame;
|
||||
CalypFrame m_cSelectedFrame;
|
||||
std::shared_ptr<CalypFrame> m_pcFrame;
|
||||
std::shared_ptr<CalypFrame> m_pcSelectedFrame;
|
||||
int m_iLastFrameType;
|
||||
bool m_bIsPlaying;
|
||||
bool m_bHasFrame;
|
||||
|
||||
@@ -41,24 +41,23 @@ class HistogramWorker : public QThread
|
||||
{
|
||||
private:
|
||||
QObject* m_parent;
|
||||
CalypFrame* m_pcFrame;
|
||||
std::shared_ptr<CalypFrame> m_pcFrame;
|
||||
|
||||
public:
|
||||
HistogramWorker( QObject* parent )
|
||||
{
|
||||
m_pcFrame = NULL;
|
||||
m_parent = parent;
|
||||
}
|
||||
|
||||
void setup( CalypFrame* frame )
|
||||
void setup( std::shared_ptr<CalypFrame> frame )
|
||||
{
|
||||
m_pcFrame = frame;
|
||||
//run();
|
||||
start();
|
||||
run();
|
||||
//start();
|
||||
}
|
||||
void run()
|
||||
{
|
||||
if( m_pcFrame && m_parent )
|
||||
if( m_pcFrame != nullptr && m_parent != nullptr )
|
||||
{
|
||||
EventData* eventData = new EventData();
|
||||
eventData->starting = true;
|
||||
@@ -86,7 +85,7 @@ public:
|
||||
|
||||
bool starting;
|
||||
bool success;
|
||||
CalypFrame* frame;
|
||||
std::shared_ptr<CalypFrame> frame;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -371,7 +370,7 @@ void HistogramWidget::stopHistogramComputation()
|
||||
// Update Data Methods
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void HistogramWidget::updateData( CalypFrame* pcFrame, CalypFrame* pcFrameSelection )
|
||||
void HistogramWidget::updateData( std::shared_ptr<CalypFrame> pcFrame, std::shared_ptr<CalypFrame> pcFrameSelection )
|
||||
{
|
||||
d->imageBits = pcFrame->getBitsPel();
|
||||
switch( pcFrame->getColorSpace() )
|
||||
@@ -489,7 +488,7 @@ void HistogramWidget::paintEvent( QPaintEvent* )
|
||||
int wWidth = width() - 1;
|
||||
int wHeight = height() - 1;
|
||||
double max;
|
||||
CalypFrame* frame;
|
||||
std::shared_ptr<CalypFrame> frame;
|
||||
|
||||
if( m_renderingType == ImageSelectionHistogram && m_selectionImage )
|
||||
frame = m_selectionImage;
|
||||
|
||||
@@ -90,7 +90,7 @@ public:
|
||||
void stopHistogramComputation();
|
||||
|
||||
/** Update full image histogram data. */
|
||||
void updateData( CalypFrame* pcFrame, CalypFrame* pcFrameSelection );
|
||||
void updateData( std::shared_ptr<CalypFrame> pcFrame, std::shared_ptr<CalypFrame> pcFrameSelection );
|
||||
|
||||
/** @see @p HistogramOption */
|
||||
void setOptions( HistogramOptions options = AllOptions );
|
||||
@@ -113,12 +113,10 @@ public:
|
||||
|
||||
/** Full image */
|
||||
HistogramWorker* m_imageWorker;
|
||||
// CalypFrameStats* m_imageHistogram;
|
||||
CalypFrame* m_fullImage;
|
||||
std::shared_ptr<CalypFrame> m_fullImage;
|
||||
/** Histogram area selection */
|
||||
HistogramWorker* m_selectionWorker;
|
||||
// CalypFrameStats* m_selectionHistogram;
|
||||
CalypFrame* m_selectionImage;
|
||||
std::shared_ptr<CalypFrame> m_selectionImage;
|
||||
|
||||
Q_SIGNALS:
|
||||
void signalintervalChanged( int min, int max );
|
||||
|
||||
Reference in New Issue
Block a user