]> git.tdb.fi Git - libs/gl.git/commitdiff
Fix move semantics of OpenGLTexture2D::AsyncTransfer
authorMikko Rasa <tdb@tdb.fi>
Sat, 23 Dec 2023 12:54:34 +0000 (14:54 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sat, 23 Dec 2023 12:54:34 +0000 (14:54 +0200)
I may eventually get rid of NonCopyable, but for now let's keep things
consistent.

source/backends/opengl/texture2d_backend.cpp
source/backends/opengl/texture2d_backend.h

index 84dff96866fc14fbeb7e062cfaed8416de4392d5..3dd6dde4de1c28a6a119f0d83bd55321f3a01e1e 100644 (file)
@@ -85,6 +85,20 @@ void OpenGLTexture2D::unload()
 }
 
 
+OpenGLTexture2D::AsyncTransfer::AsyncTransfer() = default;
+
+OpenGLTexture2D::AsyncTransfer::AsyncTransfer(AsyncTransfer &&other):
+       pixel_buffer(move(other.pixel_buffer))
+{ }
+
+OpenGLTexture2D::AsyncTransfer &OpenGLTexture2D::AsyncTransfer::operator=(AsyncTransfer &&other)
+{
+       pixel_buffer = move(other.pixel_buffer);
+       return *this;
+}
+
+OpenGLTexture2D::AsyncTransfer::~AsyncTransfer() = default;
+
 void *OpenGLTexture2D::AsyncTransfer::allocate()
 {
        const Texture2D::AsyncTransfer &self = *static_cast<const Texture2D::AsyncTransfer *>(this);
index 5423cfe3fe4f316d70bf53e2ac436710ccd4adba..fe5235a2312dd1526729bf17fd087a9f15337dda 100644 (file)
@@ -18,6 +18,11 @@ protected:
        protected:
                std::unique_ptr<Buffer> pixel_buffer;
 
+               AsyncTransfer();
+               AsyncTransfer(AsyncTransfer &&);
+               AsyncTransfer &operator=(AsyncTransfer &&);
+               ~AsyncTransfer();
+
                void *allocate();
                void finalize();
        };