MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / threadLoopOnce

Method threadLoopOnce

Gui/PreviewThread.cpp:99–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99GenericSchedulerThread::ThreadStateEnum
100PreviewThread::threadLoopOnce(const GenericThreadStartArgsPtr& inArgs)
101{
102 ComputePreviewRequestPtr args = std::dynamic_pointer_cast<ComputePreviewRequest>(inArgs);
103
104 assert(args);
105
106
107 NodeGuiPtr node = args->node.lock();
108 if (node) {
109 ///Mark this thread as running
110 appPTR->fetchAndAddNRunningThreads(1);
111
112 //process the request if valid
113 int w = NATRON_PREVIEW_WIDTH;
114 int h = NATRON_PREVIEW_HEIGHT;
115
116 //set buffer to 0
117#ifndef __NATRON_WIN32__
118 std::memset( &_imp->data.front(), 0, _imp->data.size() * sizeof(unsigned int) );
119#else
120 for (std::size_t i = 0; i < _imp->data.size(); ++i) {
121 _imp->data[i] = qRgba(0, 0, 0, 255);
122 }
123#endif
124 NodePtr internalNode = node->getNode();
125 if (internalNode) {
126 bool ok = internalNode->makePreviewImage( args->time, &w, &h, &_imp->data.front() );
127 Q_UNUSED(ok);
128 node->copyPreviewImageBuffer(_imp->data, w, h);
129 }
130
131 ///Unmark this thread as running
132 appPTR->fetchAndAddNRunningThreads(-1);
133 }
134
135 return eThreadStateActive;
136} // PreviewThread::threadLoopOnce
137
138NATRON_NAMESPACE_EXIT
139

Callers

nothing calls this directly

Calls 5

lockMethod · 0.45
sizeMethod · 0.45
getNodeMethod · 0.45

Tested by

no test coverage detected