MCPcopy Create free account
hub / github.com/c3d/tao3D / startRefreshTimer

Method startRefreshTimer

tao/widget.cpp:4031–4094  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4029
4030
4031void Widget::startRefreshTimer(bool on)
4032// ----------------------------------------------------------------------------
4033// Make sure refresh timer runs if it has to
4034// ----------------------------------------------------------------------------
4035{
4036 if (inOfflineRendering)
4037 return;
4038
4039 if (!on)
4040 {
4041#ifdef MACOSX_DISPLAYLINK
4042 if (displayLink && displayLinkStarted)
4043 {
4044 CVDisplayLinkStop(displayLink);
4045 displayLinkStarted = false;
4046 pendingDisplayLinkEvent = false;
4047 QCoreApplication::removePostedEvents(this, DisplayLink);
4048 }
4049#else
4050 timer.stop();
4051#endif
4052 QCoreApplication::removePostedEvents(this, QEvent::Timer);
4053 return;
4054 }
4055
4056 if (inError || !animated)
4057 return;
4058
4059#ifdef MACOSX_DISPLAYLINK
4060 if (!displayLink)
4061 {
4062 // Create display link
4063 CVDisplayLinkCreateWithCGDisplay(getCurrentDisplayID(this),
4064 &displayLink);
4065 // Set render callback
4066 if (displayLink)
4067 CVDisplayLinkSetOutputCallback(displayLink, &displayLinkCallback,
4068 this);
4069 }
4070 if (displayLink && !displayLinkStarted)
4071 {
4072 CVDisplayLinkStart(displayLink);
4073 displayLinkStarted = true;
4074 }
4075#else
4076 assert(space || !"No space layout");
4077 double next = space->NextRefresh();
4078 if (next != DBL_MAX)
4079 {
4080 double now = trueCurrentTime();
4081 double remaining = next - now;
4082 if (remaining <= 0)
4083 remaining = 0.001;
4084 int ms = remaining * 1000;
4085 IFTRACE(layoutevents)
4086 std::cerr << "Starting refresh timer: " << ms << " ms (current "
4087 "time " << now << " next refresh " << next
4088 << ")\n";

Callers 2

closeEventMethod · 0.80
loadFileMethod · 0.80

Calls 4

getCurrentDisplayIDFunction · 0.85
NextRefreshMethod · 0.80
IFTRACEFunction · 0.70
startMethod · 0.45

Tested by

no test coverage detected