void VideoRecordDialog::maybeRecord(RenderDevice* rd) { if (m_video) { recordFrame(rd); } if (m_screenshotPending) { screenshot(rd); m_screenshotPending = false; } }
void XDebugProfiler::beginFrame(const char *symbol) { assert(isNeeded()); // Check the stack depth, abort if we've reached the limit m_depth++; if (m_maxDepth != 0 && m_depth >= m_maxDepth) { raise_error("Maximum function nesting level of '%lu' reached, aborting!", m_maxDepth); } // Record the frame if we are collecting if (isCollecting()) { recordFrame(nullptr); } }
void XDebugProfiler::endFrame(const TypedValue* retVal, const char* /*symbol*/, bool /*endMain*/ /* = false */) { assert(isNeeded()); m_depth--; if (isCollecting()) { // If tracing or profiling are enabled, we need to store end frames as well. // Otherwise we can just overwrite the most recent begin frame if (m_tracingEnabled || m_profilingEnabled) { recordFrame(retVal); } else { m_nextFrameIdx--; } } }
int QDeclarativeViewer::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: setDesignModeBehavior((*reinterpret_cast< bool(*)>(_a[1]))); break; case 1: sceneResized((*reinterpret_cast< QSize(*)>(_a[1]))); break; case 2: { bool _r = open((*reinterpret_cast< const QString(*)>(_a[1]))); if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break; case 3: openFile(); break; case 4: openUrl(); break; case 5: reload(); break; case 6: takeSnapShot(); break; case 7: toggleRecording(); break; case 8: toggleRecordingWithSelection(); break; case 9: ffmpegFinished((*reinterpret_cast< int(*)>(_a[1]))); break; case 10: showProxySettings(); break; case 11: proxySettingsChanged(); break; case 12: rotateOrientation(); break; case 13: statusChanged(); break; case 14: pauseAnimations(); break; case 15: stepAnimations(); break; case 16: setAnimationStep(); break; case 17: changeAnimationSpeed(); break; case 18: launch((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 19: appAboutToQuit(); break; case 20: autoStartRecording(); break; case 21: autoStopRecording(); break; case 22: recordFrame(); break; case 23: chooseRecordingOptions(); break; case 24: pickRecordingFile(); break; case 25: toggleFullScreen(); break; case 26: changeOrientation((*reinterpret_cast< QAction*(*)>(_a[1]))); break; case 27: orientationChanged(); break; case 28: animationSpeedChanged((*reinterpret_cast< qreal(*)>(_a[1]))); break; case 29: showWarnings((*reinterpret_cast< bool(*)>(_a[1]))); break; case 30: warningsWidgetOpened(); break; case 31: warningsWidgetClosed(); break; default: ; } _id -= 32; } return _id; }
// Main draw function void SlamDriver::draw(void) { if(!mFrameByFrame || mAdvanceFrame) { bool isFrameAvailable; { ProfileSection section("updateFrame"); //Drop frames mImageSrc->dropFrames(FLAGS_DriverDropFrames); isFrameAvailable = mImageSrc->update(); } if(isFrameAvailable) { ProfileSection section("execute"); mFrameCount++; mAdvanceFrame = false; if (!mUsingCamera) DTSLAM_LOG << "\nFrame #" << mFrameCount << "\n"; //Read new input frame cv::Mat1b imageGray = mImageSrc->getImgGray(); cv::Mat3b imageColor = mImageSrc->getImgColor(); //Record if(mRecordFrames) recordFrame(imageColor); //Process new frame auto tic = std::chrono::high_resolution_clock::now(); mSlam.processImage(mImageSrc->getCaptureTime(), imageColor, imageGray); mFPSSampleAccum += std::chrono::high_resolution_clock::now()-tic; mFPSSampleCount++; mActiveWindow->updateState(); } } mSlam.idle(); { ProfileSection section("draw"); //glClearColor(1.0, 1.0, 1.0, 1.0); glClearColor(0.0, 0.0, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); { ProfileSection section("windowDraw"); mActiveWindow->draw(); } //Text std::stringstream ss; ss << "FPS " << (int)mFPS << "\n"; ss << "Frame " << mFrameCount << "\n"; if(mShowProfiler) { Profiler::Instance().logStats(ss); } cv::Size2i screenSize = UserInterfaceInfo::Instance().getScreenSize(); float viewportAspect = static_cast<float>(screenSize.width) / screenSize.height; glViewport(0,0,screenSize.width,screenSize.height); mShaders.getText().setMVPMatrix(ViewportTiler::GetImageSpaceMvp(viewportAspect, screenSize)); mShaders.getText().setActiveFontSmall(); mShaders.getText().setRenderCharHeight(10); mShaders.getText().setCaret(cv::Point2f(0,0)); mShaders.getText().setColor(StaticColors::Green()); mShaders.getText().renderText(ss); //Map stats in the bottom const float kMapStatsFontHeight = 10.0f; cv::Point2f corners[] = { cv::Point2f(0.0f, (float)screenSize.height - 2 * kMapStatsFontHeight), cv::Point2f((float)screenSize.width, (float)screenSize.height - 2 * kMapStatsFontHeight), cv::Point2f(0.0f, (float)screenSize.height), cv::Point2f((float)screenSize.width, (float)screenSize.height) }; mShaders.getColor().setMVPMatrix(ViewportTiler::GetImageSpaceMvp(viewportAspect, screenSize)); mShaders.getColor().drawVertices(GL_TRIANGLE_STRIP, corners, 4, StaticColors::Black(0.5f)); mShaders.getText().setRenderCharHeight(kMapStatsFontHeight); mShaders.getText().setCaret(corners[0] + cv::Point2f(kMapStatsFontHeight/2, kMapStatsFontHeight/2)); mShaders.getText().setColor(StaticColors::White()); { TextRendererStream ts(mShaders.getText()); int frameCount = mSlam.getMap().getTotalFrameCount(); int count3D = mSlam.getMap().getTotalFeature3DCount(); int count2D = mSlam.getMap().getTotalFeature2DCount(); if (!FLAGS_DisableRegions) ts << "Regions: " << mSlam.getMap().getRegions().size() << ", "; ts << "Keyframes: " << frameCount << ", Features (2D: " << count2D << ", 3D : " << count3D << ")"; switch (mSlam.getTracker().getPoseType() ) { case EPoseEstimationType::PureRotation: ts.setColor(StaticColors::Yellow()); ts << " PURE ROTATION"; break; case EPoseEstimationType::Essential: ts.setColor(StaticColors::Green()); ts << " ESSENTIAL MODEL"; break; case EPoseEstimationType::Invalid: ts.setColor(StaticColors::Red()); ts << " LOST"; break; } ts.setColor(StaticColors::White()); //Expander status switch (mSlam.getMapExpander().getStatus()) { case ESlamMapExpanderStatus::CheckingFrame: ts << ", expander checking"; break; case ESlamMapExpanderStatus::AddingFrame: ts << ", expander adding"; break; case ESlamMapExpanderStatus::SingleFrameBA: ts << ", expander one-frame BA"; break; } //BA status if (mSlam.isBARunning()) { ts << ", "; if (mSlam.getActiveRegion()->getAbortBA()) { ts.setColor(StaticColors::Yellow()); ts << "aborting BA"; ts.setColor(StaticColors::White()); } else { ts << "BA is running"; } } else if (mSlam.getActiveRegion()->getShouldBundleAdjust()) { ts << ", "; ts.setColor(StaticColors::Yellow()); ts << "BA pending"; ts.setColor(StaticColors::White()); } } } //Update FPS auto now = std::chrono::high_resolution_clock::now(); auto elapsedDuration = now - mLastFPSCheck; if (elapsedDuration > mFPSUpdateDuration) { if (mFPSSampleCount) mFPS = mFPSSampleCount / std::chrono::duration_cast<std::chrono::duration<float>>(mFPSSampleAccum).count(); mFPSSampleCount = 0; mFPSSampleAccum = std::chrono::high_resolution_clock::duration(0); mLastFPSCheck = now; } }