summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-06-06 14:25:32 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-06-06 21:37:02 +0200
commitcc3812dccd7a5fddad4a16cf33ec4f74e3b9da56 (patch)
tree1a4f182bbc5fe52dd9fbb8e12997e0d6e9eb119d /vcl
parente4008dc0c3b43c9eacdd88511075be2b883c9a77 (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')
-rw-r--r--vcl/inc/opengl/texture.hxx2
-rw-r--r--vcl/opengl/texture.cxx25
2 files changed, 23 insertions, 4 deletions
diff --git a/vcl/inc/opengl/texture.hxx b/vcl/inc/opengl/texture.hxx
index 2aca8ddfd874..554058af9603 100644
--- a/vcl/inc/opengl/texture.hxx
+++ b/vcl/inc/opengl/texture.hxx
@@ -91,6 +91,7 @@ public:
OpenGLTexture( int nWidth, int nHeight, int nFormat, int nType, void const * pData );
OpenGLTexture( int nX, int nY, int nWidth, int nHeight );
OpenGLTexture( const OpenGLTexture& rTexture );
+ OpenGLTexture( OpenGLTexture&& rTexture );
OpenGLTexture( const OpenGLTexture& rTexture, int nX, int nY, int nWidth, int nHeight );
~OpenGLTexture();
@@ -117,6 +118,7 @@ public:
operator bool() const;
OpenGLTexture& operator=( const OpenGLTexture& rTexture );
+ OpenGLTexture& operator=( OpenGLTexture&& rTexture );
bool operator==( const OpenGLTexture& rTexture ) const;
bool operator!=( const OpenGLTexture& rTexture ) const;
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