From 8d19f99facb5bdcf2bd121ee6804d1711448261b Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 20 Mar 2021 15:58:29 -0500 Subject: [PATCH] [nostalgia/core/userland] Make Texture copy width and height on move --- src/nostalgia/core/userland/glutils.hpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/nostalgia/core/userland/glutils.hpp b/src/nostalgia/core/userland/glutils.hpp index aca6d2244..f23f22b62 100644 --- a/src/nostalgia/core/userland/glutils.hpp +++ b/src/nostalgia/core/userland/glutils.hpp @@ -26,6 +26,23 @@ struct TextureBase { GLsizei width = 0; GLsizei height = 0; + constexpr TextureBase() = default; + + constexpr TextureBase(TextureBase &&tb) noexcept { + width = tb.width; + height = tb.height; + tb.width = 0; + tb.height = 0; + } + + constexpr TextureBase &operator=(TextureBase &&tb) noexcept { + width = tb.width; + height = tb.height; + tb.width = 0; + tb.height = 0; + return *this; + } + }; @@ -51,6 +68,7 @@ struct GLobject: public Base { GLobject &operator=(GLobject &&o) { this->~GLobject(); + Base::operator=(ox::move(o)); id = o.id; o.id = 0; return *this;