[Libreoffice-commits] core.git: vcl/inc vcl/opengl

Caolán McNamara caolanm at redhat.com
Tue Jun 6 19:37:24 UTC 2017


 vcl/inc/opengl/texture.hxx |    2 ++
 vcl/opengl/texture.cxx     |   25 +++++++++++++++++++++----
 2 files changed, 23 insertions(+), 4 deletions(-)

New commits:
commit cc3812dccd7a5fddad4a16cf33ec4f74e3b9da56
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jun 6 14:25:32 2017 +0100

    coverity#1371243 Missing move assignment operator
    
    Change-Id: Idbd8b87d1336105cc34054277ae492077d86e8c9
    Reviewed-on: https://gerrit.libreoffice.org/38453
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

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


More information about the Libreoffice-commits mailing list