From: Mikko Rasa Date: Sat, 23 Dec 2023 12:54:34 +0000 (+0200) Subject: Fix move semantics of OpenGLTexture2D::AsyncTransfer X-Git-Url: https://git.tdb.fi/?a=commitdiff_plain;h=75e17f2ce0923500de0cac6ecd25557ba945916b;p=libs%2Fgl.git Fix move semantics of OpenGLTexture2D::AsyncTransfer I may eventually get rid of NonCopyable, but for now let's keep things consistent. --- diff --git a/source/backends/opengl/texture2d_backend.cpp b/source/backends/opengl/texture2d_backend.cpp index 84dff968..3dd6dde4 100644 --- a/source/backends/opengl/texture2d_backend.cpp +++ b/source/backends/opengl/texture2d_backend.cpp @@ -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(this); diff --git a/source/backends/opengl/texture2d_backend.h b/source/backends/opengl/texture2d_backend.h index 5423cfe3..fe5235a2 100644 --- a/source/backends/opengl/texture2d_backend.h +++ b/source/backends/opengl/texture2d_backend.h @@ -18,6 +18,11 @@ protected: protected: std::unique_ptr pixel_buffer; + AsyncTransfer(); + AsyncTransfer(AsyncTransfer &&); + AsyncTransfer &operator=(AsyncTransfer &&); + ~AsyncTransfer(); + void *allocate(); void finalize(); };