MCPcopy Create free account
hub / github.com/comaps/comaps / CheckRenderingEnabled

Method CheckRenderingEnabled

libs/drape_frontend/base_renderer.cpp:144–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142}
143
144void BaseRenderer::CheckRenderingEnabled()
145{
146 if (!m_isEnabled)
147 {
148 dp::GraphicsContext * context = nullptr;
149
150 if (m_wasContextReset)
151 {
152 using namespace std::placeholders;
153 EnableMessageFiltering(std::bind(&BaseRenderer::FilterContextDependentMessage, this, _1));
154 OnContextDestroy();
155 CHECK(m_contextCounter > 0, ());
156 m_contextCounter--;
157 }
158 else
159 {
160 bool const isDrawContext = m_threadName == ThreadsCommutator::RenderThread;
161 context = isDrawContext ? m_contextFactory->GetDrawContext() : m_contextFactory->GetResourcesUploadContext();
162 context->SetRenderingEnabled(false);
163 }
164
165 OnRenderingDisabled();
166
167 // notify initiator-thread about rendering disabling
168 Notify();
169
170 // wait for signal
171 std::unique_lock<std::mutex> lock(m_renderingEnablingMutex);
172 m_renderingEnablingCondition.wait(lock, [this] { return m_wasNotified; });
173
174 m_wasNotified = false;
175
176 bool needCreateContext = false;
177 if (!m_selfThread.GetRoutine()->IsCancelled())
178 {
179 // here rendering is enabled again
180 m_isEnabled = true;
181
182 if (m_wasContextReset)
183 {
184 m_wasContextReset = false;
185 needCreateContext = true;
186 }
187 else
188 {
189 context->SetRenderingEnabled(true);
190 }
191 }
192
193 if (needCreateContext)
194 DisableMessageFiltering();
195
196 // notify initiator-thread about rendering enabling
197 // m_renderingEnablingCompletionHandler will be setup before awakening of this thread
198 Notify();
199
200 OnRenderingEnabled();
201

Callers

nothing calls this directly

Calls 7

NotifyFunction · 0.85
waitMethod · 0.80
GetRoutineMethod · 0.80
GetDrawContextMethod · 0.45
SetRenderingEnabledMethod · 0.45
IsCancelledMethod · 0.45

Tested by

no test coverage detected