mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41:05 +08:00
Remove unnecessary scope
This commit is contained in:
parent
86682d99dd
commit
91956d152d
@ -480,39 +480,37 @@ bool RenderTarget::isSrgb() const
|
|||||||
bool RenderTarget::setActive(bool active)
|
bool RenderTarget::setActive(bool active)
|
||||||
{
|
{
|
||||||
// Mark this RenderTarget as active or no longer active in the tracking map
|
// Mark this RenderTarget as active or no longer active in the tracking map
|
||||||
|
const std::lock_guard lock(RenderTargetImpl::getMutex());
|
||||||
|
|
||||||
|
const std::uint64_t contextId = Context::getActiveContextId();
|
||||||
|
|
||||||
|
using RenderTargetImpl::getContextRenderTargetMap;
|
||||||
|
auto& contextRenderTargetMap = getContextRenderTargetMap();
|
||||||
|
const auto it = contextRenderTargetMap.find(contextId);
|
||||||
|
|
||||||
|
if (active)
|
||||||
{
|
{
|
||||||
const std::lock_guard lock(RenderTargetImpl::getMutex());
|
if (it == contextRenderTargetMap.end())
|
||||||
|
|
||||||
const std::uint64_t contextId = Context::getActiveContextId();
|
|
||||||
|
|
||||||
using RenderTargetImpl::getContextRenderTargetMap;
|
|
||||||
auto& contextRenderTargetMap = getContextRenderTargetMap();
|
|
||||||
const auto it = contextRenderTargetMap.find(contextId);
|
|
||||||
|
|
||||||
if (active)
|
|
||||||
{
|
{
|
||||||
if (it == contextRenderTargetMap.end())
|
contextRenderTargetMap[contextId] = m_id;
|
||||||
{
|
|
||||||
contextRenderTargetMap[contextId] = m_id;
|
|
||||||
|
|
||||||
m_cache.glStatesSet = false;
|
m_cache.glStatesSet = false;
|
||||||
m_cache.enable = false;
|
m_cache.enable = false;
|
||||||
}
|
|
||||||
else if (it->second != m_id)
|
|
||||||
{
|
|
||||||
it->second = m_id;
|
|
||||||
|
|
||||||
m_cache.enable = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else if (it->second != m_id)
|
||||||
{
|
{
|
||||||
if (it != contextRenderTargetMap.end())
|
it->second = m_id;
|
||||||
contextRenderTargetMap.erase(it);
|
|
||||||
|
|
||||||
m_cache.enable = false;
|
m_cache.enable = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (it != contextRenderTargetMap.end())
|
||||||
|
contextRenderTargetMap.erase(it);
|
||||||
|
|
||||||
|
m_cache.enable = false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user