- if (cbMagnify->isChecked()) {
- m_scaling = 1.4;
- } else {
- m_scaling = 1;
- }
- prodCalcThread();
-}
-
-void Vectorscope::slotActiveMonitorChanged(bool isClipMonitor)
-{
- if (isClipMonitor) {
- m_activeRender = m_clipMonitor->render;
- disconnect(this, SLOT(slotRenderZoneUpdated()));
- connect(m_activeRender, SIGNAL(rendererPosition(int)), this, SLOT(slotRenderZoneUpdated()));
- } else {
- m_activeRender = m_projMonitor->render;
- disconnect(this, SLOT(slotRenderZoneUpdated()));
- connect(m_activeRender, SIGNAL(rendererPosition(int)), this, SLOT(slotRenderZoneUpdated()));
- }
-}
-
-void Vectorscope::slotRenderZoneUpdated()
-{
- qDebug() << "Monitor incoming. New frames total: " << newFrames << ", visible: " << this->isVisible();
- QRegion region = this->visibleRegion();
- qDebug() << "Visible region: empty? " << region.isEmpty() << ", size: " << region.boundingRect().width() << "x" << region.boundingRect().height();
- // Monitor has shown a new frame
- newFrames.fetchAndAddRelaxed(1);
- if (cbAutoRefresh->isChecked()) {
- prodCalcThread();
- }
-}
-
-void Vectorscope::slotScopeCalculationFinished(unsigned int mseconds, unsigned int skipPixels)
-{
- qDebug() << "Received finished signal.";
- if (!m_scopeCalcThread.isFinished()) {
- // Wait for the thread to finish. Otherwise the scope might not get updated
- // as prodCalcThread may see it still running.
- QTime start = QTime::currentTime();
- qDebug() << "Scope renderer has not finished yet although finished signal received, waiting ...";
- m_scopeCalcThread.waitForFinished();
- qDebug() << "Waiting for finish is over. Waited for " << start.msecsTo(QTime::currentTime()) << " ms";
- }
- semaphore.release();
-
- this->update();
- qDebug() << "Scope updated.";
-
- if (m_aRealtime->isChecked()) {
- m_skipPixels = ceil((float)REALTIME_FPS*mseconds*skipPixels/1000);
- Q_ASSERT(m_skipPixels >= 1);
- qDebug() << "Realtime checked. Switching from " << skipPixels << " to " << m_skipPixels;
-
- } else {
- qDebug() << "No realtime.";
- }
-
- // If auto-refresh is enabled and new frames are available,
- // just start the next calculation.
- if (newFrames > 0 && cbAutoRefresh->isChecked()) {
- qDebug() << "Found more frames in the queue (prodding now): " << newFrames;
- prodCalcThread();
- } else if (newChanges > 0) {
- qDebug() << newChanges << " changes (e.g. resize) in the meantime.";
- prodCalcThread();
- } else {
- qDebug() << newFrames << " new frames, " << newChanges << " new changes. Not updating.";
- }
-}
-
-void Vectorscope::slotWheelCalculationFinished()
-{
- if (!m_wheelCalcThread.isFinished()) {
- QTime start = QTime::currentTime();
- qDebug() << "Wheel calc has not finished yet, waiting ...";
- m_wheelCalcThread.waitForFinished();
- qDebug() << "Done. Waited for " << start.msecsTo(QTime::currentTime()) << " ms";
- }
-
- qDebug() << "Wheel calculated. Updating.";
- qDebug() << m_wheelCalcThread.resultCount() << " results from the Wheel thread.";
- if (m_wheelCalcThread.resultCount() > 0) {
- m_wheel = m_wheelCalcThread.resultAt(0);
- }
- this->update();
- if (newWheelChanges > 0) {
- prodWheelThread();
- }
-}
-
-void Vectorscope::slotUpdateScope()
-{
- prodCalcThread();
-}
-
-void Vectorscope::slotUpdateWheel()
-{
- prodWheelThread();