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

Method AttachSurface

android/sdk/src/main/cpp/app/organicmaps/sdk/Framework.cpp:334–389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

332}
333
334bool Framework::AttachSurface(JNIEnv * env, jobject jSurface)
335{
336 LOG(LINFO, ("Attach surface started."));
337
338 int w = 0, h = 0;
339 if (m_vulkanContextFactory)
340 {
341 auto factory = CastFactory(m_vulkanContextFactory);
342 factory->SetSurface(env, jSurface);
343 if (!factory->IsValid())
344 {
345 LOG(LWARNING, ("Invalid Vulkan API context."));
346 return false;
347 }
348 w = factory->GetWidth();
349 h = factory->GetHeight();
350 }
351 else
352 {
353 ASSERT(m_oglContextFactory != nullptr, ());
354 auto factory = m_oglContextFactory->CastFactory<AndroidOGLContextFactory>();
355 factory->SetSurface(env, jSurface);
356 if (!factory->IsValid())
357 {
358 LOG(LWARNING, ("Invalid GL context."));
359 return false;
360 }
361 w = factory->GetWidth();
362 h = factory->GetHeight();
363 }
364
365 ASSERT(!m_guiPositions.empty(), ("GUI elements must be set-up before engine is created"));
366
367 if (m_vulkanContextFactory)
368 {
369 m_vulkanContextFactory->SetPresentAvailable(true);
370 m_work.SetRenderingEnabled();
371 }
372 else
373 {
374 m_oglContextFactory->SetPresentAvailable(true);
375 m_work.SetRenderingEnabled(make_ref(m_oglContextFactory));
376 }
377
378 if (m_isSurfaceDestroyed)
379 {
380 LOG(LINFO, ("Recover surface, viewport size:", w, h));
381 bool const recreateContextDependentResources = (m_vulkanContextFactory == nullptr);
382 m_work.OnRecoverSurface(w, h, recreateContextDependentResources);
383 m_isSurfaceDestroyed = false;
384 }
385
386 LOG(LINFO, ("Attach surface finished."));
387
388 return true;
389}
390
391void Framework::PauseSurfaceRendering()

Calls 11

CastFactoryFunction · 0.85
ASSERTFunction · 0.85
make_refFunction · 0.85
SetSurfaceMethod · 0.45
IsValidMethod · 0.45
GetWidthMethod · 0.45
GetHeightMethod · 0.45
emptyMethod · 0.45
SetPresentAvailableMethod · 0.45
SetRenderingEnabledMethod · 0.45
OnRecoverSurfaceMethod · 0.45

Tested by

no test coverage detected