diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-06-06 14:25:32 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-06-06 21:37:02 +0200 |
commit | cc3812dccd7a5fddad4a16cf33ec4f74e3b9da56 (patch) | |
tree | 1a4f182bbc5fe52dd9fbb8e12997e0d6e9eb119d /vcl/opengl | |
parent | e4008dc0c3b43c9eacdd88511075be2b883c9a77 (diff) |
coverity#1371243 Missing move assignment operator
Change-Id: Idbd8b87d1336105cc34054277ae492077d86e8c9
Reviewed-on: https://gerrit.libreoffice.org/38453
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/opengl')
-rw-r--r-- | vcl/opengl/texture.cxx | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/vcl/opengl/texture.cxx b/vcl/opengl/texture.cxx index 207190e8ba8c..90cd255d8d95 100644 --- a/vcl/opengl/texture.cxx +++ b/vcl/opengl/texture.cxx @@ -284,7 +284,7 @@ OpenGLTexture::OpenGLTexture( int nWidth, int nHeight, int nFormat, int nType, v } -OpenGLTexture::OpenGLTexture( const OpenGLTexture& rTexture ) +OpenGLTexture::OpenGLTexture(const OpenGLTexture& rTexture) : maRect(rTexture.maRect) , mpImpl(rTexture.mpImpl) , mnSlotNumber(rTexture.mnSlotNumber) @@ -293,6 +293,13 @@ OpenGLTexture::OpenGLTexture( const OpenGLTexture& rTexture ) mpImpl->IncreaseRefCount(mnSlotNumber); } +OpenGLTexture::OpenGLTexture(OpenGLTexture&& rTexture) + : maRect(rTexture.maRect) + , mpImpl(std::move(rTexture.mpImpl)) + , mnSlotNumber(rTexture.mnSlotNumber) +{ +} + OpenGLTexture::OpenGLTexture( const OpenGLTexture& rTexture, int nX, int nY, int nWidth, int nHeight ) { @@ -561,12 +568,10 @@ OpenGLTexture::operator bool() const return IsValid(); } -OpenGLTexture& OpenGLTexture::operator=( const OpenGLTexture& rTexture ) +OpenGLTexture& OpenGLTexture::operator=(const OpenGLTexture& rTexture) { if (rTexture.mpImpl) - { rTexture.mpImpl->IncreaseRefCount(rTexture.mnSlotNumber); - } if (mpImpl) mpImpl->DecreaseRefCount(mnSlotNumber); @@ -578,6 +583,18 @@ OpenGLTexture& OpenGLTexture::operator=( const OpenGLTexture& rTexture ) return *this; } +OpenGLTexture& OpenGLTexture::operator=(OpenGLTexture&& rTexture) +{ + if (mpImpl) + mpImpl->DecreaseRefCount(mnSlotNumber); + + maRect = rTexture.maRect; + mpImpl = std::move(rTexture.mpImpl); + mnSlotNumber = rTexture.mnSlotNumber; + + return *this; +} + bool OpenGLTexture::operator==( const OpenGLTexture& rTexture ) const { return (mpImpl == rTexture.mpImpl |