Fix inconsistencies in sf::Texture move and swap

This commit is contained in:
vittorioromeo 2024-06-07 18:06:44 +02:00 committed by Chris Thrasher
parent 52ce862a00
commit 8acb9d9ab1

View File

@ -117,7 +117,9 @@ m_texture(std::exchange(right.m_texture, 0)),
m_isSmooth(std::exchange(right.m_isSmooth, false)), m_isSmooth(std::exchange(right.m_isSmooth, false)),
m_sRgb(std::exchange(right.m_sRgb, false)), m_sRgb(std::exchange(right.m_sRgb, false)),
m_isRepeated(std::exchange(right.m_isRepeated, false)), m_isRepeated(std::exchange(right.m_isRepeated, false)),
m_pixelsFlipped(std::exchange(right.m_pixelsFlipped, false)),
m_fboAttachment(std::exchange(right.m_fboAttachment, false)), m_fboAttachment(std::exchange(right.m_fboAttachment, false)),
m_hasMipmap(std::exchange(right.m_hasMipmap, false)),
m_cacheId(std::exchange(right.m_cacheId, 0)) m_cacheId(std::exchange(right.m_cacheId, 0))
{ {
} }
@ -147,7 +149,9 @@ Texture& Texture::operator=(Texture&& right) noexcept
m_isSmooth = std::exchange(right.m_isSmooth, false); m_isSmooth = std::exchange(right.m_isSmooth, false);
m_sRgb = std::exchange(right.m_sRgb, false); m_sRgb = std::exchange(right.m_sRgb, false);
m_isRepeated = std::exchange(right.m_isRepeated, false); m_isRepeated = std::exchange(right.m_isRepeated, false);
m_pixelsFlipped = std::exchange(right.m_pixelsFlipped, false);
m_fboAttachment = std::exchange(right.m_fboAttachment, false); m_fboAttachment = std::exchange(right.m_fboAttachment, false);
m_hasMipmap = std::exchange(right.m_hasMipmap, false);
m_cacheId = std::exchange(right.m_cacheId, 0); m_cacheId = std::exchange(right.m_cacheId, 0);
return *this; return *this;
} }
@ -947,9 +951,7 @@ void Texture::swap(Texture& right) noexcept
std::swap(m_pixelsFlipped, right.m_pixelsFlipped); std::swap(m_pixelsFlipped, right.m_pixelsFlipped);
std::swap(m_fboAttachment, right.m_fboAttachment); std::swap(m_fboAttachment, right.m_fboAttachment);
std::swap(m_hasMipmap, right.m_hasMipmap); std::swap(m_hasMipmap, right.m_hasMipmap);
std::swap(m_cacheId, right.m_cacheId);
m_cacheId = TextureImpl::getUniqueId();
right.m_cacheId = TextureImpl::getUniqueId();
} }