MCPcopy Create free account
hub / github.com/SFML/SFML / setActive

Method setActive

src/SFML/Graphics/RenderTarget.cpp:483–519  ·  view source on GitHub ↗

///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

481
482////////////////////////////////////////////////////////////
483bool RenderTarget::setActive(bool active)
484{
485 // Mark this RenderTarget as active or no longer active in the tracking map
486 const std::lock_guard lock(RenderTargetImpl::getMutex());
487
488 const std::uint64_t contextId = Context::getActiveContextId();
489
490 using RenderTargetImpl::getContextRenderTargetMap;
491 auto& contextRenderTargetMap = getContextRenderTargetMap();
492 const auto it = contextRenderTargetMap.find(contextId);
493
494 if (active)
495 {
496 if (it == contextRenderTargetMap.end())
497 {
498 contextRenderTargetMap[contextId] = m_id;
499
500 m_cache.glStatesSet = false;
501 m_cache.enable = false;
502 }
503 else if (it->second != m_id)
504 {
505 it->second = m_id;
506
507 m_cache.enable = false;
508 }
509 }
510 else
511 {
512 if (it != contextRenderTargetMap.end())
513 contextRenderTargetMap.erase(it);
514
515 m_cache.enable = false;
516 }
517
518 return true;
519}
520
521
522////////////////////////////////////////////////////////////

Callers 3

activateMethod · 0.45
activateMethod · 0.45
updateMethod · 0.45

Calls 3

findMethod · 0.80
eraseMethod · 0.80
endMethod · 0.45

Tested by

no test coverage detected