Browse Source

Use Utility::move() and swap() instead of STL almost everywhere.

Partially needed to avoid build breakages because Corrade itself
switched as well, partially because a cleanup is always good. Done
except for (STL-heavy) code that's deprecated or SceneGraph-related APIs
that are still quite full of STL as well.
pull/168/head
Vladimír Vondruš 3 years ago
parent
commit
5d1369f570
  1. 10
      doc/generated/primitives.cpp
  2. 2
      doc/generated/shaders.cpp
  3. 4
      src/Magnum/Animation/Test/PlayerTest.cpp
  4. 12
      src/Magnum/Animation/Track.h
  5. 2
      src/Magnum/Audio/Buffer.h
  6. 4
      src/Magnum/Audio/Context.cpp
  7. 3
      src/Magnum/Audio/Source.h
  8. 2
      src/Magnum/Audio/Test/ContextALTest.cpp
  9. 4
      src/Magnum/DebugTools/CompareImage.cpp
  10. 12
      src/Magnum/DebugTools/FrameProfiler.cpp
  11. 8
      src/Magnum/DebugTools/Test/FrameProfilerTest.cpp
  12. 10
      src/Magnum/DebugTools/TextureImage.cpp
  13. 6
      src/Magnum/GL/AbstractFramebuffer.cpp
  14. 4
      src/Magnum/GL/AbstractFramebuffer.h
  15. 4
      src/Magnum/GL/AbstractQuery.h
  16. 4
      src/Magnum/GL/AbstractShaderProgram.cpp
  17. 8
      src/Magnum/GL/AbstractTexture.cpp
  18. 5
      src/Magnum/GL/AbstractTexture.h
  19. 4
      src/Magnum/GL/Buffer.h
  20. 20
      src/Magnum/GL/BufferImage.cpp
  21. 8
      src/Magnum/GL/BufferImage.h
  22. 10
      src/Magnum/GL/Context.cpp
  23. 34
      src/Magnum/GL/CubeMapTexture.cpp
  24. 16
      src/Magnum/GL/CubeMapTextureArray.cpp
  25. 2
      src/Magnum/GL/Implementation/State.cpp
  26. 44
      src/Magnum/GL/Mesh.cpp
  27. 14
      src/Magnum/GL/Mesh.h
  28. 16
      src/Magnum/GL/RectangleTexture.cpp
  29. 4
      src/Magnum/GL/Renderbuffer.h
  30. 12
      src/Magnum/GL/Shader.cpp
  31. 2
      src/Magnum/GL/Shader.h
  32. 4
      src/Magnum/GL/Test/AbstractQueryGLTest.cpp
  33. 8
      src/Magnum/GL/Test/AbstractShaderProgramGLTest.cpp
  34. 4
      src/Magnum/GL/Test/AbstractTextureGLTest.cpp
  35. 4
      src/Magnum/GL/Test/BufferGLTest.cpp
  36. 16
      src/Magnum/GL/Test/BufferImageGLTest.cpp
  37. 4
      src/Magnum/GL/Test/ContextGLTest.cpp
  38. 4
      src/Magnum/GL/Test/ContextTest.cpp
  39. 4
      src/Magnum/GL/Test/FramebufferGLTest.cpp
  40. 18
      src/Magnum/GL/Test/MeshGLTest.cpp
  41. 4
      src/Magnum/GL/Test/MeshTest.cpp
  42. 4
      src/Magnum/GL/Test/RenderbufferGLTest.cpp
  43. 4
      src/Magnum/GL/Test/ShaderGLTest.cpp
  44. 4
      src/Magnum/GL/Test/TransformFeedbackGLTest.cpp
  45. 16
      src/Magnum/GL/Texture.cpp
  46. 16
      src/Magnum/GL/TextureArray.cpp
  47. 5
      src/Magnum/GL/TransformFeedback.h
  48. 2
      src/Magnum/GL/Version.h
  49. 22
      src/Magnum/Image.cpp
  50. 16
      src/Magnum/Image.h
  51. 2
      src/Magnum/Implementation/ImageProperties.h
  52. 2
      src/Magnum/MaterialTools/Copy.cpp
  53. 2
      src/Magnum/MaterialTools/Filter.cpp
  54. 2
      src/Magnum/MaterialTools/Merge.cpp
  55. 2
      src/Magnum/MaterialTools/PhongToPbrMetallicRoughness.cpp
  56. 4
      src/Magnum/MaterialTools/Test/CopyTest.cpp
  57. 2
      src/Magnum/Math/Algorithms/GaussJordan.h
  58. 3
      src/Magnum/Math/Functions.h
  59. 1
      src/Magnum/Math/Test/IntersectionBenchmark.cpp
  60. 2
      src/Magnum/MeshTools/Combine.cpp
  61. 20
      src/Magnum/MeshTools/Compile.cpp
  62. 4
      src/Magnum/MeshTools/CompileLines.cpp
  63. 8
      src/Magnum/MeshTools/CompressIndices.cpp
  64. 6
      src/Magnum/MeshTools/Concatenate.cpp
  65. 4
      src/Magnum/MeshTools/Concatenate.h
  66. 8
      src/Magnum/MeshTools/Copy.cpp
  67. 2
      src/Magnum/MeshTools/Filter.cpp
  68. 2
      src/Magnum/MeshTools/FlipNormals.cpp
  69. 2
      src/Magnum/MeshTools/FullScreenTriangle.cpp
  70. 4
      src/Magnum/MeshTools/GenerateIndices.cpp
  71. 2
      src/Magnum/MeshTools/GenerateLines.cpp
  72. 2
      src/Magnum/MeshTools/GenerateNormals.cpp
  73. 21
      src/Magnum/MeshTools/Interleave.cpp
  74. 12
      src/Magnum/MeshTools/RemoveDuplicates.cpp
  75. 18
      src/Magnum/MeshTools/Test/CompileGLTest.cpp
  76. 2
      src/Magnum/MeshTools/Test/CompileLinesGLTest.cpp
  77. 8
      src/Magnum/MeshTools/Test/CompressIndicesTest.cpp
  78. 10
      src/Magnum/MeshTools/Test/ConcatenateTest.cpp
  79. 6
      src/Magnum/MeshTools/Test/CopyTest.cpp
  80. 38
      src/Magnum/MeshTools/Test/FilterTest.cpp
  81. 2
      src/Magnum/MeshTools/Test/GenerateIndicesTest.cpp
  82. 64
      src/Magnum/MeshTools/Test/InterleaveTest.cpp
  83. 2
      src/Magnum/MeshTools/Test/RemoveDuplicatesTest.cpp
  84. 68
      src/Magnum/MeshTools/Test/TransformTest.cpp
  85. 12
      src/Magnum/MeshTools/Transform.cpp
  86. 4
      src/Magnum/MeshTools/Transform.h
  87. 4
      src/Magnum/Platform/WindowlessCglApplication.cpp
  88. 4
      src/Magnum/Platform/WindowlessEglApplication.cpp
  89. 4
      src/Magnum/Platform/WindowlessGlxApplication.cpp
  90. 4
      src/Magnum/Platform/WindowlessWglApplication.cpp
  91. 4
      src/Magnum/Primitives/Capsule.cpp
  92. 8
      src/Magnum/Primitives/Circle.cpp
  93. 4
      src/Magnum/Primitives/Gradient.cpp
  94. 8
      src/Magnum/Primitives/Grid.cpp
  95. 4
      src/Magnum/Primitives/Icosphere.cpp
  96. 4
      src/Magnum/Primitives/Implementation/Spheroid.cpp
  97. 4
      src/Magnum/Primitives/Implementation/WireframeSpheroid.cpp
  98. 4
      src/Magnum/Primitives/Line.cpp
  99. 2
      src/Magnum/Primitives/Plane.cpp
  100. 4
      src/Magnum/SceneTools/Copy.cpp
  101. Some files were not shown because too many files have changed in this diff Show More

10
doc/generated/primitives.cpp

@ -431,7 +431,7 @@ Containers::Pair<Trade::MeshData, Containers::StringView> PrimitiveVisualizer::c
Trade::MeshData capsule = Primitives::capsule2DWireframe(8, 1, 0.75f); Trade::MeshData capsule = Primitives::capsule2DWireframe(8, 1, 0.75f);
MeshTools::transformPointsInPlace(Matrix3::scaling(Vector2{0.75f}), MeshTools::transformPointsInPlace(Matrix3::scaling(Vector2{0.75f}),
capsule.mutableAttribute<Vector2>(Trade::MeshAttribute::Position)); capsule.mutableAttribute<Vector2>(Trade::MeshAttribute::Position));
return {std::move(capsule), "capsule2dwireframe.png"}; return {Utility::move(capsule), "capsule2dwireframe.png"};
} }
Containers::Pair<Trade::MeshData, Containers::StringView> PrimitiveVisualizer::circle2DWireframe() { Containers::Pair<Trade::MeshData, Containers::StringView> PrimitiveVisualizer::circle2DWireframe() {
@ -446,7 +446,7 @@ Containers::Pair<Trade::MeshData, Containers::StringView> PrimitiveVisualizer::l
Trade::MeshData line = Primitives::line2D(); Trade::MeshData line = Primitives::line2D();
MeshTools::transformPointsInPlace(Matrix3::translation(Vector2::xAxis(-1.0f))*Matrix3::scaling(Vector2::xScale(2.0f)), MeshTools::transformPointsInPlace(Matrix3::translation(Vector2::xAxis(-1.0f))*Matrix3::scaling(Vector2::xScale(2.0f)),
line.mutableAttribute<Vector2>(Trade::MeshAttribute::Position)); line.mutableAttribute<Vector2>(Trade::MeshAttribute::Position));
return {std::move(line), "line2d.png"}; return {Utility::move(line), "line2d.png"};
} }
Containers::Pair<Trade::MeshData, Containers::StringView> PrimitiveVisualizer::squareWireframe() { Containers::Pair<Trade::MeshData, Containers::StringView> PrimitiveVisualizer::squareWireframe() {
@ -457,7 +457,7 @@ Containers::Pair<Trade::MeshData, Containers::StringView> PrimitiveVisualizer::c
Trade::MeshData capsule = Primitives::capsule3DWireframe(8, 1, 16, 1.0f); Trade::MeshData capsule = Primitives::capsule3DWireframe(8, 1, 16, 1.0f);
MeshTools::transformPointsInPlace(Matrix4::scaling(Vector3{0.75f}), MeshTools::transformPointsInPlace(Matrix4::scaling(Vector3{0.75f}),
capsule.mutableAttribute<Vector3>(Trade::MeshAttribute::Position)); capsule.mutableAttribute<Vector3>(Trade::MeshAttribute::Position));
return {std::move(capsule), "capsule3dwireframe.png"}; return {Utility::move(capsule), "capsule3dwireframe.png"};
} }
Containers::Pair<Trade::MeshData, Containers::StringView> PrimitiveVisualizer::circle3DWireframe() { Containers::Pair<Trade::MeshData, Containers::StringView> PrimitiveVisualizer::circle3DWireframe() {
@ -492,7 +492,7 @@ Containers::Pair<Trade::MeshData, Containers::StringView> PrimitiveVisualizer::l
Trade::MeshData line = Primitives::line3D(); Trade::MeshData line = Primitives::line3D();
MeshTools::transformPointsInPlace(Matrix4::translation(Vector3::xAxis(-1.0f))*Matrix4::scaling(Vector3::xScale(2.0f)), MeshTools::transformPointsInPlace(Matrix4::translation(Vector3::xAxis(-1.0f))*Matrix4::scaling(Vector3::xScale(2.0f)),
line.mutableAttribute<Vector3>(Trade::MeshAttribute::Position)); line.mutableAttribute<Vector3>(Trade::MeshAttribute::Position));
return {std::move(line), "line3d.png"}; return {Utility::move(line), "line3d.png"};
} }
Containers::Pair<Trade::MeshData, Containers::StringView> PrimitiveVisualizer::planeWireframe() { Containers::Pair<Trade::MeshData, Containers::StringView> PrimitiveVisualizer::planeWireframe() {
@ -515,7 +515,7 @@ Containers::Pair<Trade::MeshData, Containers::StringView> PrimitiveVisualizer::c
Trade::MeshData capsule = Primitives::capsule3DSolid(4, 1, 12, 0.75f); Trade::MeshData capsule = Primitives::capsule3DSolid(4, 1, 12, 0.75f);
MeshTools::transformPointsInPlace(Matrix4::scaling(Vector3{0.75f}), MeshTools::transformPointsInPlace(Matrix4::scaling(Vector3{0.75f}),
capsule.mutableAttribute<Vector3>(Trade::MeshAttribute::Position)); capsule.mutableAttribute<Vector3>(Trade::MeshAttribute::Position));
return {std::move(capsule), "capsule3dsolid.png"}; return {Utility::move(capsule), "capsule3dsolid.png"};
} }
Containers::Pair<Trade::MeshData, Containers::StringView> PrimitiveVisualizer::circle3DSolid() { Containers::Pair<Trade::MeshData, Containers::StringView> PrimitiveVisualizer::circle3DSolid() {

2
doc/generated/shaders.cpp

@ -326,7 +326,7 @@ Containers::StringView ShaderVisualizer::vertexColor() {
Trade::MeshData sphere = Primitives::uvSphereSolid(32, 64); Trade::MeshData sphere = Primitives::uvSphereSolid(32, 64);
/* Add a color attribute */ /* Add a color attribute */
Trade::MeshData sphereWithColors = MeshTools::interleave(std::move(sphere), { Trade::MeshData sphereWithColors = MeshTools::interleave(Utility::move(sphere), {
Trade::MeshAttributeData{Trade::MeshAttribute::Color, VertexFormat::Vector3, nullptr} Trade::MeshAttributeData{Trade::MeshAttribute::Color, VertexFormat::Vector3, nullptr}
}); });

4
src/Magnum/Animation/Test/PlayerTest.cpp

@ -281,7 +281,7 @@ void PlayerTest::constructMove() {
CORRADE_COMPARE(a.track(0).keys().data(), Track.keys().data()); CORRADE_COMPARE(a.track(0).keys().data(), Track.keys().data());
CORRADE_COMPARE(a.track(1).keys().data(), track2.keys().data()); CORRADE_COMPARE(a.track(1).keys().data(), track2.keys().data());
Player<Float> b{std::move(a)}; Player<Float> b{Utility::move(a)};
CORRADE_COMPARE(b.duration(), (Range1D{0.5f, 4.0f})); CORRADE_COMPARE(b.duration(), (Range1D{0.5f, 4.0f}));
CORRADE_COMPARE(b.playCount(), 37); CORRADE_COMPARE(b.playCount(), 37);
CORRADE_COMPARE(b.state(), State::Playing); CORRADE_COMPARE(b.state(), State::Playing);
@ -292,7 +292,7 @@ void PlayerTest::constructMove() {
Player<Float> c; Player<Float> c;
c.setDuration({1.2f, 1.3f}); c.setDuration({1.2f, 1.3f});
c = std::move(b); c = Utility::move(b);
CORRADE_COMPARE(c.duration(), (Range1D{0.5f, 4.0f})); CORRADE_COMPARE(c.duration(), (Range1D{0.5f, 4.0f}));
CORRADE_COMPARE(c.playCount(), 37); CORRADE_COMPARE(c.playCount(), 37);
CORRADE_COMPARE(c.state(), State::Playing); CORRADE_COMPARE(c.state(), State::Playing);

12
src/Magnum/Animation/Track.h

@ -161,7 +161,7 @@ template<class K, class V, class R
* @ref Track(Containers::Array<std::pair<K, V>>&&, Interpolation, Extrapolation, Extrapolation) * @ref Track(Containers::Array<std::pair<K, V>>&&, Interpolation, Extrapolation, Extrapolation)
* for an alternative. * for an alternative.
*/ */
explicit Track(Containers::Array<std::pair<K, V>>&& data, Interpolator interpolator, Extrapolation before, Extrapolation after) noexcept: _data{std::move(data)}, _interpolator{interpolator}, _interpolation{Interpolation::Custom}, _before{before}, _after{after} {} explicit Track(Containers::Array<std::pair<K, V>>&& data, Interpolator interpolator, Extrapolation before, Extrapolation after) noexcept: _data{Utility::move(data)}, _interpolator{interpolator}, _interpolation{Interpolation::Custom}, _before{before}, _after{after} {}
/** @overload */ /** @overload */
explicit Track(std::initializer_list<std::pair<K, V>> data, Interpolator interpolator, Extrapolation before, Extrapolation after): Track<K, V, R>{Containers::Array<std::pair<K, V>>{InPlaceInit, data}, interpolator, before, after} {} explicit Track(std::initializer_list<std::pair<K, V>> data, Interpolator interpolator, Extrapolation before, Extrapolation after): Track<K, V, R>{Containers::Array<std::pair<K, V>>{InPlaceInit, data}, interpolator, before, after} {}
@ -170,7 +170,7 @@ template<class K, class V, class R
* Equivalent to calling @ref Track(Containers::Array<std::pair<K, V>>&&, Interpolator, Extrapolation, Extrapolation) * Equivalent to calling @ref Track(Containers::Array<std::pair<K, V>>&&, Interpolator, Extrapolation, Extrapolation)
* with both @p before and @p after set to @p extrapolation. * with both @p before and @p after set to @p extrapolation.
*/ */
explicit Track(Containers::Array<std::pair<K, V>>&& data, Interpolator interpolator, Extrapolation extrapolation = Extrapolation::Constant) noexcept: Track<K, V, R>{std::move(data), interpolator, extrapolation, extrapolation} {} explicit Track(Containers::Array<std::pair<K, V>>&& data, Interpolator interpolator, Extrapolation extrapolation = Extrapolation::Constant) noexcept: Track<K, V, R>{Utility::move(data), interpolator, extrapolation, extrapolation} {}
/** @overload */ /** @overload */
explicit Track(std::initializer_list<std::pair<K, V>> data, Interpolator interpolator, Extrapolation extrapolation = Extrapolation::Constant): Track<K, V, R>{Containers::Array<std::pair<K, V>>{InPlaceInit, data}, interpolator, extrapolation, extrapolation} {} explicit Track(std::initializer_list<std::pair<K, V>> data, Interpolator interpolator, Extrapolation extrapolation = Extrapolation::Constant): Track<K, V, R>{Containers::Array<std::pair<K, V>>{InPlaceInit, data}, interpolator, extrapolation, extrapolation} {}
@ -189,7 +189,7 @@ template<class K, class V, class R
* supply their own interpolator function to @ref at() or * supply their own interpolator function to @ref at() or
* @ref atStrict(). * @ref atStrict().
*/ */
explicit Track(Containers::Array<std::pair<K, V>>&& data, Interpolation interpolation, Interpolator interpolator, Extrapolation before, Extrapolation after) noexcept: _data{std::move(data)}, _interpolator{interpolator}, _interpolation{interpolation}, _before{before}, _after{after} {} explicit Track(Containers::Array<std::pair<K, V>>&& data, Interpolation interpolation, Interpolator interpolator, Extrapolation before, Extrapolation after) noexcept: _data{Utility::move(data)}, _interpolator{interpolator}, _interpolation{interpolation}, _before{before}, _after{after} {}
/** @overload */ /** @overload */
explicit Track(std::initializer_list<std::pair<K, V>> data, Interpolation interpolation, Interpolator interpolator, Extrapolation before, Extrapolation after): Track<K, V, R>{Containers::Array<std::pair<K, V>>{InPlaceInit, data}, interpolation, interpolator, before, after} {} explicit Track(std::initializer_list<std::pair<K, V>> data, Interpolation interpolation, Interpolator interpolator, Extrapolation before, Extrapolation after): Track<K, V, R>{Containers::Array<std::pair<K, V>>{InPlaceInit, data}, interpolation, interpolator, before, after} {}
@ -198,7 +198,7 @@ template<class K, class V, class R
* Equivalent to calling @ref Track(Containers::Array<std::pair<K, V>>&&, Interpolation, Interpolator, Extrapolation, Extrapolation) * Equivalent to calling @ref Track(Containers::Array<std::pair<K, V>>&&, Interpolation, Interpolator, Extrapolation, Extrapolation)
* with both @p before and @p after set to @p extrapolation. * with both @p before and @p after set to @p extrapolation.
*/ */
explicit Track(Containers::Array<std::pair<K, V>>&& data, Interpolation interpolation, Interpolator interpolator, Extrapolation extrapolation = Extrapolation::Constant) noexcept: Track<K, V, R>{std::move(data), interpolation, interpolator, extrapolation, extrapolation} {} explicit Track(Containers::Array<std::pair<K, V>>&& data, Interpolation interpolation, Interpolator interpolator, Extrapolation extrapolation = Extrapolation::Constant) noexcept: Track<K, V, R>{Utility::move(data), interpolation, interpolator, extrapolation, extrapolation} {}
/** @overload */ /** @overload */
explicit Track(std::initializer_list<std::pair<K, V>> data, Interpolation interpolation, Interpolator interpolator, Extrapolation extrapolation = Extrapolation::Constant): Track<K, V, R>{Containers::Array<std::pair<K, V>>{InPlaceInit, data}, interpolation, interpolator, extrapolation} {} explicit Track(std::initializer_list<std::pair<K, V>> data, Interpolation interpolation, Interpolator interpolator, Extrapolation extrapolation = Extrapolation::Constant): Track<K, V, R>{Containers::Array<std::pair<K, V>>{InPlaceInit, data}, interpolation, interpolator, extrapolation} {}
@ -216,7 +216,7 @@ template<class K, class V, class R
* @p interpolation using @ref interpolatorFor(). See its documentation * @p interpolation using @ref interpolatorFor(). See its documentation
* for more information. * for more information.
*/ */
explicit Track(Containers::Array<std::pair<K, V>>&& data, Interpolation interpolation, Extrapolation before, Extrapolation after) noexcept: _data{std::move(data)}, _interpolator{interpolatorFor<V, R>(interpolation)}, _interpolation{interpolation}, _before{before}, _after{after} {} explicit Track(Containers::Array<std::pair<K, V>>&& data, Interpolation interpolation, Extrapolation before, Extrapolation after) noexcept: _data{Utility::move(data)}, _interpolator{interpolatorFor<V, R>(interpolation)}, _interpolation{interpolation}, _before{before}, _after{after} {}
/** @overload */ /** @overload */
explicit Track(std::initializer_list<std::pair<K, V>> data, Interpolation interpolation, Extrapolation before, Extrapolation after): Track<K, V, R>{Containers::Array<std::pair<K, V>>{InPlaceInit, data}, interpolation, before, after} {} explicit Track(std::initializer_list<std::pair<K, V>> data, Interpolation interpolation, Extrapolation before, Extrapolation after): Track<K, V, R>{Containers::Array<std::pair<K, V>>{InPlaceInit, data}, interpolation, before, after} {}
@ -225,7 +225,7 @@ template<class K, class V, class R
* Equivalent to calling @ref Track(Containers::Array<std::pair<K, V>>&&, Interpolation, Extrapolation, Extrapolation) * Equivalent to calling @ref Track(Containers::Array<std::pair<K, V>>&&, Interpolation, Extrapolation, Extrapolation)
* with both @p before and @p after set to @p extrapolation. * with both @p before and @p after set to @p extrapolation.
*/ */
explicit Track(Containers::Array<std::pair<K, V>>&& data, Interpolation interpolation, Extrapolation extrapolation = Extrapolation::Constant) noexcept: Track<K, V, R>{std::move(data), interpolation, extrapolation, extrapolation} {} explicit Track(Containers::Array<std::pair<K, V>>&& data, Interpolation interpolation, Extrapolation extrapolation = Extrapolation::Constant) noexcept: Track<K, V, R>{Utility::move(data), interpolation, extrapolation, extrapolation} {}
/** @overload */ /** @overload */
explicit Track(std::initializer_list<std::pair<K, V>> data, Interpolation interpolation, Extrapolation extrapolation = Extrapolation::Constant): Track<K, V, R>{Containers::Array<std::pair<K, V>>{InPlaceInit, data}, interpolation, extrapolation, extrapolation} {} explicit Track(std::initializer_list<std::pair<K, V>> data, Interpolation interpolation, Extrapolation extrapolation = Extrapolation::Constant): Track<K, V, R>{Containers::Array<std::pair<K, V>>{InPlaceInit, data}, interpolation, extrapolation, extrapolation} {}

2
src/Magnum/Audio/Buffer.h

@ -232,7 +232,7 @@ inline Buffer::Buffer(Buffer&& other): _id(other._id) {
} }
inline Buffer& Buffer::operator=(Buffer&& other) { inline Buffer& Buffer::operator=(Buffer&& other) {
using std::swap; using Utility::swap;
swap(_id, other._id); swap(_id, other._id);
return *this; return *this;
} }

4
src/Magnum/Audio/Context.cpp

@ -315,7 +315,7 @@ bool Context::tryCreate(const Configuration& configuration) {
return true; return true;
} }
Context::Context(Context&& other) noexcept: _device{other._device}, _context{other._context}, _extensionStatus{std::move(other._extensionStatus)}, _supportedExtensions{std::move(other._supportedExtensions)} { Context::Context(Context&& other) noexcept: _device{other._device}, _context{other._context}, _extensionStatus{Utility::move(other._extensionStatus)}, _supportedExtensions{Utility::move(other._supportedExtensions)} {
other._device = nullptr; other._device = nullptr;
other._context = nullptr; other._context = nullptr;
if(currentContext == &other) currentContext = this; if(currentContext == &other) currentContext = this;
@ -409,7 +409,7 @@ Context::Configuration& Context::Configuration::setDeviceSpecifier(const std::st
} }
Context::Configuration& Context::Configuration::setDeviceSpecifier(std::string&& specifier) { Context::Configuration& Context::Configuration::setDeviceSpecifier(std::string&& specifier) {
_deviceSpecifier = std::move(specifier); _deviceSpecifier = Utility::move(specifier);
return *this; return *this;
} }

3
src/Magnum/Audio/Source.h

@ -35,6 +35,7 @@
#include <vector> #include <vector>
#include <Corrade/Containers/Containers.h> #include <Corrade/Containers/Containers.h>
#include <Corrade/Utility/Move.h>
#include "Magnum/Magnum.h" #include "Magnum/Magnum.h"
#include "Magnum/Audio/Audio.h" #include "Magnum/Audio/Audio.h"
@ -779,7 +780,7 @@ inline Source::Source(Source&& other): _id(other._id) {
} }
inline Source& Source::operator=(Source&& other) { inline Source& Source::operator=(Source&& other) {
using std::swap; using Utility::swap;
swap(_id, other._id); swap(_id, other._id);
return *this; return *this;
} }

2
src/Magnum/Audio/Test/ContextALTest.cpp

@ -171,7 +171,7 @@ void ContextALTest::constructMove() {
Int frequency = context.frequency(); Int frequency = context.frequency();
{ {
Context second{std::move(context)}; Context second{Utility::move(context)};
CORRADE_COMPARE(&Context::current(), &second); CORRADE_COMPARE(&Context::current(), &second);
#ifdef CORRADE_TARGET_APPLE #ifdef CORRADE_TARGET_APPLE
if(context.vendorString() == "Apple Computer Inc.") if(context.vendorString() == "Apple Computer Inc.")

4
src/Magnum/DebugTools/CompareImage.cpp

@ -232,7 +232,7 @@ Containers::Triple<Containers::Array<Float>, Float, Float> calculateImageDelta(c
left that could cause the comparison to fail. */ left that could cause the comparison to fail. */
const Float mean = Math::Algorithms::kahanSum(deltaData.begin(), deltaData.end())/deltaData.size(); const Float mean = Math::Algorithms::kahanSum(deltaData.begin(), deltaData.end())/deltaData.size();
return {std::move(deltaData), max, mean}; return {Utility::move(deltaData), max, mean};
} }
namespace { namespace {
@ -543,7 +543,7 @@ TestSuite::ComparisonStatusFlags ImageComparatorBase::compare(const PixelFormat
} else return TestSuite::ComparisonStatusFlags{}; } else return TestSuite::ComparisonStatusFlags{};
/* Otherwise save the deltas and fail */ /* Otherwise save the deltas and fail */
_state->delta = std::move(deltaMaxMean.first()); _state->delta = Utility::move(deltaMaxMean.first());
return flags; return flags;
} }

12
src/Magnum/DebugTools/FrameProfiler.cpp

@ -62,7 +62,7 @@ FrameProfiler::Measurement::Measurement(const Containers::StringView name, const
FrameProfiler::FrameProfiler() noexcept = default; FrameProfiler::FrameProfiler() noexcept = default;
FrameProfiler::FrameProfiler(Containers::Array<Measurement>&& measurements, UnsignedInt maxFrameCount) noexcept { FrameProfiler::FrameProfiler(Containers::Array<Measurement>&& measurements, UnsignedInt maxFrameCount) noexcept {
setup(std::move(measurements), maxFrameCount); setup(Utility::move(measurements), maxFrameCount);
} }
FrameProfiler::FrameProfiler(const std::initializer_list<Measurement> measurements, const UnsignedInt maxFrameCount): FrameProfiler{Containers::array(measurements), maxFrameCount} {} FrameProfiler::FrameProfiler(const std::initializer_list<Measurement> measurements, const UnsignedInt maxFrameCount): FrameProfiler{Containers::array(measurements), maxFrameCount} {}
@ -74,8 +74,8 @@ FrameProfiler::FrameProfiler(FrameProfiler&& other) noexcept:
#endif #endif
_maxFrameCount{other._maxFrameCount}, _maxFrameCount{other._maxFrameCount},
_measuredFrameCount{other._measuredFrameCount}, _measuredFrameCount{other._measuredFrameCount},
_measurements{std::move(other._measurements)}, _measurements{Utility::move(other._measurements)},
_data{std::move(other._data)} _data{Utility::move(other._data)}
{ {
/* For all state pointers that point to &other patch them to point to this /* For all state pointers that point to &other patch them to point to this
instead, to account for 90% of use cases of derived classes */ instead, to account for 90% of use cases of derived classes */
@ -84,7 +84,7 @@ FrameProfiler::FrameProfiler(FrameProfiler&& other) noexcept:
} }
FrameProfiler& FrameProfiler::operator=(FrameProfiler&& other) noexcept { FrameProfiler& FrameProfiler::operator=(FrameProfiler&& other) noexcept {
using std::swap; using Utility::swap;
swap(_enabled, other._enabled); swap(_enabled, other._enabled);
#ifndef CORRADE_NO_ASSERT #ifndef CORRADE_NO_ASSERT
swap(_beginFrameCalled, other._beginFrameCalled); swap(_beginFrameCalled, other._beginFrameCalled);
@ -111,7 +111,7 @@ void FrameProfiler::setup(Containers::Array<Measurement>&& measurements, const U
CORRADE_ASSERT(maxFrameCount >= 1, "DebugTools::FrameProfiler::setup(): max frame count can't be zero", ); CORRADE_ASSERT(maxFrameCount >= 1, "DebugTools::FrameProfiler::setup(): max frame count can't be zero", );
_maxFrameCount = maxFrameCount; _maxFrameCount = maxFrameCount;
_measurements = std::move(measurements); _measurements = Utility::move(measurements);
arrayReserve(_data, maxFrameCount*_measurements.size()); arrayReserve(_data, maxFrameCount*_measurements.size());
#ifndef CORRADE_NO_ASSERT #ifndef CORRADE_NO_ASSERT
@ -573,7 +573,7 @@ void FrameProfilerGL::setup(const Values values, const UnsignedInt maxFrameCount
_state->primitiveClipRatioIndex = index++; _state->primitiveClipRatioIndex = index++;
} }
#endif #endif
setup(std::move(measurements), maxFrameCount); setup(Utility::move(measurements), maxFrameCount);
} }
auto FrameProfilerGL::values() const -> Values { auto FrameProfilerGL::values() const -> Values {

8
src/Magnum/DebugTools/Test/FrameProfilerTest.cpp

@ -698,7 +698,7 @@ void FrameProfilerTest::move() {
}, 5); }, 5);
/* Move construction */ /* Move construction */
MyProfiler b{std::move(a)}; MyProfiler b{Utility::move(a)};
a.j = 100; /* This shouldn't affect b's measurements anymore */ a.j = 100; /* This shouldn't affect b's measurements anymore */
b.beginFrame(); b.beginFrame();
b.endFrame(); b.endFrame();
@ -747,8 +747,8 @@ void FrameProfilerTest::move() {
/* Move assignment */ /* Move assignment */
CORRADE_COMPARE(c.j, 62); CORRADE_COMPARE(c.j, 62);
c = std::move(b); c = Utility::move(b);
b.j = 62; /* std::move() didn't swap this one, so we do; this shouldn't b.j = 62; /* Utility::move() didn't swap this one, so we do; this shouldn't
affect c's measurements anymore */ affect c's measurements anymore */
c.beginFrame(); c.beginFrame();
c.endFrame(); c.endFrame();
@ -1099,7 +1099,7 @@ void FrameProfilerTest::gl() {
/* Test that we use the right state pointers to survive a move */ /* Test that we use the right state pointers to survive a move */
Containers::Pointer<FrameProfilerGL> profiler_{InPlaceInit, data.values, 4u}; Containers::Pointer<FrameProfilerGL> profiler_{InPlaceInit, data.values, 4u};
FrameProfilerGL profiler = std::move(*profiler_); FrameProfilerGL profiler = Utility::move(*profiler_);
profiler_ = nullptr; profiler_ = nullptr;
CORRADE_COMPARE(profiler.values(), data.values); CORRADE_COMPARE(profiler.values(), data.values);
CORRADE_COMPARE(profiler.maxFrameCount(), 4); CORRADE_COMPARE(profiler.maxFrameCount(), 4);

10
src/Magnum/DebugTools/TextureImage.cpp

@ -165,7 +165,7 @@ void textureSubImage(GL::Texture2D& texture, const Int level, const Range2Di& ra
}; };
GL::Buffer buffer{GL::Buffer::TargetHint::Array}; GL::Buffer buffer{GL::Buffer::TargetHint::Array};
buffer.setData(triangle, GL::BufferUsage::StaticDraw); buffer.setData(triangle, GL::BufferUsage::StaticDraw);
mesh.addVertexBuffer(std::move(buffer), 0, GL::Attribute<0, Vector2>{}); mesh.addVertexBuffer(Utility::move(buffer), 0, GL::Attribute<0, Vector2>{});
} }
shader.draw(mesh); shader.draw(mesh);
@ -186,7 +186,7 @@ void textureSubImage(GL::Texture2D& texture, const Int level, const Range2Di& ra
Image2D textureSubImage(GL::Texture2D& texture, const Int level, const Range2Di& range, Image2D&& image) { Image2D textureSubImage(GL::Texture2D& texture, const Int level, const Range2Di& range, Image2D&& image) {
textureSubImage(texture, level, range, image); textureSubImage(texture, level, range, image);
return std::move(image); return Utility::move(image);
} }
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
@ -205,7 +205,7 @@ void textureSubImage(GL::Texture2D& texture, const Int level, const Range2Di& ra
GL::BufferImage2D textureSubImage(GL::Texture2D& texture, const Int level, const Range2Di& range, GL::BufferImage2D&& image, const GL::BufferUsage usage) { GL::BufferImage2D textureSubImage(GL::Texture2D& texture, const Int level, const Range2Di& range, GL::BufferImage2D&& image, const GL::BufferUsage usage) {
textureSubImage(texture, level, range, image, usage); textureSubImage(texture, level, range, image, usage);
return std::move(image); return Utility::move(image);
} }
#endif #endif
@ -217,7 +217,7 @@ void textureSubImage(GL::CubeMapTexture& texture, const GL::CubeMapCoordinate co
Image2D textureSubImage(GL::CubeMapTexture& texture, const GL::CubeMapCoordinate coordinate, const Int level, const Range2Di& range, Image2D&& image) { Image2D textureSubImage(GL::CubeMapTexture& texture, const GL::CubeMapCoordinate coordinate, const Int level, const Range2Di& range, Image2D&& image) {
textureSubImage(texture, coordinate, level, range, image); textureSubImage(texture, coordinate, level, range, image);
return std::move(image); return Utility::move(image);
} }
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
@ -229,7 +229,7 @@ void textureSubImage(GL::CubeMapTexture& texture, const GL::CubeMapCoordinate co
GL::BufferImage2D textureSubImage(GL::CubeMapTexture& texture, const GL::CubeMapCoordinate coordinate, const Int level, const Range2Di& range, GL::BufferImage2D&& image, const GL::BufferUsage usage) { GL::BufferImage2D textureSubImage(GL::CubeMapTexture& texture, const GL::CubeMapCoordinate coordinate, const Int level, const Range2Di& range, GL::BufferImage2D&& image, const GL::BufferUsage usage) {
textureSubImage(texture, coordinate, level, range, image, usage); textureSubImage(texture, coordinate, level, range, image, usage);
return std::move(image); return Utility::move(image);
} }
#endif #endif

6
src/Magnum/GL/AbstractFramebuffer.cpp

@ -376,13 +376,13 @@ void AbstractFramebuffer::read(const Range2Di& rectangle, Image2D& image) {
data = Containers::Array<char>{dataSize}; data = Containers::Array<char>{dataSize};
/* Replace the storage, proxy to the function taking a view */ /* Replace the storage, proxy to the function taking a view */
image = Image2D{image.storage(), image.format(), image.formatExtra(), image.pixelSize(), rectangle.size(), std::move(data), ImageFlags2D{}}; image = Image2D{image.storage(), image.format(), image.formatExtra(), image.pixelSize(), rectangle.size(), Utility::move(data), ImageFlags2D{}};
read(rectangle, MutableImageView2D(image)); read(rectangle, MutableImageView2D(image));
} }
Image2D AbstractFramebuffer::read(const Range2Di& rectangle, Image2D&& image) { Image2D AbstractFramebuffer::read(const Range2Di& rectangle, Image2D&& image) {
read(rectangle, image); read(rectangle, image);
return std::move(image); return Utility::move(image);
} }
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
@ -403,7 +403,7 @@ void AbstractFramebuffer::read(const Range2Di& rectangle, BufferImage2D& image,
BufferImage2D AbstractFramebuffer::read(const Range2Di& rectangle, BufferImage2D&& image, BufferUsage usage) { BufferImage2D AbstractFramebuffer::read(const Range2Di& rectangle, BufferImage2D&& image, BufferUsage usage) {
read(rectangle, image, usage); read(rectangle, image, usage);
return std::move(image); return Utility::move(image);
} }
#endif #endif

4
src/Magnum/GL/AbstractFramebuffer.h

@ -29,8 +29,8 @@
* @brief Class @ref Magnum::GL::AbstractFramebuffer, enum @ref Magnum::GL::FramebufferClear, @ref Magnum::GL::FramebufferBlit, @ref Magnum::GL::FramebufferBlitFilter, @ref Magnum::GL::FramebufferTarget, enum set @ref Magnum::GL::FramebufferClearMask * @brief Class @ref Magnum::GL::AbstractFramebuffer, enum @ref Magnum::GL::FramebufferClear, @ref Magnum::GL::FramebufferBlit, @ref Magnum::GL::FramebufferBlitFilter, @ref Magnum::GL::FramebufferTarget, enum set @ref Magnum::GL::FramebufferClearMask
*/ */
#include <utility> /* std::swap() */
#include <Corrade/Containers/EnumSet.h> #include <Corrade/Containers/EnumSet.h>
#include <Corrade/Utility/Move.h>
#include "Magnum/GL/GL.h" #include "Magnum/GL/GL.h"
#include "Magnum/GL/AbstractObject.h" #include "Magnum/GL/AbstractObject.h"
@ -764,7 +764,7 @@ class MAGNUM_GL_EXPORT AbstractFramebuffer {
} }
AbstractFramebuffer& operator=(const AbstractFramebuffer&) = delete; AbstractFramebuffer& operator=(const AbstractFramebuffer&) = delete;
AbstractFramebuffer& operator=(AbstractFramebuffer&& other) noexcept { AbstractFramebuffer& operator=(AbstractFramebuffer&& other) noexcept {
using std::swap; using Utility::swap;
swap(_id, other._id); swap(_id, other._id);
swap(_viewport, other._viewport); swap(_viewport, other._viewport);
swap(_flags, other._flags); swap(_flags, other._flags);

4
src/Magnum/GL/AbstractQuery.h

@ -29,8 +29,8 @@
* @brief Class @ref Magnum::GL::AbstractQuery * @brief Class @ref Magnum::GL::AbstractQuery
*/ */
#include <utility> /* std::swap() */
#include <Corrade/Utility/Assert.h> #include <Corrade/Utility/Assert.h>
#include <Corrade/Utility/Move.h>
#include "Magnum/Tags.h" #include "Magnum/Tags.h"
#include "Magnum/GL/AbstractObject.h" #include "Magnum/GL/AbstractObject.h"
@ -205,7 +205,7 @@ inline AbstractQuery::AbstractQuery(AbstractQuery&& other) noexcept: _id(other._
} }
inline AbstractQuery& AbstractQuery::operator=(AbstractQuery&& other) noexcept { inline AbstractQuery& AbstractQuery::operator=(AbstractQuery&& other) noexcept {
using std::swap; using Utility::swap;
swap(_id, other._id); swap(_id, other._id);
swap(_target, other._target); swap(_target, other._target);
swap(_flags, other._flags); swap(_flags, other._flags);

4
src/Magnum/GL/AbstractShaderProgram.cpp

@ -316,7 +316,7 @@ AbstractShaderProgram::~AbstractShaderProgram() {
} }
AbstractShaderProgram& AbstractShaderProgram::operator=(AbstractShaderProgram&& other) noexcept { AbstractShaderProgram& AbstractShaderProgram::operator=(AbstractShaderProgram&& other) noexcept {
using std::swap; using Utility::swap;
swap(_id, other._id); swap(_id, other._id);
return *this; return *this;
} }
@ -360,7 +360,7 @@ Containers::Pair<bool, Containers::String> AbstractShaderProgram::validate() {
compile() message trimming it doesn't make sense to add driver-specific compile() message trimming it doesn't make sense to add driver-specific
workarounds for this, so just trim it always. */ workarounds for this, so just trim it always. */
/** @todo this allocates a new string, revisit once String is capable of /** @todo this allocates a new string, revisit once String is capable of
trimming in-place, e.g. `std::move(message).trimmed()` would just trimming in-place, e.g. `Utility::move(message).trimmed()` would just
shift the data around */ shift the data around */
return {bool(success), message.trimmed()}; return {bool(success), message.trimmed()};
} }

8
src/Magnum/GL/AbstractTexture.cpp

@ -1742,7 +1742,7 @@ template<UnsignedInt dimensions> void AbstractTexture::image(const GLint level,
Buffer::unbindInternal(Buffer::TargetHint::PixelPack); Buffer::unbindInternal(Buffer::TargetHint::PixelPack);
Context::current().state().renderer.applyPixelStoragePack(image.storage()); Context::current().state().renderer.applyPixelStoragePack(image.storage());
Context::current().state().texture.getImageImplementation(*this, level, pixelFormat(image.format()), pixelType(image.format(), image.formatExtra()), data.size(), data); Context::current().state().texture.getImageImplementation(*this, level, pixelFormat(image.format()), pixelType(image.format(), image.formatExtra()), data.size(), data);
image = Image<dimensions>{image.storage(), image.format(), image.formatExtra(), image.pixelSize(), size, std::move(data), flags}; image = Image<dimensions>{image.storage(), image.format(), image.formatExtra(), image.pixelSize(), size, Utility::move(data), flags};
} }
template void MAGNUM_GL_EXPORT AbstractTexture::image<1>(GLint, Image<1>&, ImageFlags1D); template void MAGNUM_GL_EXPORT AbstractTexture::image<1>(GLint, Image<1>&, ImageFlags1D);
@ -1810,7 +1810,7 @@ template<UnsignedInt dimensions> void AbstractTexture::compressedImage(const GLi
Buffer::unbindInternal(Buffer::TargetHint::PixelPack); Buffer::unbindInternal(Buffer::TargetHint::PixelPack);
Context::current().state().renderer.applyPixelStoragePack(image.storage()); Context::current().state().renderer.applyPixelStoragePack(image.storage());
Context::current().state().texture.getCompressedImageImplementation(*this, level, data.size(), data); Context::current().state().texture.getCompressedImageImplementation(*this, level, data.size(), data);
image = CompressedImage<dimensions>{image.storage(), CompressedPixelFormat(format), size, std::move(data), flags}; image = CompressedImage<dimensions>{image.storage(), CompressedPixelFormat(format), size, Utility::move(data), flags};
} }
template void MAGNUM_GL_EXPORT AbstractTexture::compressedImage<1>(GLint, CompressedImage<1>&, ImageFlags1D); template void MAGNUM_GL_EXPORT AbstractTexture::compressedImage<1>(GLint, CompressedImage<1>&, ImageFlags1D);
@ -1894,7 +1894,7 @@ template<UnsignedInt dimensions> void AbstractTexture::subImage(const GLint leve
if(data.size() < dataSize) if(data.size() < dataSize)
data = Containers::Array<char>{dataSize}; data = Containers::Array<char>{dataSize};
image = Image<dimensions>{image.storage(), image.format(), image.formatExtra(), image.pixelSize(), size, std::move(data), flags}; image = Image<dimensions>{image.storage(), image.format(), image.formatExtra(), image.pixelSize(), size, Utility::move(data), flags};
subImage(level, range, BasicMutableImageView<dimensions>(image)); subImage(level, range, BasicMutableImageView<dimensions>(image));
} }
@ -1985,7 +1985,7 @@ template<UnsignedInt dimensions> void AbstractTexture::compressedSubImage(const
Buffer::unbindInternal(Buffer::TargetHint::PixelPack); Buffer::unbindInternal(Buffer::TargetHint::PixelPack);
Context::current().state().renderer.applyPixelStoragePack(image.storage()); Context::current().state().renderer.applyPixelStoragePack(image.storage());
glGetCompressedTextureSubImage(_id, level, paddedOffset.x(), paddedOffset.y(), paddedOffset.z(), paddedSize.x(), paddedSize.y(), paddedSize.z(), data.size(), data); glGetCompressedTextureSubImage(_id, level, paddedOffset.x(), paddedOffset.y(), paddedOffset.z(), paddedSize.x(), paddedSize.y(), paddedSize.z(), data.size(), data);
image = CompressedImage<dimensions>{CompressedPixelFormat(format), size, std::move(data), flags}; image = CompressedImage<dimensions>{CompressedPixelFormat(format), size, Utility::move(data), flags};
} }
template void MAGNUM_GL_EXPORT AbstractTexture::compressedSubImage<1>(GLint, const Range1Di&, CompressedImage<1>&, ImageFlags1D); template void MAGNUM_GL_EXPORT AbstractTexture::compressedSubImage<1>(GLint, const Range1Di&, CompressedImage<1>&, ImageFlags1D);

5
src/Magnum/GL/AbstractTexture.h

@ -29,7 +29,8 @@
* @brief Class @ref Magnum::GL::AbstractTexture * @brief Class @ref Magnum::GL::AbstractTexture
*/ */
#include <utility> /* std::swap() */ #include <initializer_list>
#include <Corrade/Utility/Move.h>
#include "Magnum/DimensionTraits.h" #include "Magnum/DimensionTraits.h"
#include "Magnum/ImageFlags.h" #include "Magnum/ImageFlags.h"
@ -815,7 +816,7 @@ inline AbstractTexture::AbstractTexture(AbstractTexture&& other) noexcept: _targ
} }
inline AbstractTexture& AbstractTexture::operator=(AbstractTexture&& other) noexcept { inline AbstractTexture& AbstractTexture::operator=(AbstractTexture&& other) noexcept {
using std::swap; using Utility::swap;
swap(_target, other._target); swap(_target, other._target);
swap(_id, other._id); swap(_id, other._id);
swap(_flags, other._flags); swap(_flags, other._flags);

4
src/Magnum/GL/Buffer.h

@ -32,10 +32,10 @@
*/ */
#include <cstddef> #include <cstddef>
#include <utility> /* std::swap() */
#include <Corrade/Containers/ArrayView.h> #include <Corrade/Containers/ArrayView.h>
#include <Corrade/Containers/EnumSet.h> #include <Corrade/Containers/EnumSet.h>
#include <Corrade/Utility/Assert.h> #include <Corrade/Utility/Assert.h>
#include <Corrade/Utility/Move.h>
#include "Magnum/Tags.h" #include "Magnum/Tags.h"
#include "Magnum/GL/AbstractObject.h" #include "Magnum/GL/AbstractObject.h"
@ -1489,7 +1489,7 @@ inline Buffer::Buffer(Buffer&& other) noexcept: _id{other._id}, _targetHint{othe
} }
inline Buffer& Buffer::operator=(Buffer&& other) noexcept { inline Buffer& Buffer::operator=(Buffer&& other) noexcept {
using std::swap; using Utility::swap;
swap(_id, other._id); swap(_id, other._id);
swap(_targetHint, other._targetHint); swap(_targetHint, other._targetHint);
swap(_flags, other._flags); swap(_flags, other._flags);

20
src/Magnum/GL/BufferImage.cpp

@ -37,11 +37,11 @@ template<UnsignedInt dimensions> BufferImage<dimensions>::BufferImage(const Pixe
template<UnsignedInt dimensions> BufferImage<dimensions>::BufferImage(const PixelStorage storage, const Magnum::PixelFormat format, const VectorTypeFor<dimensions, Int>& size, Containers::ArrayView<const void> const data, const BufferUsage usage): BufferImage{storage, GL::pixelFormat(format), GL::pixelType(format), size, data, usage} {} template<UnsignedInt dimensions> BufferImage<dimensions>::BufferImage(const PixelStorage storage, const Magnum::PixelFormat format, const VectorTypeFor<dimensions, Int>& size, Containers::ArrayView<const void> const data, const BufferUsage usage): BufferImage{storage, GL::pixelFormat(format), GL::pixelType(format), size, data, usage} {}
template<UnsignedInt dimensions> BufferImage<dimensions>::BufferImage(const PixelStorage storage, const PixelFormat format, const PixelType type, const VectorTypeFor<dimensions, Int>& size, Buffer&& buffer, const std::size_t dataSize) noexcept: _storage{storage}, _format{format}, _type{type}, _size{size}, _buffer{std::move(buffer)}, _dataSize{dataSize} { template<UnsignedInt dimensions> BufferImage<dimensions>::BufferImage(const PixelStorage storage, const PixelFormat format, const PixelType type, const VectorTypeFor<dimensions, Int>& size, Buffer&& buffer, const std::size_t dataSize) noexcept: _storage{storage}, _format{format}, _type{type}, _size{size}, _buffer{Utility::move(buffer)}, _dataSize{dataSize} {
CORRADE_ASSERT(Magnum::Implementation::imageDataSize(*this) <= dataSize, "GL::BufferImage::BufferImage(): data too small, got" << dataSize << "but expected at least" << Magnum::Implementation::imageDataSize(*this) << "bytes", ); CORRADE_ASSERT(Magnum::Implementation::imageDataSize(*this) <= dataSize, "GL::BufferImage::BufferImage(): data too small, got" << dataSize << "but expected at least" << Magnum::Implementation::imageDataSize(*this) << "bytes", );
} }
template<UnsignedInt dimensions> BufferImage<dimensions>::BufferImage(const PixelStorage storage, const Magnum::PixelFormat format, const VectorTypeFor<dimensions, Int>& size, Buffer&& buffer, const std::size_t dataSize) noexcept: BufferImage{storage, GL::pixelFormat(format), GL::pixelType(format), size, std::move(buffer), dataSize} {} template<UnsignedInt dimensions> BufferImage<dimensions>::BufferImage(const PixelStorage storage, const Magnum::PixelFormat format, const VectorTypeFor<dimensions, Int>& size, Buffer&& buffer, const std::size_t dataSize) noexcept: BufferImage{storage, GL::pixelFormat(format), GL::pixelType(format), size, Utility::move(buffer), dataSize} {}
template<UnsignedInt dimensions> BufferImage<dimensions>::BufferImage(const PixelStorage storage, const PixelFormat format, const PixelType type): _storage{storage}, _format{format}, _type{type}, _buffer{Buffer::TargetHint::PixelPack}, _dataSize{0} {} template<UnsignedInt dimensions> BufferImage<dimensions>::BufferImage(const PixelStorage storage, const PixelFormat format, const PixelType type): _storage{storage}, _format{format}, _type{type}, _buffer{Buffer::TargetHint::PixelPack}, _dataSize{0} {}
@ -49,12 +49,12 @@ template<UnsignedInt dimensions> BufferImage<dimensions>::BufferImage(const Pixe
template<UnsignedInt dimensions> BufferImage<dimensions>::BufferImage(NoCreateT) noexcept: _format{PixelFormat::RGBA}, _type{PixelType::UnsignedByte}, _buffer{NoCreate}, _dataSize{} {} template<UnsignedInt dimensions> BufferImage<dimensions>::BufferImage(NoCreateT) noexcept: _format{PixelFormat::RGBA}, _type{PixelType::UnsignedByte}, _buffer{NoCreate}, _dataSize{} {}
template<UnsignedInt dimensions> BufferImage<dimensions>::BufferImage(BufferImage<dimensions>&& other) noexcept: _storage{std::move(other._storage)}, _format{std::move(other._format)}, _type{std::move(other._type)}, _size{std::move(other._size)}, _buffer{std::move(other._buffer)}, _dataSize{std::move(other._dataSize)} { template<UnsignedInt dimensions> BufferImage<dimensions>::BufferImage(BufferImage<dimensions>&& other) noexcept: _storage{Utility::move(other._storage)}, _format{Utility::move(other._format)}, _type{Utility::move(other._type)}, _size{Utility::move(other._size)}, _buffer{Utility::move(other._buffer)}, _dataSize{Utility::move(other._dataSize)} {
other._size = {}; other._size = {};
} }
template<UnsignedInt dimensions> BufferImage<dimensions>& BufferImage<dimensions>::operator=(BufferImage<dimensions>&& other) noexcept { template<UnsignedInt dimensions> BufferImage<dimensions>& BufferImage<dimensions>::operator=(BufferImage<dimensions>&& other) noexcept {
using std::swap; using Utility::swap;
swap(_storage, other._storage); swap(_storage, other._storage);
swap(_format, other._format); swap(_format, other._format);
swap(_type, other._type); swap(_type, other._type);
@ -96,21 +96,21 @@ template<UnsignedInt dimensions> CompressedBufferImage<dimensions>::CompressedBu
template<UnsignedInt dimensions> CompressedBufferImage<dimensions>::CompressedBufferImage(const CompressedPixelStorage storage, const Magnum::CompressedPixelFormat format, const VectorTypeFor<dimensions, Int>& size, const Containers::ArrayView<const void> data, const BufferUsage usage): CompressedBufferImage{storage, compressedPixelFormat(format), size, data, usage} {} template<UnsignedInt dimensions> CompressedBufferImage<dimensions>::CompressedBufferImage(const CompressedPixelStorage storage, const Magnum::CompressedPixelFormat format, const VectorTypeFor<dimensions, Int>& size, const Containers::ArrayView<const void> data, const BufferUsage usage): CompressedBufferImage{storage, compressedPixelFormat(format), size, data, usage} {}
template<UnsignedInt dimensions> CompressedBufferImage<dimensions>::CompressedBufferImage(const CompressedPixelStorage storage, const CompressedPixelFormat format, const VectorTypeFor<dimensions, Int>& size, Buffer&& buffer, const std::size_t dataSize) noexcept: _storage{storage}, _format{format}, _size{size}, _buffer{std::move(buffer)}, _dataSize{dataSize} {} template<UnsignedInt dimensions> CompressedBufferImage<dimensions>::CompressedBufferImage(const CompressedPixelStorage storage, const CompressedPixelFormat format, const VectorTypeFor<dimensions, Int>& size, Buffer&& buffer, const std::size_t dataSize) noexcept: _storage{storage}, _format{format}, _size{size}, _buffer{Utility::move(buffer)}, _dataSize{dataSize} {}
template<UnsignedInt dimensions> CompressedBufferImage<dimensions>::CompressedBufferImage(const CompressedPixelStorage storage, const Magnum::CompressedPixelFormat format, const VectorTypeFor<dimensions, Int>& size, Buffer&& buffer, const std::size_t dataSize) noexcept: CompressedBufferImage{storage, compressedPixelFormat(format), size, std::move(buffer), dataSize} {} template<UnsignedInt dimensions> CompressedBufferImage<dimensions>::CompressedBufferImage(const CompressedPixelStorage storage, const Magnum::CompressedPixelFormat format, const VectorTypeFor<dimensions, Int>& size, Buffer&& buffer, const std::size_t dataSize) noexcept: CompressedBufferImage{storage, compressedPixelFormat(format), size, Utility::move(buffer), dataSize} {}
template<UnsignedInt dimensions> CompressedBufferImage<dimensions>::CompressedBufferImage(const CompressedPixelStorage storage): _storage{storage}, _format{}, _buffer{Buffer::TargetHint::PixelPack}, _dataSize{} {} template<UnsignedInt dimensions> CompressedBufferImage<dimensions>::CompressedBufferImage(const CompressedPixelStorage storage): _storage{storage}, _format{}, _buffer{Buffer::TargetHint::PixelPack}, _dataSize{} {}
template<UnsignedInt dimensions> CompressedBufferImage<dimensions>::CompressedBufferImage(NoCreateT) noexcept: _format{}, _buffer{NoCreate}, _dataSize{} {} template<UnsignedInt dimensions> CompressedBufferImage<dimensions>::CompressedBufferImage(NoCreateT) noexcept: _format{}, _buffer{NoCreate}, _dataSize{} {}
template<UnsignedInt dimensions> CompressedBufferImage<dimensions>::CompressedBufferImage(CompressedBufferImage<dimensions>&& other) noexcept: _storage{std::move(other._storage)}, _format{std::move(other._format)}, _size{std::move(other._size)}, _buffer{std::move(other._buffer)}, _dataSize{std::move(other._dataSize)} { template<UnsignedInt dimensions> CompressedBufferImage<dimensions>::CompressedBufferImage(CompressedBufferImage<dimensions>&& other) noexcept: _storage{Utility::move(other._storage)}, _format{Utility::move(other._format)}, _size{Utility::move(other._size)}, _buffer{Utility::move(other._buffer)}, _dataSize{Utility::move(other._dataSize)} {
other._size = {}; other._size = {};
other._dataSize = {}; other._dataSize = {};
} }
template<UnsignedInt dimensions> CompressedBufferImage<dimensions>& CompressedBufferImage<dimensions>::operator=(CompressedBufferImage<dimensions>&& other) noexcept { template<UnsignedInt dimensions> CompressedBufferImage<dimensions>& CompressedBufferImage<dimensions>::operator=(CompressedBufferImage<dimensions>&& other) noexcept {
using std::swap; using Utility::swap;
swap(_storage, other._storage); swap(_storage, other._storage);
swap(_format, other._format); swap(_format, other._format);
swap(_size, other._size); swap(_size, other._size);
@ -139,13 +139,13 @@ template<UnsignedInt dimensions> void CompressedBufferImage<dimensions>::setData
template<UnsignedInt dimensions> Buffer BufferImage<dimensions>::release() { template<UnsignedInt dimensions> Buffer BufferImage<dimensions>::release() {
_size = {}; _size = {};
_dataSize = {}; _dataSize = {};
return std::move(_buffer); return Utility::move(_buffer);
} }
template<UnsignedInt dimensions> Buffer CompressedBufferImage<dimensions>::release() { template<UnsignedInt dimensions> Buffer CompressedBufferImage<dimensions>::release() {
_size = {}; _size = {};
_dataSize = {}; _dataSize = {};
return std::move(_buffer); return Utility::move(_buffer);
} }
#ifndef DOXYGEN_GENERATING_OUTPUT #ifndef DOXYGEN_GENERATING_OUTPUT

8
src/Magnum/GL/BufferImage.h

@ -174,7 +174,7 @@ template<UnsignedInt dimensions> class BufferImage {
* Equivalent to calling @ref BufferImage(PixelStorage, PixelFormat, PixelType, const VectorTypeFor<dimensions, Int>&, Buffer&&, std::size_t) * Equivalent to calling @ref BufferImage(PixelStorage, PixelFormat, PixelType, const VectorTypeFor<dimensions, Int>&, Buffer&&, std::size_t)
* with default-constructed @ref PixelStorage. * with default-constructed @ref PixelStorage.
*/ */
explicit BufferImage(PixelFormat format, PixelType type, const VectorTypeFor<dimensions, Int>& size, Buffer&& buffer, std::size_t dataSize) noexcept: BufferImage{{}, format, type, size, std::move(buffer), dataSize} {} explicit BufferImage(PixelFormat format, PixelType type, const VectorTypeFor<dimensions, Int>& size, Buffer&& buffer, std::size_t dataSize) noexcept: BufferImage{{}, format, type, size, Utility::move(buffer), dataSize} {}
/** /**
* @brief Construct from existing buffer * @brief Construct from existing buffer
@ -200,7 +200,7 @@ template<UnsignedInt dimensions> class BufferImage {
* Equivalent to calling @ref BufferImage(PixelStorage, Magnum::PixelFormat, const VectorTypeFor<dimensions, Int>&, Buffer&&, std::size_t) * Equivalent to calling @ref BufferImage(PixelStorage, Magnum::PixelFormat, const VectorTypeFor<dimensions, Int>&, Buffer&&, std::size_t)
* with default-constructed @ref PixelStorage. * with default-constructed @ref PixelStorage.
*/ */
explicit BufferImage(Magnum::PixelFormat format, const VectorTypeFor<dimensions, Int>& size, Buffer&& buffer, std::size_t dataSize) noexcept: BufferImage{{}, format, size, std::move(buffer), dataSize} {} explicit BufferImage(Magnum::PixelFormat format, const VectorTypeFor<dimensions, Int>& size, Buffer&& buffer, std::size_t dataSize) noexcept: BufferImage{{}, format, size, Utility::move(buffer), dataSize} {}
/** /**
* @brief Construct an image placeholder * @brief Construct an image placeholder
@ -524,7 +524,7 @@ template<UnsignedInt dimensions> class CompressedBufferImage {
* Equivalent to calling @ref CompressedBufferImage(CompressedPixelStorage, CompressedPixelFormat, const VectorTypeFor<dimensions, Int>&, Buffer&&, std::size_t) * Equivalent to calling @ref CompressedBufferImage(CompressedPixelStorage, CompressedPixelFormat, const VectorTypeFor<dimensions, Int>&, Buffer&&, std::size_t)
* with default-constructed @ref CompressedPixelStorage. * with default-constructed @ref CompressedPixelStorage.
*/ */
explicit CompressedBufferImage(CompressedPixelFormat format, const VectorTypeFor<dimensions, Int>& size, Buffer&& buffer, std::size_t dataSize) noexcept: CompressedBufferImage{{}, format, size, std::move(buffer), dataSize} {} explicit CompressedBufferImage(CompressedPixelFormat format, const VectorTypeFor<dimensions, Int>& size, Buffer&& buffer, std::size_t dataSize) noexcept: CompressedBufferImage{{}, format, size, Utility::move(buffer), dataSize} {}
/** /**
* @brief Construct from existing buffer * @brief Construct from existing buffer
@ -550,7 +550,7 @@ template<UnsignedInt dimensions> class CompressedBufferImage {
* Equivalent to calling @ref CompressedBufferImage(CompressedPixelStorage, Magnum::CompressedPixelFormat, const VectorTypeFor<dimensions, Int>&, Buffer&&, std::size_t) * Equivalent to calling @ref CompressedBufferImage(CompressedPixelStorage, Magnum::CompressedPixelFormat, const VectorTypeFor<dimensions, Int>&, Buffer&&, std::size_t)
* with default-constructed @ref CompressedPixelStorage. * with default-constructed @ref CompressedPixelStorage.
*/ */
explicit CompressedBufferImage(Magnum::CompressedPixelFormat format, const VectorTypeFor<dimensions, Int>& size, Buffer&& buffer, std::size_t dataSize) noexcept: CompressedBufferImage{{}, format, size, std::move(buffer), dataSize} {} explicit CompressedBufferImage(Magnum::CompressedPixelFormat format, const VectorTypeFor<dimensions, Int>& size, Buffer&& buffer, std::size_t dataSize) noexcept: CompressedBufferImage{{}, format, size, Utility::move(buffer), dataSize} {}
/** /**
* @brief Construct an image placeholder * @brief Construct an image placeholder

10
src/Magnum/GL/Context.cpp

@ -773,12 +773,12 @@ Context::Context(Context&& other) noexcept:
_extensionStatus{other._extensionStatus}, _extensionStatus{other._extensionStatus},
_extensionRequiredVersion{other._extensionRequiredVersion}, _extensionRequiredVersion{other._extensionRequiredVersion},
#ifdef MAGNUM_BUILD_DEPRECATED #ifdef MAGNUM_BUILD_DEPRECATED
_supportedExtensions{std::move(other._supportedExtensions)}, _supportedExtensions{Utility::move(other._supportedExtensions)},
#endif #endif
_state{other._state}, _state{other._state},
_detectedDrivers{std::move(other._detectedDrivers)}, _detectedDrivers{Utility::move(other._detectedDrivers)},
_driverWorkarounds{std::move(other._driverWorkarounds)}, _driverWorkarounds{Utility::move(other._driverWorkarounds)},
_disabledExtensions{std::move(other._disabledExtensions)}, _disabledExtensions{Utility::move(other._disabledExtensions)},
_configurationFlags{other._configurationFlags} _configurationFlags{other._configurationFlags}
{ {
if(currentContext == &other) currentContext = this; if(currentContext == &other) currentContext = this;
@ -1003,7 +1003,7 @@ bool Context::tryCreate(const Configuration& configuration) {
} }
Containers::Pair<Containers::ArrayTuple, Containers::Reference<Implementation::State>> state = Implementation::State::allocate(*this, output); Containers::Pair<Containers::ArrayTuple, Containers::Reference<Implementation::State>> state = Implementation::State::allocate(*this, output);
_stateData = std::move(state.first()); _stateData = Utility::move(state.first());
_state = &*state.second(); _state = &*state.second();
/* Print a list of used workarounds */ /* Print a list of used workarounds */

34
src/Magnum/GL/CubeMapTexture.cpp

@ -109,12 +109,12 @@ void CubeMapTexture::image(const Int level, Image3D& image) {
Buffer::unbindInternal(Buffer::TargetHint::PixelPack); Buffer::unbindInternal(Buffer::TargetHint::PixelPack);
Context::current().state().renderer.applyPixelStoragePack(image.storage()); Context::current().state().renderer.applyPixelStoragePack(image.storage());
Context::current().state().texture.getCubeImage3DImplementation(*this, level, size, pixelFormat(image.format()), pixelType(image.format(), image.formatExtra()), data.size(), data, image.storage()); Context::current().state().texture.getCubeImage3DImplementation(*this, level, size, pixelFormat(image.format()), pixelType(image.format(), image.formatExtra()), data.size(), data, image.storage());
image = Image3D{image.storage(), image.format(), image.formatExtra(), image.pixelSize(), size, std::move(data), ImageFlag3D::CubeMap}; image = Image3D{image.storage(), image.format(), image.formatExtra(), image.pixelSize(), size, Utility::move(data), ImageFlag3D::CubeMap};
} }
Image3D CubeMapTexture::image(const Int level, Image3D&& image) { Image3D CubeMapTexture::image(const Int level, Image3D&& image) {
this->image(level, image); this->image(level, image);
return std::move(image); return Utility::move(image);
} }
void CubeMapTexture::image(const Int level, const MutableImageView3D& image) { void CubeMapTexture::image(const Int level, const MutableImageView3D& image) {
@ -148,7 +148,7 @@ void CubeMapTexture::image(const Int level, BufferImage3D& image, const BufferUs
BufferImage3D CubeMapTexture::image(const Int level, BufferImage3D&& image, const BufferUsage usage) { BufferImage3D CubeMapTexture::image(const Int level, BufferImage3D&& image, const BufferUsage usage) {
this->image(level, image, usage); this->image(level, image, usage);
return std::move(image); return Utility::move(image);
} }
void CubeMapTexture::compressedImage(const Int level, CompressedImage3D& image) { void CubeMapTexture::compressedImage(const Int level, CompressedImage3D& image) {
@ -180,12 +180,12 @@ void CubeMapTexture::compressedImage(const Int level, CompressedImage3D& image)
Buffer::unbindInternal(Buffer::TargetHint::PixelPack); Buffer::unbindInternal(Buffer::TargetHint::PixelPack);
Context::current().state().renderer.applyPixelStoragePack(image.storage()); Context::current().state().renderer.applyPixelStoragePack(image.storage());
Context::current().state().texture.getCompressedCubeImage3DImplementation(*this, level, size.xy(), dataOffsetSize.first, dataOffsetSize.second, data); Context::current().state().texture.getCompressedCubeImage3DImplementation(*this, level, size.xy(), dataOffsetSize.first, dataOffsetSize.second, data);
image = CompressedImage3D{image.storage(), CompressedPixelFormat(format), size, std::move(data), ImageFlag3D::CubeMap}; image = CompressedImage3D{image.storage(), CompressedPixelFormat(format), size, Utility::move(data), ImageFlag3D::CubeMap};
} }
CompressedImage3D CubeMapTexture::compressedImage(const Int level, CompressedImage3D&& image) { CompressedImage3D CubeMapTexture::compressedImage(const Int level, CompressedImage3D&& image) {
compressedImage(level, image); compressedImage(level, image);
return std::move(image); return Utility::move(image);
} }
void CubeMapTexture::compressedImage(const Int level, const MutableCompressedImageView3D& image) { void CubeMapTexture::compressedImage(const Int level, const MutableCompressedImageView3D& image) {
@ -259,7 +259,7 @@ void CubeMapTexture::compressedImage(const Int level, CompressedBufferImage3D& i
CompressedBufferImage3D CubeMapTexture::compressedImage(const Int level, CompressedBufferImage3D&& image, const BufferUsage usage) { CompressedBufferImage3D CubeMapTexture::compressedImage(const Int level, CompressedBufferImage3D&& image, const BufferUsage usage) {
compressedImage(level, image, usage); compressedImage(level, image, usage);
return std::move(image); return Utility::move(image);
} }
void CubeMapTexture::image(const CubeMapCoordinate coordinate, const Int level, Image2D& image) { void CubeMapTexture::image(const CubeMapCoordinate coordinate, const Int level, Image2D& image) {
@ -274,12 +274,12 @@ void CubeMapTexture::image(const CubeMapCoordinate coordinate, const Int level,
Buffer::unbindInternal(Buffer::TargetHint::PixelPack); Buffer::unbindInternal(Buffer::TargetHint::PixelPack);
Context::current().state().renderer.applyPixelStoragePack(image.storage()); Context::current().state().renderer.applyPixelStoragePack(image.storage());
Context::current().state().texture.getCubeImageImplementation(*this, coordinate, level, size, pixelFormat(image.format()), pixelType(image.format(), image.formatExtra()), data.size(), data); Context::current().state().texture.getCubeImageImplementation(*this, coordinate, level, size, pixelFormat(image.format()), pixelType(image.format(), image.formatExtra()), data.size(), data);
image = Image2D{image.storage(), image.format(), image.formatExtra(), image.pixelSize(), size, std::move(data), ImageFlags2D{}}; image = Image2D{image.storage(), image.format(), image.formatExtra(), image.pixelSize(), size, Utility::move(data), ImageFlags2D{}};
} }
Image2D CubeMapTexture::image(const CubeMapCoordinate coordinate, const Int level, Image2D&& image) { Image2D CubeMapTexture::image(const CubeMapCoordinate coordinate, const Int level, Image2D&& image) {
this->image(coordinate, level, image); this->image(coordinate, level, image);
return std::move(image); return Utility::move(image);
} }
void CubeMapTexture::image(const CubeMapCoordinate coordinate, const Int level, const MutableImageView2D& image) { void CubeMapTexture::image(const CubeMapCoordinate coordinate, const Int level, const MutableImageView2D& image) {
@ -311,7 +311,7 @@ void CubeMapTexture::image(const CubeMapCoordinate coordinate, const Int level,
BufferImage2D CubeMapTexture::image(const CubeMapCoordinate coordinate, const Int level, BufferImage2D&& image, const BufferUsage usage) { BufferImage2D CubeMapTexture::image(const CubeMapCoordinate coordinate, const Int level, BufferImage2D&& image, const BufferUsage usage) {
this->image(coordinate, level, image, usage); this->image(coordinate, level, image, usage);
return std::move(image); return Utility::move(image);
} }
void CubeMapTexture::compressedImage(const CubeMapCoordinate coordinate, const Int level, CompressedImage2D& image) { void CubeMapTexture::compressedImage(const CubeMapCoordinate coordinate, const Int level, CompressedImage2D& image) {
@ -339,12 +339,12 @@ void CubeMapTexture::compressedImage(const CubeMapCoordinate coordinate, const I
Buffer::unbindInternal(Buffer::TargetHint::PixelPack); Buffer::unbindInternal(Buffer::TargetHint::PixelPack);
Context::current().state().renderer.applyPixelStoragePack(image.storage()); Context::current().state().renderer.applyPixelStoragePack(image.storage());
Context::current().state().texture.getCompressedCubeImageImplementation(*this, coordinate, level, size, data.size(), data); Context::current().state().texture.getCompressedCubeImageImplementation(*this, coordinate, level, size, data.size(), data);
image = CompressedImage2D{image.storage(), CompressedPixelFormat(format), size, std::move(data), ImageFlags2D{}}; image = CompressedImage2D{image.storage(), CompressedPixelFormat(format), size, Utility::move(data), ImageFlags2D{}};
} }
CompressedImage2D CubeMapTexture::compressedImage(const CubeMapCoordinate coordinate, const Int level, CompressedImage2D&& image) { CompressedImage2D CubeMapTexture::compressedImage(const CubeMapCoordinate coordinate, const Int level, CompressedImage2D&& image) {
compressedImage(coordinate, level, image); compressedImage(coordinate, level, image);
return std::move(image); return Utility::move(image);
} }
void CubeMapTexture::compressedImage(const CubeMapCoordinate coordinate, const Int level, const MutableCompressedImageView2D& image) { void CubeMapTexture::compressedImage(const CubeMapCoordinate coordinate, const Int level, const MutableCompressedImageView2D& image) {
@ -412,17 +412,17 @@ void CubeMapTexture::compressedImage(const CubeMapCoordinate coordinate, const I
CompressedBufferImage2D CubeMapTexture::compressedImage(const CubeMapCoordinate coordinate, const Int level, CompressedBufferImage2D&& image, const BufferUsage usage) { CompressedBufferImage2D CubeMapTexture::compressedImage(const CubeMapCoordinate coordinate, const Int level, CompressedBufferImage2D&& image, const BufferUsage usage) {
compressedImage(coordinate, level, image, usage); compressedImage(coordinate, level, image, usage);
return std::move(image); return Utility::move(image);
} }
Image3D CubeMapTexture::subImage(const Int level, const Range3Di& range, Image3D&& image) { Image3D CubeMapTexture::subImage(const Int level, const Range3Di& range, Image3D&& image) {
this->subImage(level, range, image); this->subImage(level, range, image);
return std::move(image); return Utility::move(image);
} }
BufferImage3D CubeMapTexture::subImage(const Int level, const Range3Di& range, BufferImage3D&& image, const BufferUsage usage) { BufferImage3D CubeMapTexture::subImage(const Int level, const Range3Di& range, BufferImage3D&& image, const BufferUsage usage) {
this->subImage(level, range, image, usage); this->subImage(level, range, image, usage);
return std::move(image); return Utility::move(image);
} }
void CubeMapTexture::compressedSubImage(const Int level, const Range3Di& range, CompressedImage3D& image) { void CubeMapTexture::compressedSubImage(const Int level, const Range3Di& range, CompressedImage3D& image) {
@ -453,12 +453,12 @@ void CubeMapTexture::compressedSubImage(const Int level, const Range3Di& range,
/* Would be CubeMap if the whole image was queried, but then we'd have to /* Would be CubeMap if the whole image was queried, but then we'd have to
query the size and compare, which is extra work. So it's Array query the size and compare, which is extra work. So it's Array
instead. */ instead. */
image = CompressedImage3D{CompressedPixelFormat(format), range.size(), std::move(data), ImageFlag3D::Array}; image = CompressedImage3D{CompressedPixelFormat(format), range.size(), Utility::move(data), ImageFlag3D::Array};
} }
CompressedImage3D CubeMapTexture::compressedSubImage(const Int level, const Range3Di& range, CompressedImage3D&& image) { CompressedImage3D CubeMapTexture::compressedSubImage(const Int level, const Range3Di& range, CompressedImage3D&& image) {
compressedSubImage(level, range, image); compressedSubImage(level, range, image);
return std::move(image); return Utility::move(image);
} }
void CubeMapTexture::compressedSubImage(const Int level, const Range3Di& range, const MutableCompressedImageView3D& image) { void CubeMapTexture::compressedSubImage(const Int level, const Range3Di& range, const MutableCompressedImageView3D& image) {
@ -526,7 +526,7 @@ void CubeMapTexture::compressedSubImage(const Int level, const Range3Di& range,
CompressedBufferImage3D CubeMapTexture::compressedSubImage(const Int level, const Range3Di& range, CompressedBufferImage3D&& image, const BufferUsage usage) { CompressedBufferImage3D CubeMapTexture::compressedSubImage(const Int level, const Range3Di& range, CompressedBufferImage3D&& image, const BufferUsage usage) {
compressedSubImage(level, range, image, usage); compressedSubImage(level, range, image, usage);
return std::move(image); return Utility::move(image);
} }
#endif #endif

16
src/Magnum/GL/CubeMapTextureArray.cpp

@ -75,42 +75,42 @@ CubeMapTextureArray CubeMapTextureArray::view(CubeMapTexture& original, const Te
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
Image3D CubeMapTextureArray::image(const Int level, Image3D&& image) { Image3D CubeMapTextureArray::image(const Int level, Image3D&& image) {
this->image(level, image); this->image(level, image);
return std::move(image); return Utility::move(image);
} }
BufferImage3D CubeMapTextureArray::image(const Int level, BufferImage3D&& image, const BufferUsage usage) { BufferImage3D CubeMapTextureArray::image(const Int level, BufferImage3D&& image, const BufferUsage usage) {
this->image(level, image, usage); this->image(level, image, usage);
return std::move(image); return Utility::move(image);
} }
CompressedImage3D CubeMapTextureArray::compressedImage(const Int level, CompressedImage3D&& image) { CompressedImage3D CubeMapTextureArray::compressedImage(const Int level, CompressedImage3D&& image) {
compressedImage(level, image); compressedImage(level, image);
return std::move(image); return Utility::move(image);
} }
CompressedBufferImage3D CubeMapTextureArray::compressedImage(const Int level, CompressedBufferImage3D&& image, const BufferUsage usage) { CompressedBufferImage3D CubeMapTextureArray::compressedImage(const Int level, CompressedBufferImage3D&& image, const BufferUsage usage) {
compressedImage(level, image, usage); compressedImage(level, image, usage);
return std::move(image); return Utility::move(image);
} }
Image3D CubeMapTextureArray::subImage(const Int level, const Range3Di& range, Image3D&& image) { Image3D CubeMapTextureArray::subImage(const Int level, const Range3Di& range, Image3D&& image) {
this->subImage(level, range, image); this->subImage(level, range, image);
return std::move(image); return Utility::move(image);
} }
BufferImage3D CubeMapTextureArray::subImage(const Int level, const Range3Di& range, BufferImage3D&& image, const BufferUsage usage) { BufferImage3D CubeMapTextureArray::subImage(const Int level, const Range3Di& range, BufferImage3D&& image, const BufferUsage usage) {
this->subImage(level, range, image, usage); this->subImage(level, range, image, usage);
return std::move(image); return Utility::move(image);
} }
CompressedImage3D CubeMapTextureArray::compressedSubImage(const Int level, const Range3Di& range, CompressedImage3D&& image) { CompressedImage3D CubeMapTextureArray::compressedSubImage(const Int level, const Range3Di& range, CompressedImage3D&& image) {
compressedSubImage(level, range, image); compressedSubImage(level, range, image);
return std::move(image); return Utility::move(image);
} }
CompressedBufferImage3D CubeMapTextureArray::compressedSubImage(const Int level, const Range3Di& range, CompressedBufferImage3D&& image, const BufferUsage usage) { CompressedBufferImage3D CubeMapTextureArray::compressedSubImage(const Int level, const Range3Di& range, CompressedBufferImage3D&& image, const BufferUsage usage) {
compressedSubImage(level, range, image, usage); compressedSubImage(level, range, image, usage);
return std::move(image); return Utility::move(image);
} }
#endif #endif

2
src/Magnum/GL/Implementation/State.cpp

@ -170,7 +170,7 @@ Containers::Pair<Containers::ArrayTuple, Containers::Reference<State>> State::al
for(const char* extension: extensions) for(const char* extension: extensions)
if(extension) Debug(out) << " " << extension; if(extension) Debug(out) << " " << extension;
return {std::move(data), state}; return {Utility::move(data), state};
} }
}}} }}}

44
src/Magnum/GL/Mesh.cpp

@ -289,15 +289,15 @@ Mesh::Mesh(Mesh&& other) noexcept: _id(other._id), _primitive(other._primitive),
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
_indexStart(other._indexStart), _indexEnd(other._indexEnd), _indexStart(other._indexStart), _indexEnd(other._indexEnd),
#endif #endif
_indexBufferOffset(other._indexBufferOffset), _indexOffset(other._indexOffset), _indexType(other._indexType), _indexBuffer{std::move(other._indexBuffer)} _indexBufferOffset(other._indexBufferOffset), _indexOffset(other._indexOffset), _indexType(other._indexType), _indexBuffer{Utility::move(other._indexBuffer)}
{ {
if(_constructed || other._constructed) if(_constructed || other._constructed)
Context::current().state().mesh.moveConstructImplementation(*this, std::move(other)); Context::current().state().mesh.moveConstructImplementation(*this, Utility::move(other));
other._id = 0; other._id = 0;
} }
Mesh& Mesh::operator=(Mesh&& other) noexcept { Mesh& Mesh::operator=(Mesh&& other) noexcept {
using std::swap; using Utility::swap;
swap(_id, other._id); swap(_id, other._id);
swap(_flags, other._flags); swap(_flags, other._flags);
swap(_primitive, other._primitive); swap(_primitive, other._primitive);
@ -318,7 +318,7 @@ Mesh& Mesh::operator=(Mesh&& other) noexcept {
swap(_indexBuffer, other._indexBuffer); swap(_indexBuffer, other._indexBuffer);
if(_constructed || other._constructed) if(_constructed || other._constructed)
Context::current().state().mesh.moveAssignImplementation(*this, std::move(other)); Context::current().state().mesh.moveAssignImplementation(*this, Utility::move(other));
return *this; return *this;
} }
@ -406,7 +406,7 @@ Mesh& Mesh::setIndexBuffer(Buffer&& buffer, GLintptr offset, MeshIndexType type,
tracker to _indexBuffer.id(). */ tracker to _indexBuffer.id(). */
Context::current().state().mesh.bindIndexBufferImplementation(*this, buffer); Context::current().state().mesh.bindIndexBufferImplementation(*this, buffer);
_indexBuffer = std::move(buffer); _indexBuffer = Utility::move(buffer);
_indexBufferOffset = offset; _indexBufferOffset = offset;
_indexType = type; _indexType = type;
#ifndef MAGNUM_TARGET_GLES2 #ifndef MAGNUM_TARGET_GLES2
@ -1070,12 +1070,12 @@ void Mesh::createImplementationVAODSA(Mesh& self, const bool createObject) {
#endif #endif
void Mesh::moveConstructImplementationDefault(Mesh& self, Mesh&& other) { void Mesh::moveConstructImplementationDefault(Mesh& self, Mesh&& other) {
new(&self._attributes) std::vector<AttributeLayout>{std::move(*reinterpret_cast<std::vector<AttributeLayout>*>(&other._attributes))}; new(&self._attributes) std::vector<AttributeLayout>{Utility::move(*reinterpret_cast<std::vector<AttributeLayout>*>(&other._attributes))};
self._constructed = true; self._constructed = true;
} }
void Mesh::moveConstructImplementationVAO(Mesh& self, Mesh&& other) { void Mesh::moveConstructImplementationVAO(Mesh& self, Mesh&& other) {
new(&self._attributes) std::vector<Buffer>{std::move(*reinterpret_cast<std::vector<Buffer>*>(&other._attributes))}; new(&self._attributes) std::vector<Buffer>{Utility::move(*reinterpret_cast<std::vector<Buffer>*>(&other._attributes))};
self._constructed = true; self._constructed = true;
} }
@ -1087,27 +1087,27 @@ void Mesh::moveConstructImplementationVAO(Mesh& self, Mesh&& other) {
void Mesh::moveAssignImplementationDefault(Mesh& self, Mesh&& other) { void Mesh::moveAssignImplementationDefault(Mesh& self, Mesh&& other) {
if(self._constructed && other._constructed) if(self._constructed && other._constructed)
std::swap(*reinterpret_cast<std::vector<AttributeLayout>*>(&self._attributes), Utility::swap(*reinterpret_cast<std::vector<AttributeLayout>*>(&self._attributes),
*reinterpret_cast<std::vector<AttributeLayout>*>(&other._attributes)); *reinterpret_cast<std::vector<AttributeLayout>*>(&other._attributes));
else if(self._constructed && !other._constructed) { else if(self._constructed && !other._constructed) {
other._constructed = true; other._constructed = true;
new(&other._attributes) std::vector<AttributeLayout>{std::move(*reinterpret_cast<std::vector<AttributeLayout>*>(&self._attributes))}; new(&other._attributes) std::vector<AttributeLayout>{Utility::move(*reinterpret_cast<std::vector<AttributeLayout>*>(&self._attributes))};
} else if(!self._constructed && other._constructed) { } else if(!self._constructed && other._constructed) {
self._constructed = true; self._constructed = true;
new(&self._attributes) std::vector<AttributeLayout>{std::move(*reinterpret_cast<std::vector<AttributeLayout>*>(&other._attributes))}; new(&self._attributes) std::vector<AttributeLayout>{Utility::move(*reinterpret_cast<std::vector<AttributeLayout>*>(&other._attributes))};
} }
} }
void Mesh::moveAssignImplementationVAO(Mesh& self, Mesh&& other) { void Mesh::moveAssignImplementationVAO(Mesh& self, Mesh&& other) {
if(self._constructed && other._constructed) if(self._constructed && other._constructed)
std::swap(*reinterpret_cast<std::vector<Buffer>*>(&self._attributes), Utility::swap(*reinterpret_cast<std::vector<Buffer>*>(&self._attributes),
*reinterpret_cast<std::vector<Buffer>*>(&other._attributes)); *reinterpret_cast<std::vector<Buffer>*>(&other._attributes));
else if(self._constructed && !other._constructed) { else if(self._constructed && !other._constructed) {
other._constructed = true; other._constructed = true;
new(&other._attributes) std::vector<Buffer>{std::move(*reinterpret_cast<std::vector<Buffer>*>(&self._attributes))}; new(&other._attributes) std::vector<Buffer>{Utility::move(*reinterpret_cast<std::vector<Buffer>*>(&self._attributes))};
} else if(!self._constructed && other._constructed) { } else if(!self._constructed && other._constructed) {
self._constructed = true; self._constructed = true;
new(&self._attributes) std::vector<Buffer>{std::move(*reinterpret_cast<std::vector<Buffer>*>(&other._attributes))}; new(&self._attributes) std::vector<Buffer>{Utility::move(*reinterpret_cast<std::vector<Buffer>*>(&other._attributes))};
} }
} }
@ -1134,7 +1134,7 @@ void Mesh::attributePointerInternal(const Buffer& buffer, const GLuint location,
void Mesh::attributePointerInternal(AttributeLayout&& attribute) { void Mesh::attributePointerInternal(AttributeLayout&& attribute) {
CORRADE_ASSERT(attribute.buffer.id(), CORRADE_ASSERT(attribute.buffer.id(),
"GL::Mesh::addVertexBuffer(): empty or moved-out Buffer instance was passed", ); "GL::Mesh::addVertexBuffer(): empty or moved-out Buffer instance was passed", );
Context::current().state().mesh.attributePointerImplementation(*this, std::move(attribute)); Context::current().state().mesh.attributePointerImplementation(*this, Utility::move(attribute));
} }
void Mesh::attributePointerImplementationDefault(Mesh& self, AttributeLayout&& attribute) { void Mesh::attributePointerImplementationDefault(Mesh& self, AttributeLayout&& attribute) {
@ -1143,7 +1143,7 @@ void Mesh::attributePointerImplementationDefault(Mesh& self, AttributeLayout&& a
"GL::Mesh::addVertexBuffer(): the buffer has unexpected target hint, expected" << Buffer::TargetHint::Array << "but got" << attribute.buffer.targetHint(), ); "GL::Mesh::addVertexBuffer(): the buffer has unexpected target hint, expected" << Buffer::TargetHint::Array << "but got" << attribute.buffer.targetHint(), );
#endif #endif
reinterpret_cast<std::vector<AttributeLayout>*>(&self._attributes)->push_back(std::move(attribute)); reinterpret_cast<std::vector<AttributeLayout>*>(&self._attributes)->push_back(Utility::move(attribute));
} }
void Mesh::attributePointerImplementationVAO(Mesh& self, AttributeLayout&& attribute) { void Mesh::attributePointerImplementationVAO(Mesh& self, AttributeLayout&& attribute) {
@ -1186,9 +1186,9 @@ void Mesh::attributePointerImplementationVAODSAIntelWindows(Mesh& self, Attribut
/* See the "intel-windows-broken-dsa-integer-vertex-attributes" workaround /* See the "intel-windows-broken-dsa-integer-vertex-attributes" workaround
for more information. */ for more information. */
if(attribute.kind == DynamicAttribute::Kind::Integral) if(attribute.kind == DynamicAttribute::Kind::Integral)
return attributePointerImplementationVAO(self, std::move(attribute)); return attributePointerImplementationVAO(self, Utility::move(attribute));
else else
return attributePointerImplementationVAODSA(self, std::move(attribute)); return attributePointerImplementationVAODSA(self, Utility::move(attribute));
} }
#endif #endif
#endif #endif
@ -1198,11 +1198,11 @@ void Mesh::attributePointerImplementationVAODSAIntelWindows(Mesh& self, Attribut
these two */ these two */
void Mesh::attributePointerImplementationDefaultAngleAlwaysInstanced(Mesh& self, AttributeLayout&& attribute) { void Mesh::attributePointerImplementationDefaultAngleAlwaysInstanced(Mesh& self, AttributeLayout&& attribute) {
if(attribute.divisor) self._instanced = true; if(attribute.divisor) self._instanced = true;
return attributePointerImplementationDefault(self, std::move(attribute)); return attributePointerImplementationDefault(self, Utility::move(attribute));
} }
void Mesh::attributePointerImplementationVAOAngleAlwaysInstanced(Mesh& self, AttributeLayout&& attribute) { void Mesh::attributePointerImplementationVAOAngleAlwaysInstanced(Mesh& self, AttributeLayout&& attribute) {
if(attribute.divisor) self._instanced = true; if(attribute.divisor) self._instanced = true;
return attributePointerImplementationVAO(self, std::move(attribute)); return attributePointerImplementationVAO(self, Utility::move(attribute));
} }
#endif #endif
@ -1255,7 +1255,7 @@ void Mesh::vertexAttribDivisorImplementationNV(Mesh&, const GLuint index, const
#endif #endif
void Mesh::acquireVertexBuffer(Buffer&& buffer) { void Mesh::acquireVertexBuffer(Buffer&& buffer) {
Context::current().state().mesh.acquireVertexBufferImplementation(*this, std::move(buffer)); Context::current().state().mesh.acquireVertexBufferImplementation(*this, Utility::move(buffer));
} }
void Mesh::acquireVertexBufferImplementationDefault(Mesh& self, Buffer&& buffer) { void Mesh::acquireVertexBufferImplementationDefault(Mesh& self, Buffer&& buffer) {
@ -1263,14 +1263,14 @@ void Mesh::acquireVertexBufferImplementationDefault(Mesh& self, Buffer&& buffer)
auto& attributes = *reinterpret_cast<std::vector<AttributeLayout>*>(&self._attributes); auto& attributes = *reinterpret_cast<std::vector<AttributeLayout>*>(&self._attributes);
CORRADE_INTERNAL_ASSERT(!attributes.empty() && attributes.back().buffer.id() == buffer.id() && buffer.id()); CORRADE_INTERNAL_ASSERT(!attributes.empty() && attributes.back().buffer.id() == buffer.id() && buffer.id());
attributes.back().buffer.release(); /* so we swap back a zero ID */ attributes.back().buffer.release(); /* so we swap back a zero ID */
attributes.back().buffer = std::move(buffer); attributes.back().buffer = Utility::move(buffer);
} }
void Mesh::acquireVertexBufferImplementationVAO(Mesh& self, Buffer&& buffer) { void Mesh::acquireVertexBufferImplementationVAO(Mesh& self, Buffer&& buffer) {
CORRADE_INTERNAL_ASSERT(buffer.id()); CORRADE_INTERNAL_ASSERT(buffer.id());
/* With VAOs we are not maintaining the attribute list, so just store the /* With VAOs we are not maintaining the attribute list, so just store the
buffer directly */ buffer directly */
reinterpret_cast<std::vector<Buffer>*>(&self._attributes)->emplace_back(std::move(buffer)); reinterpret_cast<std::vector<Buffer>*>(&self._attributes)->emplace_back(Utility::move(buffer));
} }
void Mesh::bindIndexBufferImplementationDefault(Mesh&, Buffer&) {} void Mesh::bindIndexBufferImplementationDefault(Mesh&, Buffer&) {}

14
src/Magnum/GL/Mesh.h

@ -998,7 +998,7 @@ class MAGNUM_GL_EXPORT Mesh: public AbstractObject {
#endif #endif
> inline Mesh& addVertexBuffer(Buffer&& buffer, GLintptr offset, const T&... attributes) { > inline Mesh& addVertexBuffer(Buffer&& buffer, GLintptr offset, const T&... attributes) {
addVertexBuffer<T...>(buffer, offset, attributes...); addVertexBuffer<T...>(buffer, offset, attributes...);
acquireVertexBuffer(std::move(buffer)); acquireVertexBuffer(Utility::move(buffer));
return *this; return *this;
} }
@ -1017,7 +1017,7 @@ class MAGNUM_GL_EXPORT Mesh: public AbstractObject {
#endif #endif
> inline Mesh& addVertexBufferInstanced(Buffer&& buffer, UnsignedInt divisor, GLintptr offset, const T&... attributes) { > inline Mesh& addVertexBufferInstanced(Buffer&& buffer, UnsignedInt divisor, GLintptr offset, const T&... attributes) {
addVertexBufferInstanced<T...>(buffer, divisor, offset, attributes...); addVertexBufferInstanced<T...>(buffer, divisor, offset, attributes...);
acquireVertexBuffer(std::move(buffer)); acquireVertexBuffer(Utility::move(buffer));
return *this; return *this;
} }
@ -1031,7 +1031,7 @@ class MAGNUM_GL_EXPORT Mesh: public AbstractObject {
*/ */
Mesh& addVertexBuffer(Buffer&& buffer, GLintptr offset, GLsizei stride, const DynamicAttribute& attribute) { Mesh& addVertexBuffer(Buffer&& buffer, GLintptr offset, GLsizei stride, const DynamicAttribute& attribute) {
addVertexBuffer(buffer, offset, stride, attribute); addVertexBuffer(buffer, offset, stride, attribute);
acquireVertexBuffer(std::move(buffer)); acquireVertexBuffer(Utility::move(buffer));
return *this; return *this;
} }
@ -1045,7 +1045,7 @@ class MAGNUM_GL_EXPORT Mesh: public AbstractObject {
*/ */
Mesh& addVertexBufferInstanced(Buffer&& buffer, UnsignedInt divisor, GLintptr offset, GLsizei stride, const DynamicAttribute& attribute) { Mesh& addVertexBufferInstanced(Buffer&& buffer, UnsignedInt divisor, GLintptr offset, GLsizei stride, const DynamicAttribute& attribute) {
addVertexBufferInstanced(buffer, divisor, offset, stride, attribute); addVertexBufferInstanced(buffer, divisor, offset, stride, attribute);
acquireVertexBuffer(std::move(buffer)); acquireVertexBuffer(Utility::move(buffer));
return *this; return *this;
} }
@ -1130,7 +1130,7 @@ class MAGNUM_GL_EXPORT Mesh: public AbstractObject {
* index type. * index type.
*/ */
Mesh& setIndexBuffer(Buffer&& buffer, GLintptr offset, Magnum::MeshIndexType type, UnsignedInt start, UnsignedInt end) { Mesh& setIndexBuffer(Buffer&& buffer, GLintptr offset, Magnum::MeshIndexType type, UnsignedInt start, UnsignedInt end) {
return setIndexBuffer(std::move(buffer), offset, meshIndexType(type), start, end); return setIndexBuffer(Utility::move(buffer), offset, meshIndexType(type), start, end);
} }
/** /**
@ -1141,7 +1141,7 @@ class MAGNUM_GL_EXPORT Mesh: public AbstractObject {
* @ref GL-Mesh-buffer-ownership for more information. * @ref GL-Mesh-buffer-ownership for more information.
*/ */
Mesh& setIndexBuffer(Buffer&& buffer, GLintptr offset, MeshIndexType type) { Mesh& setIndexBuffer(Buffer&& buffer, GLintptr offset, MeshIndexType type) {
return setIndexBuffer(std::move(buffer), offset, type, 0, 0); return setIndexBuffer(Utility::move(buffer), offset, type, 0, 0);
} }
/** @overload /** @overload
@ -1153,7 +1153,7 @@ class MAGNUM_GL_EXPORT Mesh: public AbstractObject {
* index type. * index type.
*/ */
Mesh& setIndexBuffer(Buffer&& buffer, GLintptr offset, Magnum::MeshIndexType type) { Mesh& setIndexBuffer(Buffer&& buffer, GLintptr offset, Magnum::MeshIndexType type) {
return setIndexBuffer(std::move(buffer), offset, meshIndexType(type), 0, 0); return setIndexBuffer(Utility::move(buffer), offset, meshIndexType(type), 0, 0);
} }
#ifdef MAGNUM_BUILD_DEPRECATED #ifdef MAGNUM_BUILD_DEPRECATED

16
src/Magnum/GL/RectangleTexture.cpp

@ -65,42 +65,42 @@ RectangleTexture RectangleTexture::view(RectangleTexture& original, const Textur
Image2D RectangleTexture::image(Image2D&& image) { Image2D RectangleTexture::image(Image2D&& image) {
this->image(image); this->image(image);
return std::move(image); return Utility::move(image);
} }
BufferImage2D RectangleTexture::image(BufferImage2D&& image, const BufferUsage usage) { BufferImage2D RectangleTexture::image(BufferImage2D&& image, const BufferUsage usage) {
this->image(image, usage); this->image(image, usage);
return std::move(image); return Utility::move(image);
} }
CompressedImage2D RectangleTexture::compressedImage(CompressedImage2D&& image) { CompressedImage2D RectangleTexture::compressedImage(CompressedImage2D&& image) {
compressedImage(image); compressedImage(image);
return std::move(image); return Utility::move(image);
} }
CompressedBufferImage2D RectangleTexture::compressedImage(CompressedBufferImage2D&& image, const BufferUsage usage) { CompressedBufferImage2D RectangleTexture::compressedImage(CompressedBufferImage2D&& image, const BufferUsage usage) {
compressedImage(image, usage); compressedImage(image, usage);
return std::move(image); return Utility::move(image);
} }
Image2D RectangleTexture::subImage(const Range2Di& range, Image2D&& image) { Image2D RectangleTexture::subImage(const Range2Di& range, Image2D&& image) {
this->subImage(range, image); this->subImage(range, image);
return std::move(image); return Utility::move(image);
} }
BufferImage2D RectangleTexture::subImage(const Range2Di& range, BufferImage2D&& image, const BufferUsage usage) { BufferImage2D RectangleTexture::subImage(const Range2Di& range, BufferImage2D&& image, const BufferUsage usage) {
this->subImage(range, image, usage); this->subImage(range, image, usage);
return std::move(image); return Utility::move(image);
} }
CompressedImage2D RectangleTexture::compressedSubImage(const Range2Di& range, CompressedImage2D&& image) { CompressedImage2D RectangleTexture::compressedSubImage(const Range2Di& range, CompressedImage2D&& image) {
compressedSubImage(range, image); compressedSubImage(range, image);
return std::move(image); return Utility::move(image);
} }
CompressedBufferImage2D RectangleTexture::compressedSubImage(const Range2Di& range, CompressedBufferImage2D&& image, const BufferUsage usage) { CompressedBufferImage2D RectangleTexture::compressedSubImage(const Range2Di& range, CompressedBufferImage2D&& image, const BufferUsage usage) {
compressedSubImage(range, image, usage); compressedSubImage(range, image, usage);
return std::move(image); return Utility::move(image);
} }
RectangleTexture& RectangleTexture::setLabel(Containers::StringView label) { RectangleTexture& RectangleTexture::setLabel(Containers::StringView label) {

4
src/Magnum/GL/Renderbuffer.h

@ -29,7 +29,7 @@
* @brief Class @ref Magnum::GL::Renderbuffer * @brief Class @ref Magnum::GL::Renderbuffer
*/ */
#include <utility> /* std::swap() */ #include <Corrade/Utility/Move.h>
#include "Magnum/Tags.h" #include "Magnum/Tags.h"
#include "Magnum/GL/AbstractObject.h" #include "Magnum/GL/AbstractObject.h"
@ -280,7 +280,7 @@ inline Renderbuffer::Renderbuffer(Renderbuffer&& other) noexcept: _id{other._id}
} }
inline Renderbuffer& Renderbuffer::operator=(Renderbuffer&& other) noexcept { inline Renderbuffer& Renderbuffer::operator=(Renderbuffer&& other) noexcept {
using std::swap; using Utility::swap;
swap(_id, other._id); swap(_id, other._id);
swap(_flags, other._flags); swap(_flags, other._flags);
return *this; return *this;

12
src/Magnum/GL/Shader.cpp

@ -761,7 +761,7 @@ Shader::Shader(Shader&& other) noexcept: _type{other._type}, _id{other._id}, _fl
_offsetLineByOneOnOldGlsl{other._flags}, _offsetLineByOneOnOldGlsl{other._flags},
#endif #endif
_fileIndexOffset{other._fileIndexOffset}, _fileIndexOffset{other._fileIndexOffset},
_sources{std::move(other._sources)} _sources{Utility::move(other._sources)}
{ {
other._id = 0; other._id = 0;
} }
@ -774,7 +774,7 @@ Shader::~Shader() {
} }
Shader& Shader::operator=(Shader&& other) noexcept { Shader& Shader::operator=(Shader&& other) noexcept {
using std::swap; using Utility::swap;
swap(_type, other._type); swap(_type, other._type);
swap(_id, other._id); swap(_id, other._id);
swap(_flags, other._flags); swap(_flags, other._flags);
@ -837,14 +837,14 @@ Shader& Shader::addSourceInternal(Containers::String&& source) {
(_sources.size() + 1 - _fileIndexOffset)/2)); (_sources.size() + 1 - _fileIndexOffset)/2));
else arrayAppend(_sources, Containers::String::nullTerminatedGlobalView(""_s)); else arrayAppend(_sources, Containers::String::nullTerminatedGlobalView(""_s));
Context::current().state().shader.addSourceImplementation(*this, std::move(source)); Context::current().state().shader.addSourceImplementation(*this, Utility::move(source));
} }
return *this; return *this;
} }
void Shader::addSourceImplementationDefault(Shader& self, Containers::String&& source) { void Shader::addSourceImplementationDefault(Shader& self, Containers::String&& source) {
arrayAppend(self._sources, std::move(source)); arrayAppend(self._sources, Utility::move(source));
} }
#if defined(CORRADE_TARGET_EMSCRIPTEN) && defined(__EMSCRIPTEN_PTHREADS__) #if defined(CORRADE_TARGET_EMSCRIPTEN) && defined(__EMSCRIPTEN_PTHREADS__)
@ -856,14 +856,14 @@ void Shader::addSourceImplementationEmscriptenPthread(Shader& self, Containers::
if(!source.isSmall() && !source.deleter()) if(!source.isSmall() && !source.deleter())
source = Containers::String{source}; source = Containers::String{source};
for(char& c: source) if(c < 0) c = ' '; for(char& c: source) if(c < 0) c = ' ';
arrayAppend(self._sources, std::move(source)); arrayAppend(self._sources, Utility::move(source));
} }
#endif #endif
Shader& Shader::addFile(const Containers::StringView filename) { Shader& Shader::addFile(const Containers::StringView filename) {
Containers::Optional<Containers::String> string = Utility::Path::readString(filename); Containers::Optional<Containers::String> string = Utility::Path::readString(filename);
CORRADE_ASSERT(string, "GL::Shader::addFile(): can't read" << filename, *this); CORRADE_ASSERT(string, "GL::Shader::addFile(): can't read" << filename, *this);
addSource(*std::move(string)); addSource(*Utility::move(string));
return *this; return *this;
} }

2
src/Magnum/GL/Shader.h

@ -717,7 +717,7 @@ class MAGNUM_GL_EXPORT Shader: public AbstractObject {
StringView overload. Sigh, C++. */ StringView overload. Sigh, C++. */
template<class U, class = typename std::enable_if<std::is_same<U&&, Containers::String&&>::value>::type> template<class U, class = typename std::enable_if<std::is_same<U&&, Containers::String&&>::value>::type>
Shader& addSource(U&& source) { Shader& addSource(U&& source) {
return addSourceInternal(std::move(source)); return addSourceInternal(Utility::move(source));
} }
#endif #endif

4
src/Magnum/GL/Test/AbstractQueryGLTest.cpp

@ -82,7 +82,7 @@ void AbstractQueryGLTest::constructMove() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(id > 0); CORRADE_VERIFY(id > 0);
SampleQuery b(std::move(a)); SampleQuery b(Utility::move(a));
CORRADE_COMPARE(a.id(), 0); CORRADE_COMPARE(a.id(), 0);
CORRADE_COMPARE(b.id(), id); CORRADE_COMPARE(b.id(), id);
@ -93,7 +93,7 @@ void AbstractQueryGLTest::constructMove() {
SampleQuery c{SampleQuery::Target::AnySamplesPassed}; SampleQuery c{SampleQuery::Target::AnySamplesPassed};
#endif #endif
const Int cId = c.id(); const Int cId = c.id();
c = std::move(b); c = Utility::move(b);
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(cId > 0); CORRADE_VERIFY(cId > 0);

8
src/Magnum/GL/Test/AbstractShaderProgramGLTest.cpp

@ -251,14 +251,14 @@ void AbstractShaderProgramGLTest::constructMove() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(id > 0); CORRADE_VERIFY(id > 0);
DummyShader b(std::move(a)); DummyShader b(Utility::move(a));
CORRADE_COMPARE(a.id(), 0); CORRADE_COMPARE(a.id(), 0);
CORRADE_COMPARE(b.id(), id); CORRADE_COMPARE(b.id(), id);
DummyShader c; DummyShader c;
const Int cId = c.id(); const Int cId = c.id();
c = std::move(b); c = Utility::move(b);
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(cId > 0); CORRADE_VERIFY(cId > 0);
@ -1340,9 +1340,9 @@ void AbstractShaderProgramGLTest::subclassDraw() {
type should still be ShaderSubclassDraw& even after all these. */ type should still be ShaderSubclassDraw& even after all these. */
ShaderSubclassDraw& out = shader ShaderSubclassDraw& out = shader
.draw(mesh) .draw(mesh)
.draw(std::move(mesh)) .draw(Utility::move(mesh))
.draw(meshView) .draw(meshView)
.draw(std::move(meshView)) .draw(Utility::move(meshView))
.draw(mesh, counts, vertexOffsets, indexOffsets) .draw(mesh, counts, vertexOffsets, indexOffsets)
#ifndef CORRADE_TARGET_32BIT #ifndef CORRADE_TARGET_32BIT
.draw(mesh, counts, vertexOffsets, indexOffsetsLong) .draw(mesh, counts, vertexOffsets, indexOffsetsLong)

4
src/Magnum/GL/Test/AbstractTextureGLTest.cpp

@ -105,14 +105,14 @@ void AbstractTextureGLTest::constructMove() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(id > 0); CORRADE_VERIFY(id > 0);
Texture2D b(std::move(a)); Texture2D b(Utility::move(a));
CORRADE_COMPARE(a.id(), 0); CORRADE_COMPARE(a.id(), 0);
CORRADE_COMPARE(b.id(), id); CORRADE_COMPARE(b.id(), id);
Texture2D c; Texture2D c;
const Int cId = c.id(); const Int cId = c.id();
c = std::move(b); c = Utility::move(b);
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(cId > 0); CORRADE_VERIFY(cId > 0);

4
src/Magnum/GL/Test/BufferGLTest.cpp

@ -161,14 +161,14 @@ void BufferGLTest::constructMove() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(id > 0); CORRADE_VERIFY(id > 0);
Buffer b(std::move(a)); Buffer b(Utility::move(a));
CORRADE_COMPARE(a.id(), 0); CORRADE_COMPARE(a.id(), 0);
CORRADE_COMPARE(b.id(), id); CORRADE_COMPARE(b.id(), id);
Buffer c; Buffer c;
const Int cId = c.id(); const Int cId = c.id();
c = std::move(b); c = Utility::move(b);
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(cId > 0); CORRADE_VERIFY(cId > 0);

16
src/Magnum/GL/Test/BufferImageGLTest.cpp

@ -206,7 +206,7 @@ void BufferImageGLTest::constructBuffer() {
const UnsignedInt id = buffer.id(); const UnsignedInt id = buffer.id();
BufferImage2D a{PixelStorage{}.setAlignment(1), BufferImage2D a{PixelStorage{}.setAlignment(1),
PixelFormat::Red, PixelType::UnsignedByte, {1, 3}, std::move(buffer), sizeof(data)}; PixelFormat::Red, PixelType::UnsignedByte, {1, 3}, Utility::move(buffer), sizeof(data)};
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
const auto imageData = a.buffer().data(); const auto imageData = a.buffer().data();
@ -236,7 +236,7 @@ void BufferImageGLTest::constructBufferGeneric() {
const UnsignedInt id = buffer.id(); const UnsignedInt id = buffer.id();
BufferImage2D a{PixelStorage{}.setAlignment(1), BufferImage2D a{PixelStorage{}.setAlignment(1),
Magnum::PixelFormat::R8Unorm, {1, 3}, std::move(buffer), sizeof(data)}; Magnum::PixelFormat::R8Unorm, {1, 3}, Utility::move(buffer), sizeof(data)};
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
const auto imageData = a.buffer().data(); const auto imageData = a.buffer().data();
@ -270,7 +270,7 @@ void BufferImageGLTest::constructBufferCompressed() {
CompressedPixelStorage{}.setCompressedBlockSize(Vector3i{4}), CompressedPixelStorage{}.setCompressedBlockSize(Vector3i{4}),
#endif #endif
CompressedPixelFormat::RGBAS3tcDxt1, CompressedPixelFormat::RGBAS3tcDxt1,
{4, 4}, std::move(buffer), sizeof(data)}; {4, 4}, Utility::move(buffer), sizeof(data)};
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
const auto imageData = a.buffer().data(); const auto imageData = a.buffer().data();
@ -305,7 +305,7 @@ void BufferImageGLTest::constructBufferCompressedGeneric() {
CompressedPixelStorage{}.setCompressedBlockSize(Vector3i{4}), CompressedPixelStorage{}.setCompressedBlockSize(Vector3i{4}),
#endif #endif
Magnum::CompressedPixelFormat::Bc1RGBAUnorm, Magnum::CompressedPixelFormat::Bc1RGBAUnorm,
{4, 4}, std::move(buffer), sizeof(data)}; {4, 4}, Utility::move(buffer), sizeof(data)};
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
const auto imageData = a.buffer().data(); const auto imageData = a.buffer().data();
@ -367,7 +367,7 @@ void BufferImageGLTest::constructMove() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(id > 0); CORRADE_VERIFY(id > 0);
BufferImage2D b(std::move(a)); BufferImage2D b(Utility::move(a));
CORRADE_COMPARE(a.buffer().id(), 0); CORRADE_COMPARE(a.buffer().id(), 0);
CORRADE_COMPARE(a.size(), Vector2i()); CORRADE_COMPARE(a.size(), Vector2i());
@ -383,7 +383,7 @@ void BufferImageGLTest::constructMove() {
BufferImage2D c{PixelStorage{}.setAlignment(1), BufferImage2D c{PixelStorage{}.setAlignment(1),
PixelFormat::RGBA, PixelType::UnsignedShort, {1, 2}, data2, BufferUsage::StaticDraw}; PixelFormat::RGBA, PixelType::UnsignedShort, {1, 2}, data2, BufferUsage::StaticDraw};
const Int cId = c.buffer().id(); const Int cId = c.buffer().id();
c = std::move(b); c = Utility::move(b);
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
@ -410,7 +410,7 @@ void BufferImageGLTest::constructMoveCompressed() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(id > 0); CORRADE_VERIFY(id > 0);
CompressedBufferImage2D b{std::move(a)}; CompressedBufferImage2D b{Utility::move(a)};
CORRADE_COMPARE(a.buffer().id(), 0); CORRADE_COMPARE(a.buffer().id(), 0);
CORRADE_COMPARE(a.size(), Vector2i()); CORRADE_COMPARE(a.size(), Vector2i());
@ -431,7 +431,7 @@ void BufferImageGLTest::constructMoveCompressed() {
#endif #endif
CompressedPixelFormat::RGBAS3tcDxt1, {8, 4}, data2, BufferUsage::StaticDraw}; CompressedPixelFormat::RGBAS3tcDxt1, {8, 4}, data2, BufferUsage::StaticDraw};
const Int cId = c.buffer().id(); const Int cId = c.buffer().id();
c = std::move(b); c = Utility::move(b);
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();

4
src/Magnum/GL/Test/ContextGLTest.cpp

@ -319,7 +319,7 @@ void ContextGLTest::constructMove() {
/* Move and create. This should take into account all parameters passed /* Move and create. This should take into account all parameters passed
from above and combine them with what arrived through Configuration. */ from above and combine them with what arrived through Configuration. */
Platform::GLContext b = std::move(a); Platform::GLContext b = Utility::move(a);
/* The context is still not created here either */ /* The context is still not created here either */
CORRADE_VERIFY(!Context::hasCurrent()); CORRADE_VERIFY(!Context::hasCurrent());
@ -365,7 +365,7 @@ void ContextGLTest::constructMove() {
/* Now move the created context and verify the remaining state gets /* Now move the created context and verify the remaining state gets
transferred as well */ transferred as well */
Platform::GLContext c = std::move(b); Platform::GLContext c = Utility::move(b);
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
/* This is an internal undocumented API but shh */ /* This is an internal undocumented API but shh */
CORRADE_COMPARE(c.isDriverWorkaroundDisabled("no-layout-qualifiers-on-old-glsl"), data.workaroundDisabled); CORRADE_COMPARE(c.isDriverWorkaroundDisabled("no-layout-qualifiers-on-old-glsl"), data.workaroundDisabled);

4
src/Magnum/GL/Test/ContextTest.cpp

@ -306,7 +306,7 @@ void ContextTest::configurationConstructMove() {
#endif #endif
.addDisabledExtensions<Extensions::EXT::texture_filter_anisotropic>(); .addDisabledExtensions<Extensions::EXT::texture_filter_anisotropic>();
Context::Configuration b = std::move(a); Context::Configuration b = Utility::move(a);
CORRADE_COMPARE(UnsignedLong(b.flags()), UnsignedLong(Context::Configuration::Flag::VerboseLog)); CORRADE_COMPARE(UnsignedLong(b.flags()), UnsignedLong(Context::Configuration::Flag::VerboseLog));
CORRADE_VERIFY(a.disabledWorkarounds().isEmpty()); CORRADE_VERIFY(a.disabledWorkarounds().isEmpty());
CORRADE_VERIFY(a.disabledExtensions().isEmpty()); CORRADE_VERIFY(a.disabledExtensions().isEmpty());
@ -330,7 +330,7 @@ void ContextTest::configurationConstructMove() {
#endif #endif
; ;
c = std::move(b); c = Utility::move(b);
#ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_WEBGL
CORRADE_COMPARE(b.disabledWorkarounds().size(), 2); CORRADE_COMPARE(b.disabledWorkarounds().size(), 2);
#endif #endif

4
src/Magnum/GL/Test/FramebufferGLTest.cpp

@ -375,7 +375,7 @@ void FramebufferGLTest::constructMove() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(id > 0); CORRADE_VERIFY(id > 0);
Framebuffer b(std::move(a)); Framebuffer b(Utility::move(a));
CORRADE_COMPARE(a.id(), 0); CORRADE_COMPARE(a.id(), 0);
CORRADE_COMPARE(b.id(), id); CORRADE_COMPARE(b.id(), id);
@ -383,7 +383,7 @@ void FramebufferGLTest::constructMove() {
Framebuffer c({{128, 256}, {32, 16}}); Framebuffer c({{128, 256}, {32, 16}});
const Int cId = c.id(); const Int cId = c.id();
c = std::move(b); c = Utility::move(b);
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(cId > 0); CORRADE_VERIFY(cId > 0);

18
src/Magnum/GL/Test/MeshGLTest.cpp

@ -813,7 +813,7 @@ void MeshGLTest::constructMove() {
} }
/* Move construct */ /* Move construct */
Mesh b(std::move(a)); Mesh b(Utility::move(a));
CORRADE_COMPARE(a.id(), 0); CORRADE_COMPARE(a.id(), 0);
CORRADE_COMPARE(b.id(), id); CORRADE_COMPARE(b.id(), id);
@ -822,7 +822,7 @@ void MeshGLTest::constructMove() {
Mesh c; Mesh c;
c.addVertexBuffer(buffer2, 4, Attribute<1, Float>{}); c.addVertexBuffer(buffer2, 4, Attribute<1, Float>{});
const Int cId = c.id(); const Int cId = c.id();
c = std::move(b); c = Utility::move(b);
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
@ -840,7 +840,7 @@ void MeshGLTest::constructMove() {
/* Move assign to a NoCreate instance */ /* Move assign to a NoCreate instance */
Mesh d{NoCreate}; Mesh d{NoCreate};
d = std::move(c); d = Utility::move(c);
CORRADE_COMPARE(c.id(), 0); CORRADE_COMPARE(c.id(), 0);
CORRADE_COMPARE(d.id(), id); CORRADE_COMPARE(d.id(), id);
@ -2318,7 +2318,7 @@ void MeshGLTest::addVertexBufferTransferOwnwership() {
{ {
Mesh mesh; Mesh mesh;
mesh.addVertexBuffer(std::move(buffer), 0, Attribute<0, Float>{}); mesh.addVertexBuffer(Utility::move(buffer), 0, Attribute<0, Float>{});
CORRADE_VERIFY(!buffer.id()); CORRADE_VERIFY(!buffer.id());
CORRADE_VERIFY(glIsBuffer(id)); CORRADE_VERIFY(glIsBuffer(id));
} }
@ -2360,7 +2360,7 @@ void MeshGLTest::addVertexBufferInstancedTransferOwnwership() {
{ {
Mesh mesh; Mesh mesh;
mesh.addVertexBufferInstanced(std::move(buffer), 1, 0, Attribute<0, Float>{}); mesh.addVertexBufferInstanced(Utility::move(buffer), 1, 0, Attribute<0, Float>{});
CORRADE_VERIFY(!buffer.id()); CORRADE_VERIFY(!buffer.id());
CORRADE_VERIFY(glIsBuffer(id)); CORRADE_VERIFY(glIsBuffer(id));
} }
@ -2390,7 +2390,7 @@ void MeshGLTest::addVertexBufferDynamicTransferOwnwership() {
{ {
Mesh mesh; Mesh mesh;
mesh.addVertexBuffer(std::move(buffer), 0, 4, DynamicAttribute{ mesh.addVertexBuffer(Utility::move(buffer), 0, 4, DynamicAttribute{
DynamicAttribute::Kind::GenericNormalized, 0, DynamicAttribute::Kind::GenericNormalized, 0,
DynamicAttribute::Components::One, DynamicAttribute::Components::One,
DynamicAttribute::DataType::Float}); DynamicAttribute::DataType::Float});
@ -2438,7 +2438,7 @@ void MeshGLTest::addVertexBufferInstancedDynamicTransferOwnwership() {
{ {
Mesh mesh; Mesh mesh;
mesh.addVertexBufferInstanced(std::move(buffer), 1, 0, 4, DynamicAttribute{ mesh.addVertexBufferInstanced(Utility::move(buffer), 1, 0, 4, DynamicAttribute{
DynamicAttribute::Kind::GenericNormalized, 0, DynamicAttribute::Kind::GenericNormalized, 0,
DynamicAttribute::Components::One, DynamicAttribute::Components::One,
DynamicAttribute::DataType::Float}); DynamicAttribute::DataType::Float});
@ -2645,7 +2645,7 @@ template<class T> void MeshGLTest::setIndexBufferTransferOwnership() {
{ {
Mesh mesh; Mesh mesh;
mesh.setIndexBuffer(std::move(buffer), 0, T::UnsignedShort); mesh.setIndexBuffer(Utility::move(buffer), 0, T::UnsignedShort);
CORRADE_VERIFY(!buffer.id()); CORRADE_VERIFY(!buffer.id());
CORRADE_VERIFY(glIsBuffer(id)); CORRADE_VERIFY(glIsBuffer(id));
} }
@ -2675,7 +2675,7 @@ template<class T> void MeshGLTest::setIndexBufferRangeTransferOwnership() {
{ {
Mesh mesh; Mesh mesh;
mesh.setIndexBuffer(std::move(buffer), 0, T::UnsignedShort, 0, 1); mesh.setIndexBuffer(Utility::move(buffer), 0, T::UnsignedShort, 0, 1);
CORRADE_VERIFY(!buffer.id()); CORRADE_VERIFY(!buffer.id());
CORRADE_VERIFY(glIsBuffer(id)); CORRADE_VERIFY(glIsBuffer(id));
} }

4
src/Magnum/GL/Test/MeshTest.cpp

@ -123,11 +123,11 @@ void MeshTest::constructMoveNoCreate() {
Mesh a{NoCreate}; Mesh a{NoCreate};
CORRADE_COMPARE(a.id(), 0); CORRADE_COMPARE(a.id(), 0);
Mesh b{std::move(a)}; Mesh b{Utility::move(a)};
CORRADE_COMPARE(b.id(), 0); CORRADE_COMPARE(b.id(), 0);
Mesh c{NoCreate}; Mesh c{NoCreate};
c = std::move(b); c = Utility::move(b);
CORRADE_COMPARE(c.id(), 0); CORRADE_COMPARE(c.id(), 0);
} }

4
src/Magnum/GL/Test/RenderbufferGLTest.cpp

@ -102,14 +102,14 @@ void RenderbufferGLTest::constructMove() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(id > 0); CORRADE_VERIFY(id > 0);
Renderbuffer b(std::move(a)); Renderbuffer b(Utility::move(a));
CORRADE_COMPARE(a.id(), 0); CORRADE_COMPARE(a.id(), 0);
CORRADE_COMPARE(b.id(), id); CORRADE_COMPARE(b.id(), id);
Renderbuffer c; Renderbuffer c;
const Int cId = c.id(); const Int cId = c.id();
c = std::move(b); c = Utility::move(b);
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(cId > 0); CORRADE_VERIFY(cId > 0);

4
src/Magnum/GL/Test/ShaderGLTest.cpp

@ -157,7 +157,7 @@ void ShaderGLTest::constructMove() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(id > 0); CORRADE_VERIFY(id > 0);
Shader b(std::move(a)); Shader b(Utility::move(a));
CORRADE_COMPARE(a.id(), 0); CORRADE_COMPARE(a.id(), 0);
CORRADE_COMPARE(b.id(), id); CORRADE_COMPARE(b.id(), id);
@ -177,7 +177,7 @@ void ShaderGLTest::constructMove() {
Shader c(Version::GLES200, Shader::Type::Vertex); Shader c(Version::GLES200, Shader::Type::Vertex);
#endif #endif
const Int cId = c.id(); const Int cId = c.id();
c = std::move(b); c = Utility::move(b);
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(cId > 0); CORRADE_VERIFY(cId > 0);

4
src/Magnum/GL/Test/TransformFeedbackGLTest.cpp

@ -175,14 +175,14 @@ void TransformFeedbackGLTest::constructMove() {
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(id > 0); CORRADE_VERIFY(id > 0);
TransformFeedback b{std::move(a)}; TransformFeedback b{Utility::move(a)};
CORRADE_COMPARE(a.id(), 0); CORRADE_COMPARE(a.id(), 0);
CORRADE_COMPARE(b.id(), id); CORRADE_COMPARE(b.id(), id);
TransformFeedback c; TransformFeedback c;
const Int cId = c.id(); const Int cId = c.id();
c = std::move(b); c = Utility::move(b);
MAGNUM_VERIFY_NO_GL_ERROR(); MAGNUM_VERIFY_NO_GL_ERROR();
CORRADE_VERIFY(cId > 0); CORRADE_VERIFY(cId > 0);

16
src/Magnum/GL/Texture.cpp

@ -135,42 +135,42 @@ template<> template<> MAGNUM_GL_EXPORT Texture2D Texture2D::view(CubeMapTextureA
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
template<UnsignedInt dimensions> Image<dimensions> Texture<dimensions>::image(const Int level, Image<dimensions>&& image) { template<UnsignedInt dimensions> Image<dimensions> Texture<dimensions>::image(const Int level, Image<dimensions>&& image) {
this->image(level, image); this->image(level, image);
return std::move(image); return Utility::move(image);
} }
template<UnsignedInt dimensions> BufferImage<dimensions> Texture<dimensions>::image(const Int level, BufferImage<dimensions>&& image, const BufferUsage usage) { template<UnsignedInt dimensions> BufferImage<dimensions> Texture<dimensions>::image(const Int level, BufferImage<dimensions>&& image, const BufferUsage usage) {
this->image(level, image, usage); this->image(level, image, usage);
return std::move(image); return Utility::move(image);
} }
template<UnsignedInt dimensions> CompressedImage<dimensions> Texture<dimensions>::compressedImage(const Int level, CompressedImage<dimensions>&& image) { template<UnsignedInt dimensions> CompressedImage<dimensions> Texture<dimensions>::compressedImage(const Int level, CompressedImage<dimensions>&& image) {
compressedImage(level, image); compressedImage(level, image);
return std::move(image); return Utility::move(image);
} }
template<UnsignedInt dimensions> CompressedBufferImage<dimensions> Texture<dimensions>::compressedImage(const Int level, CompressedBufferImage<dimensions>&& image, const BufferUsage usage) { template<UnsignedInt dimensions> CompressedBufferImage<dimensions> Texture<dimensions>::compressedImage(const Int level, CompressedBufferImage<dimensions>&& image, const BufferUsage usage) {
compressedImage(level, image, usage); compressedImage(level, image, usage);
return std::move(image); return Utility::move(image);
} }
template<UnsignedInt dimensions> Image<dimensions> Texture<dimensions>::subImage(const Int level, const RangeTypeFor<dimensions, Int>& range, Image<dimensions>&& image) { template<UnsignedInt dimensions> Image<dimensions> Texture<dimensions>::subImage(const Int level, const RangeTypeFor<dimensions, Int>& range, Image<dimensions>&& image) {
this->subImage(level, range, image); this->subImage(level, range, image);
return std::move(image); return Utility::move(image);
} }
template<UnsignedInt dimensions> BufferImage<dimensions> Texture<dimensions>::subImage(const Int level, const RangeTypeFor<dimensions, Int>& range, BufferImage<dimensions>&& image, const BufferUsage usage) { template<UnsignedInt dimensions> BufferImage<dimensions> Texture<dimensions>::subImage(const Int level, const RangeTypeFor<dimensions, Int>& range, BufferImage<dimensions>&& image, const BufferUsage usage) {
this->subImage(level, range, image, usage); this->subImage(level, range, image, usage);
return std::move(image); return Utility::move(image);
} }
template<UnsignedInt dimensions> CompressedImage<dimensions> Texture<dimensions>::compressedSubImage(const Int level, const RangeTypeFor<dimensions, Int>& range, CompressedImage<dimensions>&& image) { template<UnsignedInt dimensions> CompressedImage<dimensions> Texture<dimensions>::compressedSubImage(const Int level, const RangeTypeFor<dimensions, Int>& range, CompressedImage<dimensions>&& image) {
compressedSubImage(level, range, image); compressedSubImage(level, range, image);
return std::move(image); return Utility::move(image);
} }
template<UnsignedInt dimensions> CompressedBufferImage<dimensions> Texture<dimensions>::compressedSubImage(const Int level, const RangeTypeFor<dimensions, Int>& range, CompressedBufferImage<dimensions>&& image, const BufferUsage usage) { template<UnsignedInt dimensions> CompressedBufferImage<dimensions> Texture<dimensions>::compressedSubImage(const Int level, const RangeTypeFor<dimensions, Int>& range, CompressedBufferImage<dimensions>&& image, const BufferUsage usage) {
compressedSubImage(level, range, image, usage); compressedSubImage(level, range, image, usage);
return std::move(image); return Utility::move(image);
} }
#endif #endif

16
src/Magnum/GL/TextureArray.cpp

@ -114,42 +114,42 @@ template<> template<> MAGNUM_GL_EXPORT Texture2DArray Texture2DArray::view(CubeM
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
template<UnsignedInt dimensions> Image<dimensions+1> TextureArray<dimensions>::image(const Int level, Image<dimensions+1>&& image) { template<UnsignedInt dimensions> Image<dimensions+1> TextureArray<dimensions>::image(const Int level, Image<dimensions+1>&& image) {
this->image(level, image); this->image(level, image);
return std::move(image); return Utility::move(image);
} }
template<UnsignedInt dimensions> BufferImage<dimensions+1> TextureArray<dimensions>::image(const Int level, BufferImage<dimensions+1>&& image, const BufferUsage usage) { template<UnsignedInt dimensions> BufferImage<dimensions+1> TextureArray<dimensions>::image(const Int level, BufferImage<dimensions+1>&& image, const BufferUsage usage) {
this->image(level, image, usage); this->image(level, image, usage);
return std::move(image); return Utility::move(image);
} }
template<UnsignedInt dimensions> CompressedImage<dimensions+1> TextureArray<dimensions>::compressedImage(const Int level, CompressedImage<dimensions+1>&& image) { template<UnsignedInt dimensions> CompressedImage<dimensions+1> TextureArray<dimensions>::compressedImage(const Int level, CompressedImage<dimensions+1>&& image) {
compressedImage(level, image); compressedImage(level, image);
return std::move(image); return Utility::move(image);
} }
template<UnsignedInt dimensions> CompressedBufferImage<dimensions+1> TextureArray<dimensions>::compressedImage(const Int level, CompressedBufferImage<dimensions+1>&& image, const BufferUsage usage) { template<UnsignedInt dimensions> CompressedBufferImage<dimensions+1> TextureArray<dimensions>::compressedImage(const Int level, CompressedBufferImage<dimensions+1>&& image, const BufferUsage usage) {
compressedImage(level, image, usage); compressedImage(level, image, usage);
return std::move(image); return Utility::move(image);
} }
template<UnsignedInt dimensions> Image<dimensions+1> TextureArray<dimensions>::subImage(const Int level, const RangeTypeFor<dimensions+1, Int>& range, Image<dimensions+1>&& image) { template<UnsignedInt dimensions> Image<dimensions+1> TextureArray<dimensions>::subImage(const Int level, const RangeTypeFor<dimensions+1, Int>& range, Image<dimensions+1>&& image) {
this->subImage(level, range, image); this->subImage(level, range, image);
return std::move(image); return Utility::move(image);
} }
template<UnsignedInt dimensions> BufferImage<dimensions+1> TextureArray<dimensions>::subImage(const Int level, const RangeTypeFor<dimensions+1, Int>& range, BufferImage<dimensions+1>&& image, const BufferUsage usage) { template<UnsignedInt dimensions> BufferImage<dimensions+1> TextureArray<dimensions>::subImage(const Int level, const RangeTypeFor<dimensions+1, Int>& range, BufferImage<dimensions+1>&& image, const BufferUsage usage) {
this->subImage(level, range, image, usage); this->subImage(level, range, image, usage);
return std::move(image); return Utility::move(image);
} }
template<UnsignedInt dimensions> CompressedImage<dimensions+1> TextureArray<dimensions>::compressedSubImage(const Int level, const RangeTypeFor<dimensions+1, Int>& range, CompressedImage<dimensions+1>&& image) { template<UnsignedInt dimensions> CompressedImage<dimensions+1> TextureArray<dimensions>::compressedSubImage(const Int level, const RangeTypeFor<dimensions+1, Int>& range, CompressedImage<dimensions+1>&& image) {
compressedSubImage(level, range, image); compressedSubImage(level, range, image);
return std::move(image); return Utility::move(image);
} }
template<UnsignedInt dimensions> CompressedBufferImage<dimensions+1> TextureArray<dimensions>::compressedSubImage(const Int level, const RangeTypeFor<dimensions+1, Int>& range, CompressedBufferImage<dimensions+1>&& image, const BufferUsage usage) { template<UnsignedInt dimensions> CompressedBufferImage<dimensions+1> TextureArray<dimensions>::compressedSubImage(const Int level, const RangeTypeFor<dimensions+1, Int>& range, CompressedBufferImage<dimensions+1>&& image, const BufferUsage usage) {
compressedSubImage(level, range, image, usage); compressedSubImage(level, range, image, usage);
return std::move(image); return Utility::move(image);
} }
#endif #endif

5
src/Magnum/GL/TransformFeedback.h

@ -32,7 +32,8 @@
*/ */
#endif #endif
#include <utility> /* std::swap() */ #include <initializer_list>
#include <Corrade/Utility/Move.h>
#include "Magnum/Tags.h" #include "Magnum/Tags.h"
#include "Magnum/GL/AbstractObject.h" #include "Magnum/GL/AbstractObject.h"
@ -456,7 +457,7 @@ inline TransformFeedback::TransformFeedback(TransformFeedback&& other) noexcept:
} }
inline TransformFeedback& TransformFeedback::operator=(TransformFeedback&& other) noexcept { inline TransformFeedback& TransformFeedback::operator=(TransformFeedback&& other) noexcept {
using std::swap; using Utility::swap;
swap(_id, other._id); swap(_id, other._id);
swap(_flags, other._flags); swap(_flags, other._flags);
return *this; return *this;

2
src/Magnum/GL/Version.h

@ -29,7 +29,7 @@
* @brief Enum @ref Magnum::GL::Version, function @ref Magnum::GL::version(), @ref Magnum::GL::isVersionES() * @brief Enum @ref Magnum::GL::Version, function @ref Magnum::GL::version(), @ref Magnum::GL::isVersionES()
*/ */
#include <utility> #include <utility> /* std::pair */
#include "Magnum/Magnum.h" #include "Magnum/Magnum.h"
#include "Magnum/GL/visibility.h" #include "Magnum/GL/visibility.h"

22
src/Magnum/Image.cpp

@ -31,11 +31,11 @@
namespace Magnum { namespace Magnum {
template<UnsignedInt dimensions> Image<dimensions>::Image(const PixelStorage storage, const PixelFormat format, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const ImageFlags<dimensions> flags) noexcept: Image{storage, format, {}, pixelFormatSize(format), size, std::move(data), flags} {} template<UnsignedInt dimensions> Image<dimensions>::Image(const PixelStorage storage, const PixelFormat format, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const ImageFlags<dimensions> flags) noexcept: Image{storage, format, {}, pixelFormatSize(format), size, Utility::move(data), flags} {}
template<UnsignedInt dimensions> Image<dimensions>::Image(const PixelStorage storage, const UnsignedInt format, const UnsignedInt formatExtra, const UnsignedInt pixelSize, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const ImageFlags<dimensions> flags) noexcept: Image{storage, pixelFormatWrap(format), formatExtra, pixelSize, size, std::move(data), flags} {} template<UnsignedInt dimensions> Image<dimensions>::Image(const PixelStorage storage, const UnsignedInt format, const UnsignedInt formatExtra, const UnsignedInt pixelSize, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const ImageFlags<dimensions> flags) noexcept: Image{storage, pixelFormatWrap(format), formatExtra, pixelSize, size, Utility::move(data), flags} {}
template<UnsignedInt dimensions> Image<dimensions>::Image(const PixelStorage storage, const PixelFormat format, const UnsignedInt formatExtra, const UnsignedInt pixelSize, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const ImageFlags<dimensions> flags) noexcept: _storage{storage}, _format{format}, _formatExtra{formatExtra}, _pixelSize{pixelSize}, _flags{flags}, _size{size}, _data{std::move(data)} { template<UnsignedInt dimensions> Image<dimensions>::Image(const PixelStorage storage, const PixelFormat format, const UnsignedInt formatExtra, const UnsignedInt pixelSize, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const ImageFlags<dimensions> flags) noexcept: _storage{storage}, _format{format}, _formatExtra{formatExtra}, _pixelSize{pixelSize}, _flags{flags}, _size{size}, _data{Utility::move(data)} {
CORRADE_ASSERT(Implementation::imageDataSize(*this) <= _data.size(), "Image: data too small, got" << _data.size() << "but expected at least" << Implementation::imageDataSize(*this) << "bytes", ); CORRADE_ASSERT(Implementation::imageDataSize(*this) <= _data.size(), "Image: data too small, got" << _data.size() << "but expected at least" << Implementation::imageDataSize(*this) << "bytes", );
#ifndef CORRADE_NO_ASSERT #ifndef CORRADE_NO_ASSERT
Implementation::checkImageFlagsForSize("Image:", flags, size); Implementation::checkImageFlagsForSize("Image:", flags, size);
@ -48,12 +48,12 @@ template<UnsignedInt dimensions> Image<dimensions>::Image(const PixelStorage sto
template<UnsignedInt dimensions> Image<dimensions>::Image(const PixelStorage storage, const PixelFormat format, const UnsignedInt formatExtra, const UnsignedInt pixelSize) noexcept: _storage{storage}, _format{format}, _formatExtra{formatExtra}, _pixelSize{pixelSize}, _data{} {} template<UnsignedInt dimensions> Image<dimensions>::Image(const PixelStorage storage, const PixelFormat format, const UnsignedInt formatExtra, const UnsignedInt pixelSize) noexcept: _storage{storage}, _format{format}, _formatExtra{formatExtra}, _pixelSize{pixelSize}, _data{} {}
template<UnsignedInt dimensions> Image<dimensions>::Image(Image<dimensions>&& other) noexcept: _storage{std::move(other._storage)}, _format{std::move(other._format)}, _formatExtra{std::move(other._formatExtra)}, _pixelSize{std::move(other._pixelSize)}, _flags{std::move(other._flags)}, _size{std::move(other._size)}, _data{std::move(other._data)} { template<UnsignedInt dimensions> Image<dimensions>::Image(Image<dimensions>&& other) noexcept: _storage{Utility::move(other._storage)}, _format{Utility::move(other._format)}, _formatExtra{Utility::move(other._formatExtra)}, _pixelSize{Utility::move(other._pixelSize)}, _flags{Utility::move(other._flags)}, _size{Utility::move(other._size)}, _data{Utility::move(other._data)} {
other._size = {}; other._size = {};
} }
template<UnsignedInt dimensions> Image<dimensions>& Image<dimensions>::operator=(Image<dimensions>&& other) noexcept { template<UnsignedInt dimensions> Image<dimensions>& Image<dimensions>::operator=(Image<dimensions>&& other) noexcept {
using std::swap; using Utility::swap;
swap(_storage, other._storage); swap(_storage, other._storage);
swap(_format, other._format); swap(_format, other._format);
swap(_formatExtra, other._formatExtra); swap(_formatExtra, other._formatExtra);
@ -85,28 +85,28 @@ template<UnsignedInt dimensions> Containers::StridedArrayView<dimensions + 1, co
} }
template<UnsignedInt dimensions> Containers::Array<char> Image<dimensions>::release() { template<UnsignedInt dimensions> Containers::Array<char> Image<dimensions>::release() {
Containers::Array<char> data{std::move(_data)}; Containers::Array<char> data{Utility::move(_data)};
_size = {}; _size = {};
return data; return data;
} }
template<UnsignedInt dimensions> CompressedImage<dimensions>::CompressedImage(const CompressedPixelStorage storage, const CompressedPixelFormat format, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const ImageFlags<dimensions> flags) noexcept: _storage{storage}, _format{format}, _flags{flags}, _size{size}, _data{std::move(data)} { template<UnsignedInt dimensions> CompressedImage<dimensions>::CompressedImage(const CompressedPixelStorage storage, const CompressedPixelFormat format, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const ImageFlags<dimensions> flags) noexcept: _storage{storage}, _format{format}, _flags{flags}, _size{size}, _data{Utility::move(data)} {
#ifndef CORRADE_NO_ASSERT #ifndef CORRADE_NO_ASSERT
Implementation::checkImageFlagsForSize("CompressedImage:", flags, size); Implementation::checkImageFlagsForSize("CompressedImage:", flags, size);
#endif #endif
} }
template<UnsignedInt dimensions> CompressedImage<dimensions>::CompressedImage(const CompressedPixelStorage storage, const UnsignedInt format, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const ImageFlags<dimensions> flags) noexcept: CompressedImage{storage, compressedPixelFormatWrap(format), size, std::move(data), flags} {} template<UnsignedInt dimensions> CompressedImage<dimensions>::CompressedImage(const CompressedPixelStorage storage, const UnsignedInt format, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const ImageFlags<dimensions> flags) noexcept: CompressedImage{storage, compressedPixelFormatWrap(format), size, Utility::move(data), flags} {}
template<UnsignedInt dimensions> CompressedImage<dimensions>::CompressedImage(const CompressedPixelStorage storage) noexcept: _storage{storage}, _format{} {} template<UnsignedInt dimensions> CompressedImage<dimensions>::CompressedImage(const CompressedPixelStorage storage) noexcept: _storage{storage}, _format{} {}
template<UnsignedInt dimensions> CompressedImage<dimensions>::CompressedImage(CompressedImage<dimensions>&& other) noexcept: _storage{std::move(other._storage)}, _format{std::move(other._format)}, _flags{other._flags}, _size{std::move(other._size)}, _data{std::move(other._data)} template<UnsignedInt dimensions> CompressedImage<dimensions>::CompressedImage(CompressedImage<dimensions>&& other) noexcept: _storage{Utility::move(other._storage)}, _format{Utility::move(other._format)}, _flags{other._flags}, _size{Utility::move(other._size)}, _data{Utility::move(other._data)}
{ {
other._size = {}; other._size = {};
} }
template<UnsignedInt dimensions> CompressedImage<dimensions>& CompressedImage<dimensions>::operator=(CompressedImage<dimensions>&& other) noexcept { template<UnsignedInt dimensions> CompressedImage<dimensions>& CompressedImage<dimensions>::operator=(CompressedImage<dimensions>&& other) noexcept {
using std::swap; using Utility::swap;
swap(_storage, other._storage); swap(_storage, other._storage);
swap(_format, other._format); swap(_format, other._format);
swap(_flags, other._flags); swap(_flags, other._flags);
@ -128,7 +128,7 @@ template<UnsignedInt dimensions> std::pair<VectorTypeFor<dimensions, std::size_t
} }
template<UnsignedInt dimensions> Containers::Array<char> CompressedImage<dimensions>::release() { template<UnsignedInt dimensions> Containers::Array<char> CompressedImage<dimensions>::release() {
Containers::Array<char> data{std::move(_data)}; Containers::Array<char> data{Utility::move(_data)};
_size = {}; _size = {};
return data; return data;
} }

16
src/Magnum/Image.h

@ -153,7 +153,7 @@ template<UnsignedInt dimensions> class Image {
* Equivalent to calling @ref Image(PixelStorage, PixelFormat, const VectorTypeFor<dimensions, Int>&, Containers::Array<char>&&, ImageFlags<dimensions>) * Equivalent to calling @ref Image(PixelStorage, PixelFormat, const VectorTypeFor<dimensions, Int>&, Containers::Array<char>&&, ImageFlags<dimensions>)
* with default-constructed @ref PixelStorage. * with default-constructed @ref PixelStorage.
*/ */
explicit Image(PixelFormat format, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, ImageFlags<dimensions> flags = {}) noexcept: Image{{}, format, size, std::move(data), flags} {} explicit Image(PixelFormat format, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, ImageFlags<dimensions> flags = {}) noexcept: Image{{}, format, size, Utility::move(data), flags} {}
/** /**
* @brief Construct an image placeholder * @brief Construct an image placeholder
@ -276,7 +276,7 @@ template<UnsignedInt dimensions> class Image {
* Equivalent to calling @ref Image(PixelStorage, T, U, const VectorTypeFor<dimensions, Int>&, Containers::Array<char>&&, ImageFlags<dimensions>) * Equivalent to calling @ref Image(PixelStorage, T, U, const VectorTypeFor<dimensions, Int>&, Containers::Array<char>&&, ImageFlags<dimensions>)
* with default-constructed @ref PixelStorage. * with default-constructed @ref PixelStorage.
*/ */
template<class T, class U> explicit Image(T format, U formatExtra, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, ImageFlags<dimensions> flags = {}) noexcept: Image{{}, format, formatExtra, size, std::move(data), flags} {} template<class T, class U> explicit Image(T format, U formatExtra, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, ImageFlags<dimensions> flags = {}) noexcept: Image{{}, format, formatExtra, size, Utility::move(data), flags} {}
/** /**
* @brief Construct an image with implementation-specific pixel format * @brief Construct an image with implementation-specific pixel format
@ -288,7 +288,7 @@ template<UnsignedInt dimensions> class Image {
* Equivalent to calling @ref Image(PixelStorage, T, const VectorTypeFor<dimensions, Int>&, Containers::Array<char>&&, ImageFlags<dimensions>) * Equivalent to calling @ref Image(PixelStorage, T, const VectorTypeFor<dimensions, Int>&, Containers::Array<char>&&, ImageFlags<dimensions>)
* with default-constructed @ref PixelStorage. * with default-constructed @ref PixelStorage.
*/ */
template<class T> explicit Image(T format, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, ImageFlags<dimensions> flags = {}) noexcept: Image{{}, format, size, std::move(data), flags} {} template<class T> explicit Image(T format, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, ImageFlags<dimensions> flags = {}) noexcept: Image{{}, format, size, Utility::move(data), flags} {}
/** /**
* @brief Construct an image placeholder with implementation-specific pixel format * @brief Construct an image placeholder with implementation-specific pixel format
@ -588,7 +588,7 @@ template<UnsignedInt dimensions> class CompressedImage {
* Equivalent to calling @ref CompressedImage(CompressedPixelStorage, CompressedPixelFormat, const VectorTypeFor<dimensions, Int>&, Containers::Array<char>&&, ImageFlags<dimensions>) * Equivalent to calling @ref CompressedImage(CompressedPixelStorage, CompressedPixelFormat, const VectorTypeFor<dimensions, Int>&, Containers::Array<char>&&, ImageFlags<dimensions>)
* with default-constructed @ref CompressedPixelStorage. * with default-constructed @ref CompressedPixelStorage.
*/ */
explicit CompressedImage(CompressedPixelFormat format, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, ImageFlags<dimensions> flags = {}) noexcept: CompressedImage{{}, format, size, std::move(data), flags} {} explicit CompressedImage(CompressedPixelFormat format, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, ImageFlags<dimensions> flags = {}) noexcept: CompressedImage{{}, format, size, Utility::move(data), flags} {}
/** /**
* @brief Construct a compressed image with implementation-specific format * @brief Construct a compressed image with implementation-specific format
@ -616,7 +616,7 @@ template<UnsignedInt dimensions> class CompressedImage {
* Equivalent to calling @ref CompressedImage(CompressedPixelStorage, T, const VectorTypeFor<dimensions, Int>&, Containers::Array<char>&&, ImageFlags<dimensions>) * Equivalent to calling @ref CompressedImage(CompressedPixelStorage, T, const VectorTypeFor<dimensions, Int>&, Containers::Array<char>&&, ImageFlags<dimensions>)
* with default-constructed @ref CompressedPixelStorage. * with default-constructed @ref CompressedPixelStorage.
*/ */
template<class T> explicit CompressedImage(T format, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, ImageFlags<dimensions> flags = {}) noexcept: CompressedImage{{}, format, size, std::move(data), flags} {} template<class T> explicit CompressedImage(T format, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, ImageFlags<dimensions> flags = {}) noexcept: CompressedImage{{}, format, size, Utility::move(data), flags} {}
/** /**
* @brief Construct an image placeholder * @brief Construct an image placeholder
@ -771,12 +771,12 @@ typedef CompressedImage<2> CompressedImage2D;
/** @brief Three-dimensional compressed image */ /** @brief Three-dimensional compressed image */
typedef CompressedImage<3> CompressedImage3D; typedef CompressedImage<3> CompressedImage3D;
template<UnsignedInt dimensions> template<class T, class U> inline Image<dimensions>::Image(const PixelStorage storage, const T format, const U formatExtra, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const ImageFlags<dimensions> flags) noexcept: Image{storage, UnsignedInt(format), UnsignedInt(formatExtra), Implementation::pixelFormatSizeAdl(format, formatExtra), size, std::move(data), flags} { template<UnsignedInt dimensions> template<class T, class U> inline Image<dimensions>::Image(const PixelStorage storage, const T format, const U formatExtra, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const ImageFlags<dimensions> flags) noexcept: Image{storage, UnsignedInt(format), UnsignedInt(formatExtra), Implementation::pixelFormatSizeAdl(format, formatExtra), size, Utility::move(data), flags} {
static_assert(sizeof(T) <= 4 && sizeof(U) <= 4, static_assert(sizeof(T) <= 4 && sizeof(U) <= 4,
"format types larger than 32bits are not supported"); "format types larger than 32bits are not supported");
} }
template<UnsignedInt dimensions> template<class T> inline Image<dimensions>::Image(const PixelStorage storage, const T format, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const ImageFlags<dimensions> flags) noexcept: Image{storage, UnsignedInt(format), {}, Implementation::pixelFormatSizeAdl(format), size, std::move(data), flags} { template<UnsignedInt dimensions> template<class T> inline Image<dimensions>::Image(const PixelStorage storage, const T format, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const ImageFlags<dimensions> flags) noexcept: Image{storage, UnsignedInt(format), {}, Implementation::pixelFormatSizeAdl(format), size, Utility::move(data), flags} {
static_assert(sizeof(T) <= 4, static_assert(sizeof(T) <= 4,
"format types larger than 32bits are not supported"); "format types larger than 32bits are not supported");
} }
@ -791,7 +791,7 @@ template<UnsignedInt dimensions> template<class T> inline Image<dimensions>::Ima
"format types larger than 32bits are not supported"); "format types larger than 32bits are not supported");
} }
template<UnsignedInt dimensions> template<class T> inline CompressedImage<dimensions>::CompressedImage(const CompressedPixelStorage storage, const T format, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const ImageFlags<dimensions> flags) noexcept: CompressedImage{storage, UnsignedInt(format), size, std::move(data), flags} { template<UnsignedInt dimensions> template<class T> inline CompressedImage<dimensions>::CompressedImage(const CompressedPixelStorage storage, const T format, const VectorTypeFor<dimensions, Int>& size, Containers::Array<char>&& data, const ImageFlags<dimensions> flags) noexcept: CompressedImage{storage, UnsignedInt(format), size, Utility::move(data), flags} {
static_assert(sizeof(T) <= 4, static_assert(sizeof(T) <= 4,
"format types larger than 32bits are not supported"); "format types larger than 32bits are not supported");
} }

2
src/Magnum/Implementation/ImageProperties.h

@ -25,7 +25,7 @@
DEALINGS IN THE SOFTWARE. DEALINGS IN THE SOFTWARE.
*/ */
#include <utility> #include <utility> /* std::pair */
#include <Corrade/Containers/StridedArrayView.h> #include <Corrade/Containers/StridedArrayView.h>
#include "Magnum/Magnum.h" #include "Magnum/Magnum.h"

2
src/Magnum/MaterialTools/Copy.cpp

@ -61,7 +61,7 @@ Trade::MaterialData copy(Trade::MaterialData&& material) {
Utility::copy(material.layerData(), layers); Utility::copy(material.layerData(), layers);
} }
return Trade::MaterialData{material.types(), std::move(attributes), std::move(layers), material.importerState()}; return Trade::MaterialData{material.types(), Utility::move(attributes), Utility::move(layers), material.importerState()};
} }
}} }}

2
src/Magnum/MaterialTools/Filter.cpp

@ -102,7 +102,7 @@ Trade::MaterialData filterAttributesLayersImplementation(const Trade::MaterialDa
Containers::Array<Trade::MaterialAttributeData> attributes{patchedInputAttributesToKeep.count()}; Containers::Array<Trade::MaterialAttributeData> attributes{patchedInputAttributesToKeep.count()};
Utility::copyMasked(material.attributeData(), patchedInputAttributesToKeep, attributes); Utility::copyMasked(material.attributeData(), patchedInputAttributesToKeep, attributes);
return Trade::MaterialData{material.types() & typesToKeep, std::move(attributes), std::move(layers)}; return Trade::MaterialData{material.types() & typesToKeep, Utility::move(attributes), Utility::move(layers)};
} }
} }

2
src/Magnum/MaterialTools/Merge.cpp

@ -114,7 +114,7 @@ Containers::Optional<Trade::MaterialData> merge(const Trade::MaterialData& first
CORRADE_INTERNAL_ASSERT(layer == layers.size()); CORRADE_INTERNAL_ASSERT(layer == layers.size());
return Trade::MaterialData{first.types()|second.types(), std::move(attributes), std::move(layers)}; return Trade::MaterialData{first.types()|second.types(), Utility::move(attributes), Utility::move(layers)};
} }
}} }}

2
src/Magnum/MaterialTools/PhongToPbrMetallicRoughness.cpp

@ -146,7 +146,7 @@ Containers::Optional<Trade::MaterialData> phongToPbrMetallicRoughness(const Trad
correctly, so just unpack the Optional directly. */ correctly, so just unpack the Optional directly. */
return *CORRADE_INTERNAL_ASSERT_EXPRESSION(merge( return *CORRADE_INTERNAL_ASSERT_EXPRESSION(merge(
filterAttributes(material, attributesToKeep, ~Trade::MaterialType::Phong), filterAttributes(material, attributesToKeep, ~Trade::MaterialType::Phong),
Trade::MaterialData{Trade::MaterialType::PbrMetallicRoughness, std::move(attributes)})); Trade::MaterialData{Trade::MaterialType::PbrMetallicRoughness, Utility::move(attributes)}));
} }
}} }}

4
src/Magnum/MaterialTools/Test/CopyTest.cpp

@ -175,7 +175,7 @@ void CopyTest::rvalueOwnedAttributesLayers() {
const void* originalAttributes = attributes.data(); const void* originalAttributes = attributes.data();
const void* originalLayers = layers.data(); const void* originalLayers = layers.data();
Trade::MaterialData copy = MaterialTools::copy(Trade::MaterialData{Trade::MaterialType::PbrMetallicRoughness, std::move(attributes), std::move(layers), reinterpret_cast<void*>(0xdeadbeef)}); Trade::MaterialData copy = MaterialTools::copy(Trade::MaterialData{Trade::MaterialType::PbrMetallicRoughness, Utility::move(attributes), Utility::move(layers), reinterpret_cast<void*>(0xdeadbeef)});
CORRADE_COMPARE(copy.types(), Trade::MaterialType::PbrMetallicRoughness); CORRADE_COMPARE(copy.types(), Trade::MaterialType::PbrMetallicRoughness);
CORRADE_COMPARE(copy.importerState(), reinterpret_cast<void*>(0xdeadbeef)); CORRADE_COMPARE(copy.importerState(), reinterpret_cast<void*>(0xdeadbeef));
@ -201,7 +201,7 @@ void CopyTest::rvalueOwnedAttributesNoLayerData() {
Containers::Array<UnsignedInt> layers{InPlaceInit, {2, 3}}; Containers::Array<UnsignedInt> layers{InPlaceInit, {2, 3}};
const void* originalAttributes = attributes.data(); const void* originalAttributes = attributes.data();
Trade::MaterialData copy = MaterialTools::copy(Trade::MaterialData{Trade::MaterialType::PbrMetallicRoughness, std::move(attributes), reinterpret_cast<void*>(0xdeadbeef)}); Trade::MaterialData copy = MaterialTools::copy(Trade::MaterialData{Trade::MaterialType::PbrMetallicRoughness, Utility::move(attributes), reinterpret_cast<void*>(0xdeadbeef)});
CORRADE_COMPARE(copy.types(), Trade::MaterialType::PbrMetallicRoughness); CORRADE_COMPARE(copy.types(), Trade::MaterialType::PbrMetallicRoughness);
CORRADE_COMPARE(copy.importerState(), reinterpret_cast<void*>(0xdeadbeef)); CORRADE_COMPARE(copy.importerState(), reinterpret_cast<void*>(0xdeadbeef));

2
src/Magnum/Math/Algorithms/GaussJordan.h

@ -62,7 +62,7 @@ template<std::size_t size, std::size_t rows, class T> bool gaussJordanInPlaceTra
rowMax = row2; rowMax = row2;
/* Swap the rows */ /* Swap the rows */
using std::swap; using Corrade::Utility::swap;
swap(a[row], a[rowMax]); swap(a[row], a[rowMax]);
swap(t[row], t[rowMax]); swap(t[row], t[rowMax]);

3
src/Magnum/Math/Functions.h

@ -35,6 +35,7 @@
#include <cstdlib> /* std::div() */ #include <cstdlib> /* std::div() */
#include <type_traits> #include <type_traits>
#include <utility> #include <utility>
#include <Corrade/Utility/Move.h>
#include <Corrade/Utility/StlMath.h> #include <Corrade/Utility/StlMath.h>
#include "Magnum/visibility.h" #include "Magnum/visibility.h"
@ -350,7 +351,7 @@ template<class T> inline typename std::enable_if<IsScalar<T>::value, std::pair<T
/** @overload */ /** @overload */
template<std::size_t size, class T> inline std::pair<Vector<size, T>, Vector<size, T>> minmax(const Vector<size, T>& a, const Vector<size, T>& b) { template<std::size_t size, class T> inline std::pair<Vector<size, T>, Vector<size, T>> minmax(const Vector<size, T>& a, const Vector<size, T>& b) {
using std::swap; using Corrade::Utility::swap;
std::pair<Vector<size, T>, Vector<size, T>> out{a, b}; std::pair<Vector<size, T>, Vector<size, T>> out{a, b};
for(std::size_t i = 0; i != size; ++i) for(std::size_t i = 0; i != size; ++i)
if(out.first[i] > out.second[i]) swap(out.first[i], out.second[i]); if(out.first[i] > out.second[i]) swap(out.first[i], out.second[i]);

1
src/Magnum/Math/Test/IntersectionBenchmark.cpp

@ -25,7 +25,6 @@
*/ */
#include <random> #include <random>
#include <utility>
#include <Corrade/TestSuite/Tester.h> #include <Corrade/TestSuite/Tester.h>
#include "Magnum/Math/Angle.h" #include "Magnum/Math/Angle.h"

2
src/Magnum/MeshTools/Combine.cpp

@ -106,7 +106,7 @@ Trade::MeshData combineIndexedImplementation(
/* Combine the index buffer in */ /* Combine the index buffer in */
return Trade::MeshData{primitive, return Trade::MeshData{primitive,
std::move(indexData), Trade::MeshIndexData{indexDataI}, Utility::move(indexData), Trade::MeshIndexData{indexDataI},
out.releaseVertexData(), out.releaseAttributeData(), vertexCount}; out.releaseVertexData(), out.releaseAttributeData(), vertexCount};
} }

20
src/Magnum/MeshTools/Compile.cpp

@ -113,7 +113,7 @@ GL::Mesh compileInternal(const Trade::MeshData& meshData, GL::Buffer&& indices,
/* For the first attribute move the buffer in, for all others use /* For the first attribute move the buffer in, for all others use
the reference */ the reference */
if(vertices.id()) mesh.addVertexBuffer(std::move(vertices), if(vertices.id()) mesh.addVertexBuffer(Utility::move(vertices),
meshData.attributeOffset(i) + offset, stride, attribute); meshData.attributeOffset(i) + offset, stride, attribute);
else mesh.addVertexBuffer(verticesRef, meshData.attributeOffset(i) + offset, else mesh.addVertexBuffer(verticesRef, meshData.attributeOffset(i) + offset,
stride, attribute); stride, attribute);
@ -244,7 +244,7 @@ GL::Mesh compileInternal(const Trade::MeshData& meshData, GL::Buffer&& indices,
CORRADE_ASSERT(isMeshIndexTypeImplementationSpecific(meshData.indexType()) || Short(meshIndexTypeSize(meshData.indexType())) == meshData.indexStride(), CORRADE_ASSERT(isMeshIndexTypeImplementationSpecific(meshData.indexType()) || Short(meshIndexTypeSize(meshData.indexType())) == meshData.indexStride(),
"MeshTools::compile():" << meshData.indexType() << "with stride of" << meshData.indexStride() << "bytes isn't supported by OpenGL", GL::Mesh{}); "MeshTools::compile():" << meshData.indexType() << "with stride of" << meshData.indexStride() << "bytes isn't supported by OpenGL", GL::Mesh{});
mesh.setIndexBuffer(std::move(indices), meshData.indexOffset(), meshData.indexType()) mesh.setIndexBuffer(Utility::move(indices), meshData.indexOffset(), meshData.indexType())
.setCount(meshData.indexCount()); .setCount(meshData.indexCount());
} else mesh.setCount(meshData.vertexCount()); } else mesh.setCount(meshData.vertexCount());
@ -261,13 +261,13 @@ GL::Mesh compileInternal(const Trade::MeshData& meshData, const CompileFlags fla
GL::Buffer vertices{GL::Buffer::TargetHint::Array}; GL::Buffer vertices{GL::Buffer::TargetHint::Array};
vertices.setData(meshData.vertexData()); vertices.setData(meshData.vertexData());
return compileInternal(meshData, std::move(indices), std::move(vertices), flags); return compileInternal(meshData, Utility::move(indices), Utility::move(vertices), flags);
} }
} }
GL::Mesh compile(const Trade::MeshData& mesh, GL::Buffer&& indices, GL::Buffer&& vertices) { GL::Mesh compile(const Trade::MeshData& mesh, GL::Buffer&& indices, GL::Buffer&& vertices) {
return compileInternal(mesh, std::move(indices), std::move(vertices), {}); return compileInternal(mesh, Utility::move(indices), Utility::move(vertices), {});
} }
GL::Mesh compile(const Trade::MeshData& mesh, GL::Buffer& indices, GL::Buffer& vertices) { GL::Mesh compile(const Trade::MeshData& mesh, GL::Buffer& indices, GL::Buffer& vertices) {
@ -275,11 +275,11 @@ GL::Mesh compile(const Trade::MeshData& mesh, GL::Buffer& indices, GL::Buffer& v
} }
GL::Mesh compile(const Trade::MeshData& mesh, GL::Buffer& indices, GL::Buffer&& vertices) { GL::Mesh compile(const Trade::MeshData& mesh, GL::Buffer& indices, GL::Buffer&& vertices) {
return compileInternal(mesh, GL::Buffer::wrap(indices.id(), GL::Buffer::TargetHint::ElementArray), std::move(vertices), CompileFlag::NoWarnOnCustomAttributes); return compileInternal(mesh, GL::Buffer::wrap(indices.id(), GL::Buffer::TargetHint::ElementArray), Utility::move(vertices), CompileFlag::NoWarnOnCustomAttributes);
} }
GL::Mesh compile(const Trade::MeshData& mesh, GL::Buffer&& indices, GL::Buffer& vertices) { GL::Mesh compile(const Trade::MeshData& mesh, GL::Buffer&& indices, GL::Buffer& vertices) {
return compileInternal(mesh, std::move(indices), GL::Buffer::wrap(vertices.id(), GL::Buffer::TargetHint::Array), CompileFlag::NoWarnOnCustomAttributes); return compileInternal(mesh, Utility::move(indices), GL::Buffer::wrap(vertices.id(), GL::Buffer::TargetHint::Array), CompileFlag::NoWarnOnCustomAttributes);
} }
GL::Mesh compile(const Trade::MeshData& mesh) { GL::Mesh compile(const Trade::MeshData& mesh) {
@ -363,7 +363,7 @@ GL::Mesh compile(const Trade::MeshData2D& meshData) {
Containers::Array<char> data = interleave( Containers::Array<char> data = interleave(
meshData.positions(0), meshData.positions(0),
stride - sizeof(Shaders::Generic2D::Position::Type)); stride - sizeof(Shaders::Generic2D::Position::Type));
mesh.addVertexBuffer(std::move(vertexBuffer), 0, mesh.addVertexBuffer(Utility::move(vertexBuffer), 0,
Shaders::Generic2D::Position(), Shaders::Generic2D::Position(),
stride - sizeof(Shaders::Generic2D::Position::Type)); stride - sizeof(Shaders::Generic2D::Position::Type));
@ -404,7 +404,7 @@ GL::Mesh compile(const Trade::MeshData2D& meshData) {
GL::Buffer indexBuffer{GL::Buffer::TargetHint::ElementArray}; GL::Buffer indexBuffer{GL::Buffer::TargetHint::ElementArray};
indexBuffer.setData(indexData, GL::BufferUsage::StaticDraw); indexBuffer.setData(indexData, GL::BufferUsage::StaticDraw);
mesh.setCount(meshData.indices().size()) mesh.setCount(meshData.indices().size())
.setIndexBuffer(std::move(indexBuffer), 0, indexType, indexStart, indexEnd); .setIndexBuffer(Utility::move(indexBuffer), 0, indexType, indexStart, indexEnd);
/* Else set vertex count */ /* Else set vertex count */
} else mesh.setCount(meshData.positions(0).size()); } else mesh.setCount(meshData.positions(0).size());
@ -504,7 +504,7 @@ GL::Mesh compile(const Trade::MeshData3D& meshData, CompileFlags flags) {
Containers::Array<char> data = interleave( Containers::Array<char> data = interleave(
positions, positions,
stride - sizeof(Shaders::Generic3D::Position::Type)); stride - sizeof(Shaders::Generic3D::Position::Type));
mesh.addVertexBuffer(std::move(vertexBuffer), 0, mesh.addVertexBuffer(Utility::move(vertexBuffer), 0,
Shaders::Generic3D::Position(), Shaders::Generic3D::Position(),
stride - sizeof(Shaders::Generic3D::Position::Type)); stride - sizeof(Shaders::Generic3D::Position::Type));
@ -558,7 +558,7 @@ GL::Mesh compile(const Trade::MeshData3D& meshData, CompileFlags flags) {
GL::Buffer indexBuffer{GL::Buffer::TargetHint::ElementArray}; GL::Buffer indexBuffer{GL::Buffer::TargetHint::ElementArray};
indexBuffer.setData(indexData, GL::BufferUsage::StaticDraw); indexBuffer.setData(indexData, GL::BufferUsage::StaticDraw);
mesh.setCount(meshData.indices().size()) mesh.setCount(meshData.indices().size())
.setIndexBuffer(std::move(indexBuffer), 0, indexType, indexStart, indexEnd); .setIndexBuffer(Utility::move(indexBuffer), 0, indexType, indexStart, indexEnd);
/* Else set vertex count */ /* Else set vertex count */
} else mesh.setCount(positions.size()); } else mesh.setCount(positions.size());

4
src/Magnum/MeshTools/CompileLines.cpp

@ -54,7 +54,7 @@ GL::Mesh compileLines(const Trade::MeshData& mesh) {
/* Upload the buffers, bind the line-specific attributes manually */ /* Upload the buffers, bind the line-specific attributes manually */
GL::Buffer indices{GL::Buffer::TargetHint::ElementArray, mesh.indexData()}; GL::Buffer indices{GL::Buffer::TargetHint::ElementArray, mesh.indexData()};
GL::Buffer vertices{GL::Buffer::TargetHint::Array, mesh.vertexData()}; GL::Buffer vertices{GL::Buffer::TargetHint::Array, mesh.vertexData()};
GL::Mesh out = compile(mesh, std::move(indices), vertices); GL::Mesh out = compile(mesh, Utility::move(indices), vertices);
/* Warn about attributes that are conflicting with line-specific attributes /* Warn about attributes that are conflicting with line-specific attributes
and thus will get overwritten */ and thus will get overwritten */
@ -79,7 +79,7 @@ GL::Mesh compileLines(const Trade::MeshData& mesh) {
mesh.attributeOffset(Implementation::LineMeshAttributeNextPosition), mesh.attributeOffset(Implementation::LineMeshAttributeNextPosition),
mesh.attributeStride(Implementation::LineMeshAttributeNextPosition), mesh.attributeStride(Implementation::LineMeshAttributeNextPosition),
GL::DynamicAttribute{Shaders::LineGL3D::NextPosition{}, mesh.attributeFormat(Implementation::LineMeshAttributeNextPosition)}); GL::DynamicAttribute{Shaders::LineGL3D::NextPosition{}, mesh.attributeFormat(Implementation::LineMeshAttributeNextPosition)});
out.addVertexBuffer(std::move(vertices), out.addVertexBuffer(Utility::move(vertices),
mesh.attributeOffset(Implementation::LineMeshAttributeAnnotation), mesh.attributeOffset(Implementation::LineMeshAttributeAnnotation),
mesh.attributeStride(Implementation::LineMeshAttributeAnnotation), mesh.attributeStride(Implementation::LineMeshAttributeAnnotation),
GL::DynamicAttribute{Shaders::LineGL3D::Annotation{}, mesh.attributeFormat(Implementation::LineMeshAttributeAnnotation)}); GL::DynamicAttribute{Shaders::LineGL3D::Annotation{}, mesh.attributeFormat(Implementation::LineMeshAttributeAnnotation)});

8
src/Magnum/MeshTools/CompressIndices.cpp

@ -81,7 +81,7 @@ template<class T> Containers::Pair<Containers::Array<char>, MeshIndexType> compr
type = MeshIndexType::UnsignedInt; type = MeshIndexType::UnsignedInt;
} }
return {std::move(out), type}; return {Utility::move(out), type};
} }
} }
@ -171,8 +171,8 @@ Trade::MeshData compressIndices(Trade::MeshData&& mesh, MeshIndexType atLeast) {
} }
Trade::MeshIndexData indices{result.second(), result.first()}; Trade::MeshIndexData indices{result.second(), result.first()};
return Trade::MeshData{mesh.primitive(), std::move(result.first()), indices, return Trade::MeshData{mesh.primitive(), Utility::move(result.first()), indices,
std::move(vertexData), std::move(attributeData), newVertexCount}; Utility::move(vertexData), Utility::move(attributeData), newVertexCount};
} }
Trade::MeshData compressIndices(const Trade::MeshData& mesh, MeshIndexType atLeast) { Trade::MeshData compressIndices(const Trade::MeshData& mesh, MeshIndexType atLeast) {
@ -185,7 +185,7 @@ Trade::MeshData compressIndices(const Trade::MeshData& mesh, MeshIndexType atLea
std::tuple<Containers::Array<char>, MeshIndexType, UnsignedInt, UnsignedInt> compressIndices(const std::vector<UnsignedInt>& indices) { std::tuple<Containers::Array<char>, MeshIndexType, UnsignedInt, UnsignedInt> compressIndices(const std::vector<UnsignedInt>& indices) {
const auto minmax = Math::minmax(indices); const auto minmax = Math::minmax(indices);
Containers::Pair<Containers::Array<char>, MeshIndexType> dataType = compressIndices(indices, MeshIndexType::UnsignedByte); Containers::Pair<Containers::Array<char>, MeshIndexType> dataType = compressIndices(indices, MeshIndexType::UnsignedByte);
return std::make_tuple(std::move(dataType.first()), dataType.second(), minmax.first, minmax.second); return std::make_tuple(Utility::move(dataType.first()), dataType.second(), minmax.first, minmax.second);
} }
template<class T> Containers::Array<T> compressIndicesAs(const std::vector<UnsignedInt>& indices) { template<class T> Containers::Array<T> compressIndicesAs(const std::vector<UnsignedInt>& indices) {

6
src/Magnum/MeshTools/Concatenate.cpp

@ -82,9 +82,9 @@ Trade::MeshData concatenate(Containers::Array<char>&& indexData, const UnsignedI
Trade::MeshData out{meshes.front().primitive(), Trade::MeshData out{meshes.front().primitive(),
/* If the index array is empty, we're creating a non-indexed mesh (not /* If the index array is empty, we're creating a non-indexed mesh (not
an indexed mesh with zero indices) */ an indexed mesh with zero indices) */
std::move(indexData), indices.isEmpty() ? Utility::move(indexData), indices.isEmpty() ?
Trade::MeshIndexData{} : Trade::MeshIndexData{indices}, Trade::MeshIndexData{} : Trade::MeshIndexData{indices},
std::move(vertexData), std::move(attributeData), vertexCount}; Utility::move(vertexData), Utility::move(attributeData), vertexCount};
/* Go through all meshes and put all attributes and index arrays /* Go through all meshes and put all attributes and index arrays
together */ together */
@ -203,7 +203,7 @@ Trade::MeshData concatenate(const Containers::Iterable<const Trade::MeshData>& m
indexVertexCount.first()*sizeof(UnsignedInt)}; indexVertexCount.first()*sizeof(UnsignedInt)};
Containers::Array<char> vertexData{ValueInit, Containers::Array<char> vertexData{ValueInit,
attributeData.isEmpty() ? 0 : (attributeData[0].stride()*indexVertexCount.second())}; attributeData.isEmpty() ? 0 : (attributeData[0].stride()*indexVertexCount.second())};
return Implementation::concatenate(std::move(indexData), indexVertexCount.second(), std::move(vertexData), std::move(attributeData), meshes, "MeshTools::concatenate():"); return Implementation::concatenate(Utility::move(indexData), indexVertexCount.second(), Utility::move(vertexData), Utility::move(attributeData), meshes, "MeshTools::concatenate():");
} }
}} }}

4
src/Magnum/MeshTools/Concatenate.h

@ -125,7 +125,7 @@ template<template<class> class Allocator = Containers::ArrayAllocator> void conc
Containers::arrayResize<Allocator>(indexData, NoInit, indexVertexCount.first()*sizeof(UnsignedInt)); Containers::arrayResize<Allocator>(indexData, NoInit, indexVertexCount.first()*sizeof(UnsignedInt));
} }
Containers::Array<Trade::MeshAttributeData> attributeData = Implementation::interleavedLayout(std::move(destination), {}, flags); Containers::Array<Trade::MeshAttributeData> attributeData = Implementation::interleavedLayout(Utility::move(destination), {}, flags);
Containers::Array<char> vertexData; Containers::Array<char> vertexData;
if(!attributeData.isEmpty() && indexVertexCount.second()) { if(!attributeData.isEmpty() && indexVertexCount.second()) {
const UnsignedInt attributeStride = attributeData[0].stride(); const UnsignedInt attributeStride = attributeData[0].stride();
@ -139,7 +139,7 @@ template<template<class> class Allocator = Containers::ArrayAllocator> void conc
Containers::arrayResize<Allocator>(vertexData, ValueInit, attributeStride*std::size_t(indexVertexCount.second())); Containers::arrayResize<Allocator>(vertexData, ValueInit, attributeStride*std::size_t(indexVertexCount.second()));
} }
destination = Implementation::concatenate(std::move(indexData), indexVertexCount.second(), std::move(vertexData), std::move(attributeData), meshes, "MeshTools::concatenateInto():"); destination = Implementation::concatenate(Utility::move(indexData), indexVertexCount.second(), Utility::move(vertexData), Utility::move(attributeData), meshes, "MeshTools::concatenateInto():");
} }
}} }}

8
src/Magnum/MeshTools/Copy.cpp

@ -132,7 +132,7 @@ Trade::MeshData copy(Trade::MeshData&& mesh) {
we can reuse the original array in its entirety */ we can reuse the original array in its entirety */
Containers::Array<Trade::MeshAttributeData> attributeData; Containers::Array<Trade::MeshAttributeData> attributeData;
if(!originalAttributeData.deleter() && (mesh.vertexDataFlags() & Trade::DataFlag::Owned)) { if(!originalAttributeData.deleter() && (mesh.vertexDataFlags() & Trade::DataFlag::Owned)) {
attributeData = std::move(originalAttributeData); attributeData = Utility::move(originalAttributeData);
/* Otherwise we have to allocate a new one and re-route the attributes to /* Otherwise we have to allocate a new one and re-route the attributes to
a potentially different vertex array */ a potentially different vertex array */
@ -156,8 +156,8 @@ Trade::MeshData copy(Trade::MeshData&& mesh) {
} }
return Trade::MeshData{mesh.primitive(), return Trade::MeshData{mesh.primitive(),
std::move(indexData), indices, Utility::move(indexData), indices,
std::move(vertexData), std::move(attributeData), Utility::move(vertexData), Utility::move(attributeData),
vertexCount}; vertexCount};
} }
@ -167,7 +167,7 @@ Trade::MeshData owned(const Trade::MeshData& mesh) {
} }
Trade::MeshData owned(Trade::MeshData&& mesh) { Trade::MeshData owned(Trade::MeshData&& mesh) {
return copy(std::move(mesh)); return copy(Utility::move(mesh));
} }
#endif #endif

2
src/Magnum/MeshTools/Filter.cpp

@ -62,7 +62,7 @@ Trade::MeshData filterAttributes(const Trade::MeshData& mesh, const Containers::
return Trade::MeshData{mesh.primitive(), return Trade::MeshData{mesh.primitive(),
{}, mesh.indexData(), indices, {}, mesh.indexData(), indices,
{}, mesh.vertexData(), std::move(filtered), {}, mesh.vertexData(), Utility::move(filtered),
mesh.vertexCount()}; mesh.vertexCount()};
} }

2
src/Magnum/MeshTools/FlipNormals.cpp

@ -39,7 +39,7 @@ namespace {
template<class T> inline void flipFaceWindingInPlaceImplementation(const Containers::StridedArrayView1D<T>& indices) { template<class T> inline void flipFaceWindingInPlaceImplementation(const Containers::StridedArrayView1D<T>& indices) {
CORRADE_ASSERT(!(indices.size()%3), "MeshTools::flipNormals(): index count is not divisible by 3!", ); CORRADE_ASSERT(!(indices.size()%3), "MeshTools::flipNormals(): index count is not divisible by 3!", );
using std::swap; using Utility::swap;
for(std::size_t i = 0; i != indices.size(); i += 3) for(std::size_t i = 0; i != indices.size(); i += 3)
swap(indices[i+1], indices[i+2]); swap(indices[i+1], indices[i+2]);
} }

2
src/Magnum/MeshTools/FullScreenTriangle.cpp

@ -51,7 +51,7 @@ GL::Mesh fullScreenTriangle(const GL::Version version) {
}; };
GL::Buffer buffer{GL::Buffer::TargetHint::Array}; GL::Buffer buffer{GL::Buffer::TargetHint::Array};
buffer.setData(triangle, GL::BufferUsage::StaticDraw); buffer.setData(triangle, GL::BufferUsage::StaticDraw);
mesh.addVertexBuffer(std::move(buffer), 0, GL::Attribute<0, Vector2>{}); mesh.addVertexBuffer(Utility::move(buffer), 0, GL::Attribute<0, Vector2>{});
} }
#ifdef MAGNUM_TARGET_GLES2 #ifdef MAGNUM_TARGET_GLES2

4
src/Magnum/MeshTools/GenerateIndices.cpp

@ -650,8 +650,8 @@ Trade::MeshData generateIndices(Trade::MeshData&& mesh) {
} else CORRADE_INTERNAL_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */ } else CORRADE_INTERNAL_ASSERT_UNREACHABLE(); /* LCOV_EXCL_LINE */
Trade::MeshIndexData indices{MeshIndexType::UnsignedInt, indexData}; Trade::MeshIndexData indices{MeshIndexType::UnsignedInt, indexData};
return Trade::MeshData{primitive, std::move(indexData), indices, return Trade::MeshData{primitive, Utility::move(indexData), indices,
std::move(vertexData), std::move(attributeData), vertexCount}; Utility::move(vertexData), Utility::move(attributeData), vertexCount};
} }
Trade::MeshData generateIndices(const Trade::MeshData& mesh) { Trade::MeshData generateIndices(const Trade::MeshData& mesh) {

2
src/Magnum/MeshTools/GenerateLines.cpp

@ -267,7 +267,7 @@ Trade::MeshData generateLines(const Trade::MeshData& lineMesh) {
Trade::MeshIndexData indices{indexData}; Trade::MeshIndexData indices{indexData};
return Trade::MeshData{mesh.primitive(), return Trade::MeshData{mesh.primitive(),
indexData ? Containers::arrayAllocatorCast<char>(std::move(indexData)) : Containers::Array<char>{}, indices, indexData ? Containers::arrayAllocatorCast<char>(Utility::move(indexData)) : Containers::Array<char>{}, indices,
mesh.releaseVertexData(), mesh.releaseAttributeData()}; mesh.releaseVertexData(), mesh.releaseAttributeData()};
} }

2
src/Magnum/MeshTools/GenerateNormals.cpp

@ -85,7 +85,7 @@ std::pair<std::vector<UnsignedInt>, std::vector<Vector3>> generateFlatNormals(co
CORRADE_IGNORE_DEPRECATED_PUSH CORRADE_IGNORE_DEPRECATED_PUSH
normalIndices = duplicate(normalIndices, removeDuplicates(normals)); normalIndices = duplicate(normalIndices, removeDuplicates(normals));
CORRADE_IGNORE_DEPRECATED_POP CORRADE_IGNORE_DEPRECATED_POP
return {std::move(normalIndices), std::move(normals)}; return {Utility::move(normalIndices), Utility::move(normals)};
} }
#endif #endif

21
src/Magnum/MeshTools/Interleave.cpp

@ -174,7 +174,7 @@ Containers::Array<Trade::MeshAttributeData> interleavedLayout(Trade::MeshData&&
mesh.releaseAttributeData(); mesh.releaseAttributeData();
Containers::Array<Trade::MeshAttributeData> attributeData; Containers::Array<Trade::MeshAttributeData> attributeData;
if(!extraAttributeCount && !originalAttributeData.deleter()) if(!extraAttributeCount && !originalAttributeData.deleter())
attributeData = std::move(originalAttributeData); attributeData = Utility::move(originalAttributeData);
else { else {
attributeData = Containers::Array<Trade::MeshAttributeData>{originalAttributeCount + extraAttributeCount}; attributeData = Containers::Array<Trade::MeshAttributeData>{originalAttributeCount + extraAttributeCount};
Utility::copy(originalAttributeData, attributeData.prefix(originalAttributeCount)); Utility::copy(originalAttributeData, attributeData.prefix(originalAttributeCount));
@ -223,7 +223,7 @@ Containers::Array<Trade::MeshAttributeData> interleavedLayout(Trade::MeshData&&
} }
Trade::MeshData interleavedLayout(Trade::MeshData&& mesh, const UnsignedInt vertexCount, const Containers::ArrayView<const Trade::MeshAttributeData> extra, const InterleaveFlags flags) { Trade::MeshData interleavedLayout(Trade::MeshData&& mesh, const UnsignedInt vertexCount, const Containers::ArrayView<const Trade::MeshAttributeData> extra, const InterleaveFlags flags) {
Containers::Array<Trade::MeshAttributeData> attributeData = Implementation::interleavedLayout(std::move(mesh), extra, flags); Containers::Array<Trade::MeshAttributeData> attributeData = Implementation::interleavedLayout(Utility::move(mesh), extra, flags);
/* If there are no attributes, bail -- return an empty mesh with desired /* If there are no attributes, bail -- return an empty mesh with desired
vertex count but nothing else */ vertex count but nothing else */
@ -240,11 +240,11 @@ Trade::MeshData interleavedLayout(Trade::MeshData&& mesh, const UnsignedInt vert
attribute = Implementation::remapAttributeData(attribute, vertexCount, vertexData, vertexData); attribute = Implementation::remapAttributeData(attribute, vertexCount, vertexData, vertexData);
} }
return Trade::MeshData{mesh.primitive(), std::move(vertexData), std::move(attributeData)}; return Trade::MeshData{mesh.primitive(), Utility::move(vertexData), Utility::move(attributeData)};
} }
Trade::MeshData interleavedLayout(Trade::MeshData&& mesh, const UnsignedInt vertexCount, const std::initializer_list<Trade::MeshAttributeData> extra, const InterleaveFlags flags) { Trade::MeshData interleavedLayout(Trade::MeshData&& mesh, const UnsignedInt vertexCount, const std::initializer_list<Trade::MeshAttributeData> extra, const InterleaveFlags flags) {
return interleavedLayout(std::move(mesh), vertexCount, Containers::arrayView(extra), flags); return interleavedLayout(Utility::move(mesh), vertexCount, Containers::arrayView(extra), flags);
} }
Trade::MeshData interleavedLayout(const Trade::MeshData& mesh, const UnsignedInt vertexCount, const Containers::ArrayView<const Trade::MeshAttributeData> extra, const InterleaveFlags flags) { Trade::MeshData interleavedLayout(const Trade::MeshData& mesh, const UnsignedInt vertexCount, const Containers::ArrayView<const Trade::MeshAttributeData> extra, const InterleaveFlags flags) {
@ -321,8 +321,9 @@ Trade::MeshData interleave(Trade::MeshData&& mesh, const Containers::ArrayView<c
/* Otherwise do it the hard way */ /* Otherwise do it the hard way */
} else { } else {
/* Calculate the layout. Can't std::move() the data in to avoid copying /* Calculate the layout. Can't Utility::move() the data in to avoid
the attribute array as we need the original attributes below. */ copying the attribute array as we need the original attributes
below. */
Trade::MeshData layout = interleavedLayout(mesh, vertexCount, extra, flags); Trade::MeshData layout = interleavedLayout(mesh, vertexCount, extra, flags);
#ifdef CORRADE_GRACEFUL_ASSERT #ifdef CORRADE_GRACEFUL_ASSERT
/* If interleavedLayout() gracefully asserted and returned no /* If interleavedLayout() gracefully asserted and returned no
@ -367,12 +368,12 @@ Trade::MeshData interleave(Trade::MeshData&& mesh, const Containers::ArrayView<c
attributeData = layout.releaseAttributeData(); attributeData = layout.releaseAttributeData();
} }
return Trade::MeshData{mesh.primitive(), std::move(indexData), indices, return Trade::MeshData{mesh.primitive(), Utility::move(indexData), indices,
std::move(vertexData), std::move(attributeData), vertexCount}; Utility::move(vertexData), Utility::move(attributeData), vertexCount};
} }
Trade::MeshData interleave(Trade::MeshData&& mesh, const std::initializer_list<Trade::MeshAttributeData> extra, const InterleaveFlags flags) { Trade::MeshData interleave(Trade::MeshData&& mesh, const std::initializer_list<Trade::MeshAttributeData> extra, const InterleaveFlags flags) {
return interleave(std::move(mesh), Containers::arrayView(extra), flags); return interleave(Utility::move(mesh), Containers::arrayView(extra), flags);
} }
Trade::MeshData interleave(const Trade::MeshData& mesh, const Containers::ArrayView<const Trade::MeshAttributeData> extra, const InterleaveFlags flags) { Trade::MeshData interleave(const Trade::MeshData& mesh, const Containers::ArrayView<const Trade::MeshAttributeData> extra, const InterleaveFlags flags) {
@ -382,7 +383,7 @@ Trade::MeshData interleave(const Trade::MeshData& mesh, const Containers::ArrayV
} }
Trade::MeshData interleave(const Trade::MeshData& mesh, const std::initializer_list<Trade::MeshAttributeData> extra, const InterleaveFlags flags) { Trade::MeshData interleave(const Trade::MeshData& mesh, const std::initializer_list<Trade::MeshAttributeData> extra, const InterleaveFlags flags) {
return interleave(std::move(mesh), Containers::arrayView(extra), flags); return interleave(Utility::move(mesh), Containers::arrayView(extra), flags);
} }
}} }}

12
src/Magnum/MeshTools/RemoveDuplicates.cpp

@ -102,7 +102,7 @@ std::size_t removeDuplicatesInto(const Containers::StridedArrayView2D<const char
Containers::Pair<Containers::Array<UnsignedInt>, std::size_t> removeDuplicates(const Containers::StridedArrayView2D<const char>& data) { Containers::Pair<Containers::Array<UnsignedInt>, std::size_t> removeDuplicates(const Containers::StridedArrayView2D<const char>& data) {
Containers::Array<UnsignedInt> indices{NoInit, data.size()[0]}; Containers::Array<UnsignedInt> indices{NoInit, data.size()[0]};
const std::size_t size = removeDuplicatesInto(data, indices); const std::size_t size = removeDuplicatesInto(data, indices);
return {std::move(indices), size}; return {Utility::move(indices), size};
} }
std::size_t removeDuplicatesInPlaceInto(const Containers::StridedArrayView2D<char>& data, const Containers::StridedArrayView1D<UnsignedInt>& indices) { std::size_t removeDuplicatesInPlaceInto(const Containers::StridedArrayView2D<char>& data, const Containers::StridedArrayView1D<UnsignedInt>& indices) {
@ -160,7 +160,7 @@ std::size_t removeDuplicatesInPlaceInto(const Containers::StridedArrayView2D<cha
Containers::Pair<Containers::Array<UnsignedInt>, std::size_t> removeDuplicatesInPlace(const Containers::StridedArrayView2D<char>& data) { Containers::Pair<Containers::Array<UnsignedInt>, std::size_t> removeDuplicatesInPlace(const Containers::StridedArrayView2D<char>& data) {
Containers::Array<UnsignedInt> indices{NoInit, data.size()[0]}; Containers::Array<UnsignedInt> indices{NoInit, data.size()[0]};
const std::size_t size = removeDuplicatesInPlaceInto(data, indices); const std::size_t size = removeDuplicatesInPlaceInto(data, indices);
return {std::move(indices), size}; return {Utility::move(indices), size};
} }
namespace { namespace {
@ -353,7 +353,7 @@ template<class T> std::size_t removeDuplicatesFuzzyInPlaceIntoImplementation(con
template<class T> Containers::Pair<Containers::Array<UnsignedInt>, std::size_t> removeDuplicatesFuzzyInPlaceImplementation(const Containers::StridedArrayView2D<T>& data, const T epsilon) { template<class T> Containers::Pair<Containers::Array<UnsignedInt>, std::size_t> removeDuplicatesFuzzyInPlaceImplementation(const Containers::StridedArrayView2D<T>& data, const T epsilon) {
Containers::Array<UnsignedInt> indices{NoInit, data.size()[0]}; Containers::Array<UnsignedInt> indices{NoInit, data.size()[0]};
const std::size_t size = removeDuplicatesFuzzyInPlaceIntoImplementation(data, indices, epsilon); const std::size_t size = removeDuplicatesFuzzyInPlaceIntoImplementation(data, indices, epsilon);
return {std::move(indices), size}; return {Utility::move(indices), size};
} }
} }
@ -461,8 +461,8 @@ Trade::MeshData removeDuplicates(const Trade::MeshData& mesh) {
Trade::MeshIndexData indices{indexType, indexData}; Trade::MeshIndexData indices{indexType, indexData};
return Trade::MeshData{ownedInterleaved.primitive(), return Trade::MeshData{ownedInterleaved.primitive(),
std::move(indexData), indices, Utility::move(indexData), indices,
std::move(uniqueVertexData), std::move(attributeData), Utility::move(uniqueVertexData), Utility::move(attributeData),
uniqueVertexCount}; uniqueVertexCount};
} }
@ -586,7 +586,7 @@ Trade::MeshData removeDuplicatesFuzzy(const Trade::MeshData& mesh, const Float f
Trade::MeshData layout = interleavedLayout(owned, vertexCount); Trade::MeshData layout = interleavedLayout(owned, vertexCount);
Trade::MeshIndexData indices{indexType, indexData}; Trade::MeshIndexData indices{indexType, indexData};
Trade::MeshData out{layout.primitive(), Trade::MeshData out{layout.primitive(),
std::move(indexData), indices, Utility::move(indexData), indices,
layout.releaseVertexData(), layout.releaseAttributeData(), vertexCount}; layout.releaseVertexData(), layout.releaseAttributeData(), vertexCount};
/* Trim the views to only the unique combinations, duplicate the attributes /* Trim the views to only the unique combinations, duplicate the attributes

18
src/Magnum/MeshTools/Test/CompileGLTest.cpp

@ -679,7 +679,7 @@ template<class T> void CompileGLTest::twoDimensions() {
Trade::MeshData meshData{MeshPrimitive::Triangles, Trade::MeshData meshData{MeshPrimitive::Triangles,
{}, indexData, indices, {}, indexData, indices,
{}, vertexData, std::move(attributeData)}; {}, vertexData, Utility::move(attributeData)};
/* Duplicate everything if data is non-indexed */ /* Duplicate everything if data is non-indexed */
if(data.flags & Flag::NonIndexed) { if(data.flags & Flag::NonIndexed) {
@ -698,7 +698,7 @@ template<class T> void CompileGLTest::twoDimensions() {
#ifdef MAGNUM_BUILD_DEPRECATED #ifdef MAGNUM_BUILD_DEPRECATED
CORRADE_IGNORE_DEPRECATED_PUSH /** @todo remove once MeshDataXD is gone */ CORRADE_IGNORE_DEPRECATED_PUSH /** @todo remove once MeshDataXD is gone */
#endif #endif
GL::Mesh mesh = compile(T{std::move(meshData)}); GL::Mesh mesh = compile(T{Utility::move(meshData)});
#ifdef MAGNUM_BUILD_DEPRECATED #ifdef MAGNUM_BUILD_DEPRECATED
CORRADE_IGNORE_DEPRECATED_POP CORRADE_IGNORE_DEPRECATED_POP
#endif #endif
@ -900,7 +900,7 @@ template<class T> void CompileGLTest::threeDimensions() {
Trade::MeshData meshData{MeshPrimitive::Triangles, Trade::MeshData meshData{MeshPrimitive::Triangles,
{}, indexData, indices, {}, indexData, indices,
{}, vertexData, std::move(attributeData)}; {}, vertexData, Utility::move(attributeData)};
/* Duplicate everything if data is non-indexed */ /* Duplicate everything if data is non-indexed */
if(data.flags & Flag::NonIndexed) { if(data.flags & Flag::NonIndexed) {
@ -924,7 +924,7 @@ template<class T> void CompileGLTest::threeDimensions() {
#ifdef MAGNUM_BUILD_DEPRECATED #ifdef MAGNUM_BUILD_DEPRECATED
CORRADE_IGNORE_DEPRECATED_PUSH /** @todo remove once MeshDataXD is gone */ CORRADE_IGNORE_DEPRECATED_PUSH /** @todo remove once MeshDataXD is gone */
#endif #endif
GL::Mesh mesh = compile(T{std::move(meshData)}, flags); GL::Mesh mesh = compile(T{Utility::move(meshData)}, flags);
#ifdef MAGNUM_BUILD_DEPRECATED #ifdef MAGNUM_BUILD_DEPRECATED
CORRADE_IGNORE_DEPRECATED_POP CORRADE_IGNORE_DEPRECATED_POP
#endif #endif
@ -1343,7 +1343,7 @@ void CompileGLTest::skinning() {
vertices.slice(&Vertex::position)); vertices.slice(&Vertex::position));
arrayAppend(attributeData, data.attributes); arrayAppend(attributeData, data.attributes);
Trade::MeshData meshData{MeshPrimitive::TriangleStrip, {}, vertexData, std::move(attributeData)}; Trade::MeshData meshData{MeshPrimitive::TriangleStrip, {}, vertexData, Utility::move(attributeData)};
Containers::Pair<UnsignedInt, UnsignedInt> jointCount = compiledPerVertexJointCount(meshData); Containers::Pair<UnsignedInt, UnsignedInt> jointCount = compiledPerVertexJointCount(meshData);
CORRADE_COMPARE(jointCount.first(), data.expectedJointCount); CORRADE_COMPARE(jointCount.first(), data.expectedJointCount);
@ -1490,7 +1490,7 @@ void CompileGLTest::conflictingAttributes() {
Trade::MeshData meshData{MeshPrimitive::Triangles, Trade::MeshData meshData{MeshPrimitive::Triangles,
{}, indexData, Trade::MeshIndexData{indexData}, {}, indexData, Trade::MeshIndexData{indexData},
{}, vertexData, std::move(attributeData)}; {}, vertexData, Utility::move(attributeData)};
GL::Mesh mesh{NoCreate}; GL::Mesh mesh{NoCreate};
@ -1774,11 +1774,11 @@ void CompileGLTest::externalBuffers() {
GL::Mesh mesh{NoCreate}; GL::Mesh mesh{NoCreate};
if(data.moveIndices && data.moveVertices) if(data.moveIndices && data.moveVertices)
mesh = compile(meshData, std::move(indices), std::move(vertices)); mesh = compile(meshData, Utility::move(indices), Utility::move(vertices));
else if(data.moveIndices && !data.moveVertices) else if(data.moveIndices && !data.moveVertices)
mesh = compile(meshData, std::move(indices), vertices); mesh = compile(meshData, Utility::move(indices), vertices);
else if(!data.moveIndices && data.moveVertices) else if(!data.moveIndices && data.moveVertices)
mesh = compile(meshData, indices, std::move(vertices)); mesh = compile(meshData, indices, Utility::move(vertices));
else else
mesh = compile(meshData, indices, vertices); mesh = compile(meshData, indices, vertices);

2
src/Magnum/MeshTools/Test/CompileLinesGLTest.cpp

@ -171,7 +171,7 @@ void CompileLinesGLTest::twoDimensions() {
if(data.colors) if(data.colors)
arrayAppend(attributes, InPlaceInit, Trade::MeshAttribute::Color, vertices.slice(&Vertex::color)); arrayAppend(attributes, InPlaceInit, Trade::MeshAttribute::Color, vertices.slice(&Vertex::color));
GL::Mesh mesh = compileLines(generateLines(Trade::MeshData{MeshPrimitive::LineLoop, {}, vertexData, std::move(attributes)})); GL::Mesh mesh = compileLines(generateLines(Trade::MeshData{MeshPrimitive::LineLoop, {}, vertexData, Utility::move(attributes)}));
Shaders::LineGL2D shader{Shaders::LineGL2D::Configuration{} Shaders::LineGL2D shader{Shaders::LineGL2D::Configuration{}
.setFlags(data.colors ? Shaders::LineGL2D::Flag::VertexColor : Shaders::LineGL2D::Flags{}) .setFlags(data.colors ? Shaders::LineGL2D::Flag::VertexColor : Shaders::LineGL2D::Flags{})

8
src/Magnum/MeshTools/Test/CompressIndicesTest.cpp

@ -318,7 +318,7 @@ void CompressIndicesTest::compressMeshDataMove() {
UnsignedInt indices[] = {102, 101, 100, 101, 102}; UnsignedInt indices[] = {102, 101, 100, 101, 102};
Trade::MeshData data{MeshPrimitive::TriangleFan, Trade::MeshData data{MeshPrimitive::TriangleFan,
{}, indices, Trade::MeshIndexData{indices}, {}, indices, Trade::MeshIndexData{indices},
std::move(vertexData), { Utility::move(vertexData), {
Trade::MeshAttributeData{Trade::MeshAttribute::Position, positionView}, Trade::MeshAttributeData{Trade::MeshAttribute::Position, positionView},
Trade::MeshAttributeData{Trade::MeshAttribute::Normal, normalView} Trade::MeshAttributeData{Trade::MeshAttribute::Normal, normalView}
}}; }};
@ -326,7 +326,7 @@ void CompressIndicesTest::compressMeshDataMove() {
CORRADE_COMPARE(data.attributeOffset(0), 0); CORRADE_COMPARE(data.attributeOffset(0), 0);
CORRADE_COMPARE(data.attributeOffset(1), 103*sizeof(Vector2)); CORRADE_COMPARE(data.attributeOffset(1), 103*sizeof(Vector2));
Trade::MeshData compressed = compressIndices(std::move(data)); Trade::MeshData compressed = compressIndices(Utility::move(data));
CORRADE_COMPARE(compressed.indexCount(), 5); CORRADE_COMPARE(compressed.indexCount(), 5);
CORRADE_COMPARE(compressed.indexType(), MeshIndexType::UnsignedShort); CORRADE_COMPARE(compressed.indexType(), MeshIndexType::UnsignedShort);
CORRADE_COMPARE_AS(compressed.indices<UnsignedShort>(), CORRADE_COMPARE_AS(compressed.indices<UnsignedShort>(),
@ -348,7 +348,7 @@ void CompressIndicesTest::compressMeshDataNonIndexed() {
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
compressIndices(mesh); compressIndices(mesh);
compressIndices(std::move(mesh)); compressIndices(Utility::move(mesh));
CORRADE_COMPARE(out.str(), CORRADE_COMPARE(out.str(),
"MeshTools::compressIndices(): mesh data not indexed\n" "MeshTools::compressIndices(): mesh data not indexed\n"
"MeshTools::compressIndices(): mesh data not indexed\n"); "MeshTools::compressIndices(): mesh data not indexed\n");
@ -364,7 +364,7 @@ void CompressIndicesTest::compressMeshDataImplementationSpecificIndexType() {
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
compressIndices(mesh); compressIndices(mesh);
compressIndices(std::move(mesh)); compressIndices(Utility::move(mesh));
CORRADE_COMPARE(out.str(), CORRADE_COMPARE(out.str(),
"MeshTools::compressIndices(): mesh has an implementation-specific index type 0xcaca\n" "MeshTools::compressIndices(): mesh has an implementation-specific index type 0xcaca\n"
"MeshTools::compressIndices(): mesh has an implementation-specific index type 0xcaca\n"); "MeshTools::compressIndices(): mesh has an implementation-specific index type 0xcaca\n");

10
src/Magnum/MeshTools/Test/ConcatenateTest.cpp

@ -485,8 +485,8 @@ void ConcatenateTest::concatenateInto() {
VertexFormat::Vector3, nullptr}; VertexFormat::Vector3, nullptr};
Trade::MeshIndexData indices{MeshIndexType::UnsignedInt, indexData}; Trade::MeshIndexData indices{MeshIndexType::UnsignedInt, indexData};
Trade::MeshData dst{MeshPrimitive::Triangles, Trade::MeshData dst{MeshPrimitive::Triangles,
std::move(indexData), indices, Utility::move(indexData), indices,
std::move(vertexData), std::move(attributeData)}; Utility::move(vertexData), Utility::move(attributeData)};
const Vector2 positionsA[]{ const Vector2 positionsA[]{
{-1.0f, -1.0f}, {-1.0f, -1.0f},
@ -562,8 +562,8 @@ void ConcatenateTest::concatenateIntoNoIndexArray() {
VertexFormat::Vector2, nullptr}; VertexFormat::Vector2, nullptr};
Trade::MeshIndexData indices{MeshIndexType::UnsignedInt, indexData}; Trade::MeshIndexData indices{MeshIndexType::UnsignedInt, indexData};
Trade::MeshData dst{MeshPrimitive::Triangles, Trade::MeshData dst{MeshPrimitive::Triangles,
std::move(indexData), indices, Utility::move(indexData), indices,
std::move(vertexData), std::move(attributeData)}; Utility::move(vertexData), Utility::move(attributeData)};
CORRADE_VERIFY(dst.isIndexed()); CORRADE_VERIFY(dst.isIndexed());
const Vector2 positions[]{ const Vector2 positions[]{
@ -605,7 +605,7 @@ void ConcatenateTest::concatenateIntoNonOwnedAttributeArray() {
VertexFormat::Vector2, nullptr} VertexFormat::Vector2, nullptr}
}; };
Trade::MeshData dst{MeshPrimitive::Triangles, Trade::MeshData dst{MeshPrimitive::Triangles,
std::move(vertexData), Trade::meshAttributeDataNonOwningArray(attributeData)}; Utility::move(vertexData), Trade::meshAttributeDataNonOwningArray(attributeData)};
const Vector2 positions[]{ const Vector2 positions[]{
{-1.0f, -1.0f}, {-1.0f, -1.0f},

6
src/Magnum/MeshTools/Test/CopyTest.cpp

@ -317,8 +317,8 @@ void CopyTest::copyRvalueIndicesVerticesAttributesOwned() {
const Trade::MeshAttributeData* originalAttributes = attributes; const Trade::MeshAttributeData* originalAttributes = attributes;
Trade::MeshData copy = MeshTools::copy(Trade::MeshData{MeshPrimitive::Triangles, Trade::MeshData copy = MeshTools::copy(Trade::MeshData{MeshPrimitive::Triangles,
std::move(indexData), Trade::MeshIndexData{indices}, Utility::move(indexData), Trade::MeshIndexData{indices},
std::move(vertexData), std::move(attributes)}); Utility::move(vertexData), Utility::move(attributes)});
CORRADE_VERIFY(copy.isIndexed()); CORRADE_VERIFY(copy.isIndexed());
CORRADE_COMPARE(copy.primitive(), MeshPrimitive::Triangles); CORRADE_COMPARE(copy.primitive(), MeshPrimitive::Triangles);
CORRADE_COMPARE(copy.indexDataFlags(), Trade::DataFlag::Mutable|Trade::DataFlag::Owned); CORRADE_COMPARE(copy.indexDataFlags(), Trade::DataFlag::Mutable|Trade::DataFlag::Owned);
@ -354,7 +354,7 @@ void CopyTest::copyRvalueAttributesOwned() {
Containers::arrayView(positions)}; Containers::arrayView(positions)};
const Trade::MeshAttributeData* originalAttributes = attributes; const Trade::MeshAttributeData* originalAttributes = attributes;
Trade::MeshData copy = MeshTools::copy(Trade::MeshData{MeshPrimitive::Triangles, {}, positions, std::move(attributes)}); Trade::MeshData copy = MeshTools::copy(Trade::MeshData{MeshPrimitive::Triangles, {}, positions, Utility::move(attributes)});
CORRADE_COMPARE(copy.primitive(), MeshPrimitive::Triangles); CORRADE_COMPARE(copy.primitive(), MeshPrimitive::Triangles);
CORRADE_COMPARE(copy.vertexDataFlags(), Trade::DataFlag::Mutable|Trade::DataFlag::Owned); CORRADE_COMPARE(copy.vertexDataFlags(), Trade::DataFlag::Mutable|Trade::DataFlag::Owned);
CORRADE_COMPARE(copy.vertexDataFlags(), Trade::DataFlag::Mutable|Trade::DataFlag::Owned); CORRADE_COMPARE(copy.vertexDataFlags(), Trade::DataFlag::Mutable|Trade::DataFlag::Owned);

38
src/Magnum/MeshTools/Test/FilterTest.cpp

@ -132,8 +132,8 @@ void FilterTest::attributes() {
Containers::StridedArrayView1D<Vertex> vertices = Containers::arrayCast<Vertex>(vertexData); Containers::StridedArrayView1D<Vertex> vertices = Containers::arrayCast<Vertex>(vertexData);
Trade::MeshData mesh{MeshPrimitive::TriangleStrip, Trade::MeshData mesh{MeshPrimitive::TriangleStrip,
std::move(indexData), Trade::MeshIndexData{data.indexType, indices}, Utility::move(indexData), Trade::MeshIndexData{data.indexType, indices},
std::move(vertexData), { Utility::move(vertexData), {
Trade::MeshAttributeData{Trade::MeshAttribute::Position, vertices.slice(&Vertex::position)}, Trade::MeshAttributeData{Trade::MeshAttribute::Position, vertices.slice(&Vertex::position)},
Trade::MeshAttributeData{Trade::MeshAttribute::Tangent, vertices.slice(&Vertex::tangent)}, Trade::MeshAttributeData{Trade::MeshAttribute::Tangent, vertices.slice(&Vertex::tangent)},
Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, vertices.slice(&Vertex::textureCoordinates1)}, Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, vertices.slice(&Vertex::textureCoordinates1)},
@ -179,7 +179,7 @@ void FilterTest::attributesNoIndexData() {
Containers::StridedArrayView1D<Vertex> vertices = Containers::arrayCast<Vertex>(vertexData); Containers::StridedArrayView1D<Vertex> vertices = Containers::arrayCast<Vertex>(vertexData);
Trade::MeshData mesh{MeshPrimitive::TriangleFan, Trade::MeshData mesh{MeshPrimitive::TriangleFan,
std::move(vertexData), { Utility::move(vertexData), {
Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, vertices.slice(&Vertex::textureCoordinates1)} Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, vertices.slice(&Vertex::textureCoordinates1)}
}}; }};
@ -229,8 +229,8 @@ void FilterTest::onlyAttributes() {
Containers::StridedArrayView1D<Vertex> vertices = Containers::arrayCast<Vertex>(vertexData); Containers::StridedArrayView1D<Vertex> vertices = Containers::arrayCast<Vertex>(vertexData);
Trade::MeshData mesh{MeshPrimitive::TriangleStrip, Trade::MeshData mesh{MeshPrimitive::TriangleStrip,
std::move(indexData), Trade::MeshIndexData{data.indexType, indices}, Utility::move(indexData), Trade::MeshIndexData{data.indexType, indices},
std::move(vertexData), { Utility::move(vertexData), {
Trade::MeshAttributeData{Trade::MeshAttribute::Position, vertices.slice(&Vertex::position)}, Trade::MeshAttributeData{Trade::MeshAttribute::Position, vertices.slice(&Vertex::position)},
Trade::MeshAttributeData{Trade::MeshAttribute::Tangent, vertices.slice(&Vertex::tangent)}, Trade::MeshAttributeData{Trade::MeshAttribute::Tangent, vertices.slice(&Vertex::tangent)},
Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, vertices.slice(&Vertex::textureCoordinates1)}, Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, vertices.slice(&Vertex::textureCoordinates1)},
@ -281,7 +281,7 @@ void FilterTest::onlyAttributesNoIndexData() {
Containers::StridedArrayView1D<Vertex> vertices = Containers::arrayCast<Vertex>(vertexData); Containers::StridedArrayView1D<Vertex> vertices = Containers::arrayCast<Vertex>(vertexData);
Trade::MeshData mesh{MeshPrimitive::TriangleFan, Trade::MeshData mesh{MeshPrimitive::TriangleFan,
std::move(vertexData), { Utility::move(vertexData), {
Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, vertices.slice(&Vertex::textureCoordinates1)} Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, vertices.slice(&Vertex::textureCoordinates1)}
}}; }};
@ -310,7 +310,7 @@ void FilterTest::onlyAttributesNoAttributeData() {
Containers::StridedArrayView1D<UnsignedShort> indices = Containers::arrayCast<UnsignedShort>(indexData); Containers::StridedArrayView1D<UnsignedShort> indices = Containers::arrayCast<UnsignedShort>(indexData);
Trade::MeshData mesh{MeshPrimitive::Points, Trade::MeshData mesh{MeshPrimitive::Points,
std::move(indexData), Trade::MeshIndexData{indices}, 15}; Utility::move(indexData), Trade::MeshIndexData{indices}, 15};
Trade::MeshData filtered = filterOnlyAttributes(mesh, { Trade::MeshData filtered = filterOnlyAttributes(mesh, {
Trade::MeshAttribute::Position Trade::MeshAttribute::Position
@ -342,8 +342,8 @@ void FilterTest::onlyAttributeIds() {
Containers::StridedArrayView1D<Vertex> vertices = Containers::arrayCast<Vertex>(vertexData); Containers::StridedArrayView1D<Vertex> vertices = Containers::arrayCast<Vertex>(vertexData);
Trade::MeshData mesh{MeshPrimitive::TriangleStrip, Trade::MeshData mesh{MeshPrimitive::TriangleStrip,
std::move(indexData), Trade::MeshIndexData{data.indexType, indices}, Utility::move(indexData), Trade::MeshIndexData{data.indexType, indices},
std::move(vertexData), { Utility::move(vertexData), {
Trade::MeshAttributeData{Trade::MeshAttribute::Position, vertices.slice(&Vertex::position)}, Trade::MeshAttributeData{Trade::MeshAttribute::Position, vertices.slice(&Vertex::position)},
Trade::MeshAttributeData{Trade::MeshAttribute::Tangent, vertices.slice(&Vertex::tangent)}, Trade::MeshAttributeData{Trade::MeshAttribute::Tangent, vertices.slice(&Vertex::tangent)},
Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, vertices.slice(&Vertex::textureCoordinates1)}, Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, vertices.slice(&Vertex::textureCoordinates1)},
@ -411,7 +411,7 @@ void FilterTest::onlyAttributeIdsNoIndexData() {
Containers::StridedArrayView1D<Vertex> vertices = Containers::arrayCast<Vertex>(vertexData); Containers::StridedArrayView1D<Vertex> vertices = Containers::arrayCast<Vertex>(vertexData);
Trade::MeshData mesh{MeshPrimitive::TriangleFan, Trade::MeshData mesh{MeshPrimitive::TriangleFan,
std::move(vertexData), { Utility::move(vertexData), {
Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, vertices.slice(&Vertex::textureCoordinates1)} Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, vertices.slice(&Vertex::textureCoordinates1)}
}}; }};
@ -442,7 +442,7 @@ void FilterTest::onlyAttributeIdsNoAttributeData() {
Containers::StridedArrayView1D<UnsignedShort> indices = Containers::arrayCast<UnsignedShort>(indexData); Containers::StridedArrayView1D<UnsignedShort> indices = Containers::arrayCast<UnsignedShort>(indexData);
Trade::MeshData mesh{MeshPrimitive::Points, Trade::MeshData mesh{MeshPrimitive::Points,
std::move(indexData), Trade::MeshIndexData{indices}, 15}; Utility::move(indexData), Trade::MeshIndexData{indices}, 15};
CORRADE_IGNORE_DEPRECATED_PUSH CORRADE_IGNORE_DEPRECATED_PUSH
Trade::MeshData filtered = filterOnlyAttributes(mesh, std::initializer_list<UnsignedInt>{}); Trade::MeshData filtered = filterOnlyAttributes(mesh, std::initializer_list<UnsignedInt>{});
@ -474,8 +474,8 @@ void FilterTest::exceptAttributes() {
Containers::StridedArrayView1D<Vertex> vertices = Containers::arrayCast<Vertex>(vertexData); Containers::StridedArrayView1D<Vertex> vertices = Containers::arrayCast<Vertex>(vertexData);
Trade::MeshData mesh{MeshPrimitive::TriangleStrip, Trade::MeshData mesh{MeshPrimitive::TriangleStrip,
std::move(indexData), Trade::MeshIndexData{data.indexType, indices}, Utility::move(indexData), Trade::MeshIndexData{data.indexType, indices},
std::move(vertexData), { Utility::move(vertexData), {
Trade::MeshAttributeData{Trade::MeshAttribute::Position, vertices.slice(&Vertex::position)}, Trade::MeshAttributeData{Trade::MeshAttribute::Position, vertices.slice(&Vertex::position)},
Trade::MeshAttributeData{Trade::MeshAttribute::Tangent, vertices.slice(&Vertex::tangent)}, Trade::MeshAttributeData{Trade::MeshAttribute::Tangent, vertices.slice(&Vertex::tangent)},
Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, vertices.slice(&Vertex::textureCoordinates1)}, Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, vertices.slice(&Vertex::textureCoordinates1)},
@ -524,7 +524,7 @@ void FilterTest::exceptAttributesNoIndexData() {
Containers::StridedArrayView1D<Vertex> vertices = Containers::arrayCast<Vertex>(vertexData); Containers::StridedArrayView1D<Vertex> vertices = Containers::arrayCast<Vertex>(vertexData);
Trade::MeshData mesh{MeshPrimitive::TriangleFan, Trade::MeshData mesh{MeshPrimitive::TriangleFan,
std::move(vertexData), { Utility::move(vertexData), {
Trade::MeshAttributeData{Trade::MeshAttribute::Position, vertices.slice(&Vertex::position)}, Trade::MeshAttributeData{Trade::MeshAttribute::Position, vertices.slice(&Vertex::position)},
Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, vertices.slice(&Vertex::textureCoordinates1)} Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, vertices.slice(&Vertex::textureCoordinates1)}
}}; }};
@ -554,7 +554,7 @@ void FilterTest::exceptAttributesNoAttributeData() {
Containers::StridedArrayView1D<UnsignedShort> indices = Containers::arrayCast<UnsignedShort>(indexData); Containers::StridedArrayView1D<UnsignedShort> indices = Containers::arrayCast<UnsignedShort>(indexData);
Trade::MeshData mesh{MeshPrimitive::Points, Trade::MeshData mesh{MeshPrimitive::Points,
std::move(indexData), Trade::MeshIndexData{indices}, 15}; Utility::move(indexData), Trade::MeshIndexData{indices}, 15};
Trade::MeshData filtered = filterExceptAttributes(mesh, { Trade::MeshData filtered = filterExceptAttributes(mesh, {
Trade::MeshAttribute::Position Trade::MeshAttribute::Position
@ -586,8 +586,8 @@ void FilterTest::exceptAttributeIds() {
Containers::StridedArrayView1D<Vertex> vertices = Containers::arrayCast<Vertex>(vertexData); Containers::StridedArrayView1D<Vertex> vertices = Containers::arrayCast<Vertex>(vertexData);
Trade::MeshData mesh{MeshPrimitive::TriangleStrip, Trade::MeshData mesh{MeshPrimitive::TriangleStrip,
std::move(indexData), Trade::MeshIndexData{data.indexType, indices}, Utility::move(indexData), Trade::MeshIndexData{data.indexType, indices},
std::move(vertexData), { Utility::move(vertexData), {
Trade::MeshAttributeData{Trade::MeshAttribute::Position, vertices.slice(&Vertex::position)}, Trade::MeshAttributeData{Trade::MeshAttribute::Position, vertices.slice(&Vertex::position)},
Trade::MeshAttributeData{Trade::MeshAttribute::Tangent, vertices.slice(&Vertex::tangent)}, Trade::MeshAttributeData{Trade::MeshAttribute::Tangent, vertices.slice(&Vertex::tangent)},
Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, vertices.slice(&Vertex::textureCoordinates1)}, Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, vertices.slice(&Vertex::textureCoordinates1)},
@ -655,7 +655,7 @@ void FilterTest::exceptAttributeIdsNoIndexData() {
Containers::StridedArrayView1D<Vertex> vertices = Containers::arrayCast<Vertex>(vertexData); Containers::StridedArrayView1D<Vertex> vertices = Containers::arrayCast<Vertex>(vertexData);
Trade::MeshData mesh{MeshPrimitive::TriangleFan, Trade::MeshData mesh{MeshPrimitive::TriangleFan,
std::move(vertexData), { Utility::move(vertexData), {
Trade::MeshAttributeData{Trade::MeshAttribute::Position, vertices.slice(&Vertex::position)}, Trade::MeshAttributeData{Trade::MeshAttribute::Position, vertices.slice(&Vertex::position)},
Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, vertices.slice(&Vertex::textureCoordinates1)} Trade::MeshAttributeData{Trade::MeshAttribute::TextureCoordinates, vertices.slice(&Vertex::textureCoordinates1)}
}}; }};
@ -687,7 +687,7 @@ void FilterTest::exceptAttributeIdsNoAttributeData() {
Containers::StridedArrayView1D<UnsignedShort> indices = Containers::arrayCast<UnsignedShort>(indexData); Containers::StridedArrayView1D<UnsignedShort> indices = Containers::arrayCast<UnsignedShort>(indexData);
Trade::MeshData mesh{MeshPrimitive::Points, Trade::MeshData mesh{MeshPrimitive::Points,
std::move(indexData), Trade::MeshIndexData{indices}, 15}; Utility::move(indexData), Trade::MeshIndexData{indices}, 15};
CORRADE_IGNORE_DEPRECATED_PUSH CORRADE_IGNORE_DEPRECATED_PUSH
Trade::MeshData filtered = filterExceptAttributes(mesh, std::initializer_list<UnsignedInt>{}); Trade::MeshData filtered = filterExceptAttributes(mesh, std::initializer_list<UnsignedInt>{});

2
src/Magnum/MeshTools/Test/GenerateIndicesTest.cpp

@ -1232,7 +1232,7 @@ void GenerateIndicesTest::generateIndicesMeshDataMove() {
vertices[4].textureCoordinates = {0.6f, 0.4f}; vertices[4].textureCoordinates = {0.6f, 0.4f};
Trade::MeshData out = generateIndices(Trade::MeshData{ Trade::MeshData out = generateIndices(Trade::MeshData{
MeshPrimitive::TriangleFan, std::move(vertexData), { MeshPrimitive::TriangleFan, Utility::move(vertexData), {
Trade::MeshAttributeData{Trade::MeshAttribute::Position, Trade::MeshAttributeData{Trade::MeshAttribute::Position,
Containers::stridedArrayView(vertices, Containers::stridedArrayView(vertices,
&vertices[0].position, 5, sizeof(Vertex))}, &vertices[0].position, 5, sizeof(Vertex))},

64
src/Magnum/MeshTools/Test/InterleaveTest.cpp

@ -310,7 +310,7 @@ void InterleaveTest::interleavedData() {
Containers::StridedArrayView1D<Vector3> normals{vertexData, Containers::StridedArrayView1D<Vector3> normals{vertexData,
reinterpret_cast<Vector3*>(vertexData.data() + 100 + 8), 3, 20}; reinterpret_cast<Vector3*>(vertexData.data() + 100 + 8), 3, 20};
Trade::MeshData data{MeshPrimitive::Triangles, std::move(vertexData), { Trade::MeshData data{MeshPrimitive::Triangles, Utility::move(vertexData), {
Trade::MeshAttributeData{Trade::MeshAttribute::Position, positions}, Trade::MeshAttributeData{Trade::MeshAttribute::Position, positions},
Trade::MeshAttributeData{Trade::MeshAttribute::Normal, normals} Trade::MeshAttributeData{Trade::MeshAttribute::Normal, normals}
}}; }};
@ -342,7 +342,7 @@ void InterleaveTest::interleavedDataUnordered() {
Containers::StridedArrayView1D<Vector3> normals{vertexData, Containers::StridedArrayView1D<Vector3> normals{vertexData,
reinterpret_cast<Vector3*>(vertexData.data() + 100 + 8), 3, 20}; reinterpret_cast<Vector3*>(vertexData.data() + 100 + 8), 3, 20};
Trade::MeshData data{MeshPrimitive::Triangles, std::move(vertexData), { Trade::MeshData data{MeshPrimitive::Triangles, Utility::move(vertexData), {
Trade::MeshAttributeData{Trade::MeshAttribute::Normal, normals}, Trade::MeshAttributeData{Trade::MeshAttribute::Normal, normals},
Trade::MeshAttributeData{Trade::MeshAttribute::Position, positions} Trade::MeshAttributeData{Trade::MeshAttribute::Position, positions}
}}; }};
@ -365,7 +365,7 @@ void InterleaveTest::interleavedDataGaps() {
Containers::StridedArrayView1D<Vector3> normals{vertexData, Containers::StridedArrayView1D<Vector3> normals{vertexData,
reinterpret_cast<Vector3*>(vertexData.data() + 100 + 24), 3, 40}; reinterpret_cast<Vector3*>(vertexData.data() + 100 + 24), 3, 40};
Trade::MeshData data{MeshPrimitive::Triangles, std::move(vertexData), { Trade::MeshData data{MeshPrimitive::Triangles, Utility::move(vertexData), {
Trade::MeshAttributeData{Trade::MeshAttribute::Position, positions}, Trade::MeshAttributeData{Trade::MeshAttribute::Position, positions},
Trade::MeshAttributeData{Trade::MeshAttribute::Normal, normals} Trade::MeshAttributeData{Trade::MeshAttribute::Normal, normals}
}}; }};
@ -388,7 +388,7 @@ void InterleaveTest::interleavedDataAliased() {
Containers::StridedArrayView1D<Vector3> normals{vertexData, Containers::StridedArrayView1D<Vector3> normals{vertexData,
reinterpret_cast<Vector3*>(vertexData.data() + 100), 3, 12}; reinterpret_cast<Vector3*>(vertexData.data() + 100), 3, 12};
Trade::MeshData data{MeshPrimitive::Triangles, std::move(vertexData), { Trade::MeshData data{MeshPrimitive::Triangles, Utility::move(vertexData), {
Trade::MeshAttributeData{Trade::MeshAttribute::Position, positions}, Trade::MeshAttributeData{Trade::MeshAttribute::Position, positions},
Trade::MeshAttributeData{Trade::MeshAttribute::Normal, normals} Trade::MeshAttributeData{Trade::MeshAttribute::Normal, normals}
}}; }};
@ -408,7 +408,7 @@ void InterleaveTest::interleavedDataSingleAttribute() {
Containers::Array<char> vertexData{3*8}; Containers::Array<char> vertexData{3*8};
auto positions = Containers::arrayCast<Vector2>(vertexData); auto positions = Containers::arrayCast<Vector2>(vertexData);
Trade::MeshData data{MeshPrimitive::Triangles, std::move(vertexData), { Trade::MeshData data{MeshPrimitive::Triangles, Utility::move(vertexData), {
Trade::MeshAttributeData{Trade::MeshAttribute::Position, positions} Trade::MeshAttributeData{Trade::MeshAttribute::Position, positions}
}}; }};
CORRADE_VERIFY(MeshTools::isInterleaved(data)); CORRADE_VERIFY(MeshTools::isInterleaved(data));
@ -431,7 +431,7 @@ void InterleaveTest::interleavedDataArrayAttributes() {
Containers::StridedArrayView1D<Vector2> positions{vertexData, Containers::StridedArrayView1D<Vector2> positions{vertexData,
reinterpret_cast<Vector2*>(vertexData.data() + 100 + 5), 3, 40}; reinterpret_cast<Vector2*>(vertexData.data() + 100 + 5), 3, 40};
Trade::MeshData data{MeshPrimitive::Triangles, std::move(vertexData), { Trade::MeshData data{MeshPrimitive::Triangles, Utility::move(vertexData), {
Trade::MeshAttributeData{Trade::meshAttributeCustom(42), Trade::MeshAttributeData{Trade::meshAttributeCustom(42),
VertexFormat::Float, normals, 3}, VertexFormat::Float, normals, 3},
Trade::MeshAttributeData{Trade::meshAttributeCustom(43), Trade::MeshAttributeData{Trade::meshAttributeCustom(43),
@ -454,7 +454,7 @@ void InterleaveTest::interleavedDataZeroStride() {
Containers::StridedArrayView1D<Vector3> normals{vertexData, Containers::StridedArrayView1D<Vector3> normals{vertexData,
reinterpret_cast<Vector3*>(vertexData.data() + 100 + 8), 3, 0}; reinterpret_cast<Vector3*>(vertexData.data() + 100 + 8), 3, 0};
Trade::MeshData data{MeshPrimitive::Triangles, std::move(vertexData), { Trade::MeshData data{MeshPrimitive::Triangles, Utility::move(vertexData), {
Trade::MeshAttributeData{Trade::MeshAttribute::Position, positions}, Trade::MeshAttributeData{Trade::MeshAttribute::Position, positions},
Trade::MeshAttributeData{Trade::MeshAttribute::Normal, normals} Trade::MeshAttributeData{Trade::MeshAttribute::Normal, normals}
}}; }};
@ -471,7 +471,7 @@ void InterleaveTest::interleavedDataNegativeStride() {
Containers::StridedArrayView1D<Vector3> normals{vertexData, Containers::StridedArrayView1D<Vector3> normals{vertexData,
reinterpret_cast<Vector3*>(vertexData.data() + 100 + 8), 3, 20}; reinterpret_cast<Vector3*>(vertexData.data() + 100 + 8), 3, 20};
Trade::MeshData data{MeshPrimitive::Triangles, std::move(vertexData), { Trade::MeshData data{MeshPrimitive::Triangles, Utility::move(vertexData), {
Trade::MeshAttributeData{Trade::MeshAttribute::Position, positions.flipped<0>()}, Trade::MeshAttributeData{Trade::MeshAttribute::Position, positions.flipped<0>()},
Trade::MeshAttributeData{Trade::MeshAttribute::Normal, normals.flipped<0>()} Trade::MeshAttributeData{Trade::MeshAttribute::Normal, normals.flipped<0>()}
}}; }};
@ -535,7 +535,7 @@ void InterleaveTest::interleavedDataNotInterleaved() {
auto positions = Containers::arrayCast<Vector2>(vertexData.exceptPrefix(100).prefix(3*8)); auto positions = Containers::arrayCast<Vector2>(vertexData.exceptPrefix(100).prefix(3*8));
auto normals = Containers::arrayCast<Vector3>(vertexData.exceptPrefix(100+3*8)); auto normals = Containers::arrayCast<Vector3>(vertexData.exceptPrefix(100+3*8));
Trade::MeshData data{MeshPrimitive::Triangles, std::move(vertexData), { Trade::MeshData data{MeshPrimitive::Triangles, Utility::move(vertexData), {
Trade::MeshAttributeData{Trade::MeshAttribute::Normal, normals}, Trade::MeshAttributeData{Trade::MeshAttribute::Normal, normals},
Trade::MeshAttributeData{Trade::MeshAttribute::Position, positions} Trade::MeshAttributeData{Trade::MeshAttribute::Position, positions}
}}; }};
@ -703,7 +703,7 @@ void InterleaveTest::interleavedDataImplementationSpecificVertexFormat() {
Containers::StridedArrayView1D<char>{vertexData, Containers::StridedArrayView1D<char>{vertexData,
vertexData.data() + 100 + 8, 3, 8}}; vertexData.data() + 100 + 8, 3, 8}};
Trade::MeshData data{MeshPrimitive::Triangles, std::move(vertexData), {positions, normals}}; Trade::MeshData data{MeshPrimitive::Triangles, Utility::move(vertexData), {positions, normals}};
CORRADE_VERIFY(!MeshTools::isInterleaved(data)); CORRADE_VERIFY(!MeshTools::isInterleaved(data));
} }
@ -747,7 +747,7 @@ void InterleaveTest::interleavedLayout() {
Trade::MeshIndexData indices{Containers::arrayCast<UnsignedShort>(indexData)}; Trade::MeshIndexData indices{Containers::arrayCast<UnsignedShort>(indexData)};
Trade::MeshData data{MeshPrimitive::TriangleFan, Trade::MeshData data{MeshPrimitive::TriangleFan,
std::move(indexData), indices, std::move(vertexData), Utility::move(indexData), indices, Utility::move(vertexData),
/* Verify that interleavedLayout() won't attempt to modify the const /* Verify that interleavedLayout() won't attempt to modify the const
array (see interleavedLayoutRvalue()) */ array (see interleavedLayoutRvalue()) */
Trade::meshAttributeDataNonOwningArray(attributeData)}; Trade::meshAttributeDataNonOwningArray(attributeData)};
@ -811,7 +811,7 @@ void InterleaveTest::interleavedLayoutExtra() {
Containers::arrayCast<Vector3>(vertexData.exceptPrefix(3*8))}; Containers::arrayCast<Vector3>(vertexData.exceptPrefix(3*8))};
Trade::MeshData data{MeshPrimitive::Triangles, Trade::MeshData data{MeshPrimitive::Triangles,
std::move(vertexData), {positions, normals}}; Utility::move(vertexData), {positions, normals}};
CORRADE_VERIFY(!MeshTools::isInterleaved(data)); CORRADE_VERIFY(!MeshTools::isInterleaved(data));
Trade::MeshData layout = MeshTools::interleavedLayout(data, 7, { Trade::MeshData layout = MeshTools::interleavedLayout(data, 7, {
@ -868,7 +868,7 @@ void InterleaveTest::interleavedLayoutExtraAliased() {
Trade::MeshAttributeData positions{Trade::MeshAttribute::Position, Trade::MeshAttributeData positions{Trade::MeshAttribute::Position,
Containers::StridedArrayView1D<Vector2>{vertexData, reinterpret_cast<Vector2*>(vertexData.data()), 3, 12}}; Containers::StridedArrayView1D<Vector2>{vertexData, reinterpret_cast<Vector2*>(vertexData.data()), 3, 12}};
Trade::MeshData data{MeshPrimitive::Triangles, Trade::MeshData data{MeshPrimitive::Triangles,
std::move(vertexData), {positions}}; Utility::move(vertexData), {positions}};
Trade::MeshData layout = MeshTools::interleavedLayout(data, 100, { Trade::MeshData layout = MeshTools::interleavedLayout(data, 100, {
/* Normals at the same place as positions */ /* Normals at the same place as positions */
@ -897,7 +897,7 @@ void InterleaveTest::interleavedLayoutExtraTooNegativePadding() {
Trade::MeshAttributeData positions{Trade::MeshAttribute::Position, Trade::MeshAttributeData positions{Trade::MeshAttribute::Position,
Containers::StridedArrayView1D<Vector2>{vertexData, reinterpret_cast<Vector2*>(vertexData.data()), 3, 12}}; Containers::StridedArrayView1D<Vector2>{vertexData, reinterpret_cast<Vector2*>(vertexData.data()), 3, 12}};
Trade::MeshData data{MeshPrimitive::Triangles, Trade::MeshData data{MeshPrimitive::Triangles,
std::move(vertexData), {positions}}; Utility::move(vertexData), {positions}};
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
@ -964,8 +964,8 @@ void InterleaveTest::interleavedLayoutAlreadyInterleaved() {
Trade::MeshIndexData indices{Containers::arrayCast<UnsignedShort>(indexData)}; Trade::MeshIndexData indices{Containers::arrayCast<UnsignedShort>(indexData)};
Trade::MeshData mesh{MeshPrimitive::Triangles, Trade::MeshData mesh{MeshPrimitive::Triangles,
std::move(indexData), indices, Utility::move(indexData), indices,
std::move(vertexData), {positions, normals}}; Utility::move(vertexData), {positions, normals}};
CORRADE_VERIFY(MeshTools::isInterleaved(mesh)); CORRADE_VERIFY(MeshTools::isInterleaved(mesh));
/* To catch when the default argument becomes different */ /* To catch when the default argument becomes different */
@ -1014,8 +1014,8 @@ void InterleaveTest::interleavedLayoutAlreadyInterleavedAliased() {
Trade::MeshIndexData indices{Containers::arrayCast<UnsignedShort>(indexData)}; Trade::MeshIndexData indices{Containers::arrayCast<UnsignedShort>(indexData)};
Trade::MeshData mesh{MeshPrimitive::Triangles, Trade::MeshData mesh{MeshPrimitive::Triangles,
std::move(indexData), indices, Utility::move(indexData), indices,
std::move(vertexData), {positions, normals}}; Utility::move(vertexData), {positions, normals}};
CORRADE_VERIFY(MeshTools::isInterleaved(mesh)); CORRADE_VERIFY(MeshTools::isInterleaved(mesh));
/* To catch when the default argument becomes different */ /* To catch when the default argument becomes different */
@ -1060,7 +1060,7 @@ void InterleaveTest::interleavedLayoutAlreadyInterleavedExtra() {
Containers::StridedArrayView1D<Vector3>{vertexData, reinterpret_cast<Vector3*>(vertexData.data() + 100 + 10), 3, 24}}; Containers::StridedArrayView1D<Vector3>{vertexData, reinterpret_cast<Vector3*>(vertexData.data() + 100 + 10), 3, 24}};
Trade::MeshData mesh{MeshPrimitive::Triangles, Trade::MeshData mesh{MeshPrimitive::Triangles,
std::move(vertexData), {positions, normals}}; Utility::move(vertexData), {positions, normals}};
CORRADE_VERIFY(MeshTools::isInterleaved(mesh)); CORRADE_VERIFY(MeshTools::isInterleaved(mesh));
std::initializer_list<Trade::MeshAttributeData> extra{ std::initializer_list<Trade::MeshAttributeData> extra{
@ -1140,14 +1140,14 @@ void InterleaveTest::interleavedLayoutRvalue() {
Trade::MeshIndexData indices{Containers::arrayCast<UnsignedShort>(indexData)}; Trade::MeshIndexData indices{Containers::arrayCast<UnsignedShort>(indexData)};
Trade::MeshData data{MeshPrimitive::TriangleFan, Trade::MeshData data{MeshPrimitive::TriangleFan,
std::move(indexData), indices, Utility::move(indexData), indices,
std::move(vertexData), std::move(attributeData)}; Utility::move(vertexData), Utility::move(attributeData)};
CORRADE_VERIFY(!MeshTools::isInterleaved(data)); CORRADE_VERIFY(!MeshTools::isInterleaved(data));
/* Check that the attribute data array gets reused when moving a rvalue. /* Check that the attribute data array gets reused when moving a rvalue.
Explicitly passing an empty init list to verify the rvalue gets Explicitly passing an empty init list to verify the rvalue gets
propagated correctly through all functions. */ propagated correctly through all functions. */
Trade::MeshData layout = MeshTools::interleavedLayout(std::move(data), 10, Trade::MeshData layout = MeshTools::interleavedLayout(Utility::move(data), 10,
std::initializer_list<Trade::MeshAttributeData>{}); std::initializer_list<Trade::MeshAttributeData>{});
CORRADE_VERIFY(layout.attributeData().data() == originalAttributeData); CORRADE_VERIFY(layout.attributeData().data() == originalAttributeData);
@ -1416,15 +1416,15 @@ void InterleaveTest::interleaveMeshDataAlreadyInterleavedMove() {
const Trade::MeshAttributeData* attributePointer = attributeData; const Trade::MeshAttributeData* attributePointer = attributeData;
Trade::MeshData mesh{MeshPrimitive::TriangleFan, Trade::MeshData mesh{MeshPrimitive::TriangleFan,
std::move(indexData), Trade::MeshIndexData{indexView}, Utility::move(indexData), Trade::MeshIndexData{indexView},
std::move(vertexData), std::move(attributeData)}; Utility::move(vertexData), Utility::move(attributeData)};
CORRADE_VERIFY(MeshTools::isInterleaved(mesh)); CORRADE_VERIFY(MeshTools::isInterleaved(mesh));
/* To catch when the default argument becomes different */ /* To catch when the default argument becomes different */
Trade::MeshData interleaved = data.flags ? Trade::MeshData interleaved = data.flags ?
MeshTools::interleave(std::move(mesh), {}, *data.flags) : MeshTools::interleave(Utility::move(mesh), {}, *data.flags) :
/* {} just to cover the initializer_list overload :P */ /* {} just to cover the initializer_list overload :P */
MeshTools::interleave(std::move(mesh), {}); MeshTools::interleave(Utility::move(mesh), {});
CORRADE_VERIFY(MeshTools::isInterleaved(interleaved)); CORRADE_VERIFY(MeshTools::isInterleaved(interleaved));
CORRADE_COMPARE(interleaved.indexCount(), 2); CORRADE_COMPARE(interleaved.indexCount(), 2);
@ -1465,14 +1465,14 @@ void InterleaveTest::interleaveMeshDataAlreadyInterleavedMoveIndices() {
const Trade::MeshAttributeData* attributePointer = attributeData; const Trade::MeshAttributeData* attributePointer = attributeData;
Trade::MeshData mesh{MeshPrimitive::TriangleFan, Trade::MeshData mesh{MeshPrimitive::TriangleFan,
std::move(indexData), Trade::MeshIndexData{data.indexType,indices}, Utility::move(indexData), Trade::MeshIndexData{data.indexType,indices},
std::move(vertexData), std::move(attributeData)}; Utility::move(vertexData), Utility::move(attributeData)};
CORRADE_VERIFY(MeshTools::isInterleaved(mesh)); CORRADE_VERIFY(MeshTools::isInterleaved(mesh));
/* To catch when the default argument becomes different */ /* To catch when the default argument becomes different */
Trade::MeshData interleaved = data.flags ? Trade::MeshData interleaved = data.flags ?
MeshTools::interleave(std::move(mesh), {}, *data.flags) : MeshTools::interleave(Utility::move(mesh), {}, *data.flags) :
MeshTools::interleave(std::move(mesh)); MeshTools::interleave(Utility::move(mesh));
CORRADE_VERIFY(MeshTools::isInterleaved(interleaved)); CORRADE_VERIFY(MeshTools::isInterleaved(interleaved));
CORRADE_COMPARE(interleaved.indexType(), data.indexType); CORRADE_COMPARE(interleaved.indexType(), data.indexType);
@ -1520,10 +1520,10 @@ void InterleaveTest::interleaveMeshDataAlreadyInterleavedMoveNonOwned() {
Trade::MeshData data{MeshPrimitive::TriangleFan, Trade::MeshData data{MeshPrimitive::TriangleFan,
{}, indexData, Trade::MeshIndexData{indexView}, {}, indexData, Trade::MeshIndexData{indexView},
{}, vertexData, std::move(attributeData)}; {}, vertexData, Utility::move(attributeData)};
CORRADE_VERIFY(MeshTools::isInterleaved(data)); CORRADE_VERIFY(MeshTools::isInterleaved(data));
Trade::MeshData interleaved = MeshTools::interleave(std::move(data)); Trade::MeshData interleaved = MeshTools::interleave(Utility::move(data));
CORRADE_VERIFY(MeshTools::isInterleaved(interleaved)); CORRADE_VERIFY(MeshTools::isInterleaved(interleaved));
CORRADE_COMPARE(interleaved.indexCount(), 2); CORRADE_COMPARE(interleaved.indexCount(), 2);
CORRADE_COMPARE(interleaved.attributeCount(), 2); CORRADE_COMPARE(interleaved.attributeCount(), 2);

2
src/Magnum/MeshTools/Test/RemoveDuplicatesTest.cpp

@ -942,7 +942,7 @@ void RemoveDuplicatesTest::removeDuplicatesMeshDataFuzzy() {
Trade::MeshData mesh{MeshPrimitive::Lines, Trade::MeshData mesh{MeshPrimitive::Lines,
{}, indexView, indices, {}, indexView, indices,
{}, vertexData, std::move(attributes)}; {}, vertexData, Utility::move(attributes)};
Trade::MeshData unique = MeshTools::removeDuplicatesFuzzy(mesh, Trade::MeshData unique = MeshTools::removeDuplicatesFuzzy(mesh,
data.epsilon); data.epsilon);

68
src/Magnum/MeshTools/Test/TransformTest.cpp

@ -512,7 +512,7 @@ template<class T> void TransformTest::meshData2D() {
Trade::MeshData mesh{MeshPrimitive::TriangleStrip, Trade::MeshData mesh{MeshPrimitive::TriangleStrip,
{}, data.indexed ? Containers::arrayView(indices) : nullptr, {}, data.indexed ? Containers::arrayView(indices) : nullptr,
data.indexed ? Trade::MeshIndexData{indices} : Trade::MeshIndexData{nullptr}, data.indexed ? Trade::MeshIndexData{indices} : Trade::MeshIndexData{nullptr},
{}, vertices, std::move(attributes)}; {}, vertices, Utility::move(attributes)};
CORRADE_COMPARE(mesh.isIndexed(), data.indexed); CORRADE_COMPARE(mesh.isIndexed(), data.indexed);
Trade::MeshData out = transform2D(mesh, data.transformation, data.id, data.morphTargetId); Trade::MeshData out = transform2D(mesh, data.transformation, data.id, data.morphTargetId);
@ -646,12 +646,12 @@ void TransformTest::meshData2DRvaluePassthrough() {
const void* originalAttributeData = attributes; const void* originalAttributeData = attributes;
Trade::MeshData mesh{MeshPrimitive::TriangleFan, Trade::MeshData mesh{MeshPrimitive::TriangleFan,
data.indexed ? std::move(indexData) : nullptr, data.indexed ? Utility::move(indexData) : nullptr,
data.indexed ? Trade::MeshIndexData{indices} : Trade::MeshIndexData{nullptr}, data.indexed ? Trade::MeshIndexData{indices} : Trade::MeshIndexData{nullptr},
std::move(vertexData), std::move(attributes)}; Utility::move(vertexData), Utility::move(attributes)};
const Matrix3 transformation = Matrix3::rotation(35.0_degf); const Matrix3 transformation = Matrix3::rotation(35.0_degf);
Trade::MeshData out = transform2D(std::move(mesh), transformation, data.id, data.morphTargetId); Trade::MeshData out = transform2D(Utility::move(mesh), transformation, data.id, data.morphTargetId);
CORRADE_COMPARE(out.primitive(), MeshPrimitive::TriangleFan); CORRADE_COMPARE(out.primitive(), MeshPrimitive::TriangleFan);
/* Indices should be passed through unchanged */ /* Indices should be passed through unchanged */
@ -696,10 +696,10 @@ void TransformTest::meshData2DRvaluePassthroughIndexDataNotOwned() {
Trade::MeshData mesh{MeshPrimitive::TriangleStrip, Trade::MeshData mesh{MeshPrimitive::TriangleStrip,
{}, indices, Trade::MeshIndexData{indices}, {}, indices, Trade::MeshIndexData{indices},
std::move(vertexData), std::move(attributes)}; Utility::move(vertexData), Utility::move(attributes)};
const Matrix3 transformation = Matrix3::rotation(35.0_degf); const Matrix3 transformation = Matrix3::rotation(35.0_degf);
Trade::MeshData out = transform2D(std::move(mesh), transformation); Trade::MeshData out = transform2D(Utility::move(mesh), transformation);
/* Indices should be passed through unchanged */ /* Indices should be passed through unchanged */
CORRADE_VERIFY(out.isIndexed()); CORRADE_VERIFY(out.isIndexed());
@ -739,11 +739,11 @@ void TransformTest::meshData2DRvaluePassthroughVertexDataNotOwned() {
const void* originalAttributeData = attributes; const void* originalAttributeData = attributes;
Trade::MeshData mesh{MeshPrimitive::TriangleStrip, Trade::MeshData mesh{MeshPrimitive::TriangleStrip,
std::move(indexData), Trade::MeshIndexData{indices}, Utility::move(indexData), Trade::MeshIndexData{indices},
{}, vertices, std::move(attributes)}; {}, vertices, Utility::move(attributes)};
const Matrix3 transformation = Matrix3::rotation(35.0_degf); const Matrix3 transformation = Matrix3::rotation(35.0_degf);
Trade::MeshData out = transform2D(std::move(mesh), transformation); Trade::MeshData out = transform2D(Utility::move(mesh), transformation);
/* Indices should be passed through unchanged */ /* Indices should be passed through unchanged */
CORRADE_VERIFY(out.isIndexed()); CORRADE_VERIFY(out.isIndexed());
@ -799,10 +799,10 @@ void TransformTest::meshData2DRvaluePassthroughWrongFormat() {
const void* originalAttributeData = attributes; const void* originalAttributeData = attributes;
Trade::MeshData mesh{MeshPrimitive::TriangleStrip, Trade::MeshData mesh{MeshPrimitive::TriangleStrip,
std::move(vertexData), std::move(attributes)}; Utility::move(vertexData), Utility::move(attributes)};
const Matrix3 transformation = Matrix3::rotation(35.0_degf); const Matrix3 transformation = Matrix3::rotation(35.0_degf);
Trade::MeshData out = transform2D(std::move(mesh), transformation); Trade::MeshData out = transform2D(Utility::move(mesh), transformation);
/* The vertices should be expanded to floats and transformed */ /* The vertices should be expanded to floats and transformed */
CORRADE_COMPARE_AS(out.attribute<Vector2>(Trade::MeshAttribute::Position), Containers::arrayView({ CORRADE_COMPARE_AS(out.attribute<Vector2>(Trade::MeshAttribute::Position), Containers::arrayView({
@ -925,7 +925,7 @@ template<class T, class U, class V, class W> void TransformTest::meshData3D() {
Trade::MeshData mesh{MeshPrimitive::TriangleStrip, Trade::MeshData mesh{MeshPrimitive::TriangleStrip,
{}, data.indexed ? Containers::arrayView(indices) : nullptr, {}, data.indexed ? Containers::arrayView(indices) : nullptr,
data.indexed ? Trade::MeshIndexData{indices} : Trade::MeshIndexData{nullptr}, data.indexed ? Trade::MeshIndexData{indices} : Trade::MeshIndexData{nullptr},
{}, vertices, std::move(attributes)}; {}, vertices, Utility::move(attributes)};
CORRADE_COMPARE(mesh.isIndexed(), data.indexed); CORRADE_COMPARE(mesh.isIndexed(), data.indexed);
Trade::MeshData out = transform3D(mesh, data.transformation, data.id, data.morphTargetId); Trade::MeshData out = transform3D(mesh, data.transformation, data.id, data.morphTargetId);
@ -1125,12 +1125,12 @@ void TransformTest::meshData3DRvaluePassthrough() {
const void* originalAttributeData = attributes; const void* originalAttributeData = attributes;
Trade::MeshData mesh{MeshPrimitive::TriangleFan, Trade::MeshData mesh{MeshPrimitive::TriangleFan,
data.indexed ? std::move(indexData) : nullptr, data.indexed ? Utility::move(indexData) : nullptr,
data.indexed ? Trade::MeshIndexData{indices} : Trade::MeshIndexData{nullptr}, data.indexed ? Trade::MeshIndexData{indices} : Trade::MeshIndexData{nullptr},
std::move(vertexData), std::move(attributes)}; Utility::move(vertexData), Utility::move(attributes)};
const Matrix4 transformation = Matrix4::rotationX(35.0_degf); const Matrix4 transformation = Matrix4::rotationX(35.0_degf);
Trade::MeshData out = transform3D(std::move(mesh), transformation, data.id, data.morphTargetId); Trade::MeshData out = transform3D(Utility::move(mesh), transformation, data.id, data.morphTargetId);
CORRADE_COMPARE(out.primitive(), MeshPrimitive::TriangleFan); CORRADE_COMPARE(out.primitive(), MeshPrimitive::TriangleFan);
/* Indices should be passed through unchanged */ /* Indices should be passed through unchanged */
@ -1209,10 +1209,10 @@ void TransformTest::meshData3DRvaluePassthroughIndexDataNotOwned() {
Trade::MeshData mesh{MeshPrimitive::TriangleStrip, Trade::MeshData mesh{MeshPrimitive::TriangleStrip,
{}, indices, Trade::MeshIndexData{indices}, {}, indices, Trade::MeshIndexData{indices},
std::move(vertexData), std::move(attributes)}; Utility::move(vertexData), Utility::move(attributes)};
const Matrix4 transformation = Matrix4::rotationX(35.0_degf); const Matrix4 transformation = Matrix4::rotationX(35.0_degf);
Trade::MeshData out = transform3D(std::move(mesh), transformation); Trade::MeshData out = transform3D(Utility::move(mesh), transformation);
/* Indices should be passed through unchanged */ /* Indices should be passed through unchanged */
CORRADE_VERIFY(out.isIndexed()); CORRADE_VERIFY(out.isIndexed());
@ -1252,11 +1252,11 @@ void TransformTest::meshData3DRvaluePassthroughVertexDataNotOwned() {
const void* originalAttributeData = attributes; const void* originalAttributeData = attributes;
Trade::MeshData mesh{MeshPrimitive::TriangleStrip, Trade::MeshData mesh{MeshPrimitive::TriangleStrip,
std::move(indexData), Trade::MeshIndexData{indices}, Utility::move(indexData), Trade::MeshIndexData{indices},
{}, vertices, std::move(attributes)}; {}, vertices, Utility::move(attributes)};
const Matrix4 transformation = Matrix4::rotationX(35.0_degf); const Matrix4 transformation = Matrix4::rotationX(35.0_degf);
Trade::MeshData out = transform3D(std::move(mesh), transformation); Trade::MeshData out = transform3D(Utility::move(mesh), transformation);
/* Indices should be passed through unchanged */ /* Indices should be passed through unchanged */
CORRADE_VERIFY(out.isIndexed()); CORRADE_VERIFY(out.isIndexed());
@ -1336,10 +1336,10 @@ void TransformTest::meshData3DRvaluePassthroughWrongFormat() {
const void* originalAttributeData = attributes; const void* originalAttributeData = attributes;
Trade::MeshData mesh{MeshPrimitive::TriangleStrip, Trade::MeshData mesh{MeshPrimitive::TriangleStrip,
std::move(vertexData), std::move(attributes)}; Utility::move(vertexData), Utility::move(attributes)};
const Matrix4 transformation = Matrix4::rotationX(35.0_degf); const Matrix4 transformation = Matrix4::rotationX(35.0_degf);
Trade::MeshData out = transform3D(std::move(mesh), transformation); Trade::MeshData out = transform3D(Utility::move(mesh), transformation);
/* The vertices should be expanded to floats and transformed */ /* The vertices should be expanded to floats and transformed */
CORRADE_COMPARE_AS(out.attribute<Vector3>(Trade::MeshAttribute::Position), Containers::arrayView({ CORRADE_COMPARE_AS(out.attribute<Vector3>(Trade::MeshAttribute::Position), Containers::arrayView({
@ -1436,7 +1436,7 @@ void TransformTest::meshData3DInPlaceWrongFormat() {
if(data.normalFormat != VertexFormat{}) if(data.normalFormat != VertexFormat{})
arrayAppend(attributes, Trade::MeshAttributeData{Trade::MeshAttribute::Normal, data.normalFormat, nullptr}); arrayAppend(attributes, Trade::MeshAttributeData{Trade::MeshAttribute::Normal, data.normalFormat, nullptr});
Trade::MeshData mesh{MeshPrimitive::Points, nullptr, std::move(attributes)}; Trade::MeshData mesh{MeshPrimitive::Points, nullptr, Utility::move(attributes)};
std::ostringstream out; std::ostringstream out;
Error redirectError{&out}; Error redirectError{&out};
@ -1478,7 +1478,7 @@ template<class T> void TransformTest::meshDataTextureCoordinates2D() {
Trade::MeshData mesh{MeshPrimitive::TriangleStrip, Trade::MeshData mesh{MeshPrimitive::TriangleStrip,
{}, data.indexed ? Containers::arrayView(indices) : nullptr, {}, data.indexed ? Containers::arrayView(indices) : nullptr,
data.indexed ? Trade::MeshIndexData{indices} : Trade::MeshIndexData{nullptr}, data.indexed ? Trade::MeshIndexData{indices} : Trade::MeshIndexData{nullptr},
{}, vertices, std::move(attributes)}; {}, vertices, Utility::move(attributes)};
CORRADE_COMPARE(mesh.isIndexed(), data.indexed); CORRADE_COMPARE(mesh.isIndexed(), data.indexed);
Trade::MeshData out = transformTextureCoordinates2D(mesh, data.transformation, data.id, data.morphTargetId); Trade::MeshData out = transformTextureCoordinates2D(mesh, data.transformation, data.id, data.morphTargetId);
@ -1599,12 +1599,12 @@ void TransformTest::meshDataTextureCoordinates2DRvaluePassthrough() {
const void* originalAttributeData = attributes; const void* originalAttributeData = attributes;
Trade::MeshData mesh{MeshPrimitive::TriangleFan, Trade::MeshData mesh{MeshPrimitive::TriangleFan,
data.indexed ? std::move(indexData) : nullptr, data.indexed ? Utility::move(indexData) : nullptr,
data.indexed ? Trade::MeshIndexData{indices} : Trade::MeshIndexData{nullptr}, data.indexed ? Trade::MeshIndexData{indices} : Trade::MeshIndexData{nullptr},
std::move(vertexData), std::move(attributes)}; Utility::move(vertexData), Utility::move(attributes)};
const Matrix3 transformation = Matrix3::rotation(35.0_degf); const Matrix3 transformation = Matrix3::rotation(35.0_degf);
Trade::MeshData out = transformTextureCoordinates2D(std::move(mesh), transformation, data.id, data.morphTargetId); Trade::MeshData out = transformTextureCoordinates2D(Utility::move(mesh), transformation, data.id, data.morphTargetId);
CORRADE_COMPARE(out.primitive(), MeshPrimitive::TriangleFan); CORRADE_COMPARE(out.primitive(), MeshPrimitive::TriangleFan);
/* Indices should be passed through unchanged */ /* Indices should be passed through unchanged */
@ -1649,10 +1649,10 @@ void TransformTest::meshDataTextureCoordinates2DRvaluePassthroughIndexDataNotOwn
Trade::MeshData mesh{MeshPrimitive::TriangleStrip, Trade::MeshData mesh{MeshPrimitive::TriangleStrip,
{}, indices, Trade::MeshIndexData{indices}, {}, indices, Trade::MeshIndexData{indices},
std::move(vertexData), std::move(attributes)}; Utility::move(vertexData), Utility::move(attributes)};
const Matrix3 transformation = Matrix3::rotation(35.0_degf); const Matrix3 transformation = Matrix3::rotation(35.0_degf);
Trade::MeshData out = transformTextureCoordinates2D(std::move(mesh), transformation); Trade::MeshData out = transformTextureCoordinates2D(Utility::move(mesh), transformation);
/* Indices should be passed through unchanged */ /* Indices should be passed through unchanged */
CORRADE_VERIFY(out.isIndexed()); CORRADE_VERIFY(out.isIndexed());
@ -1692,11 +1692,11 @@ void TransformTest::meshDataTextureCoordinates2DRvaluePassthroughVertexDataNotOw
const void* originalAttributeData = attributes; const void* originalAttributeData = attributes;
Trade::MeshData mesh{MeshPrimitive::TriangleStrip, Trade::MeshData mesh{MeshPrimitive::TriangleStrip,
std::move(indexData), Trade::MeshIndexData{indices}, Utility::move(indexData), Trade::MeshIndexData{indices},
{}, vertices, std::move(attributes)}; {}, vertices, Utility::move(attributes)};
const Matrix3 transformation = Matrix3::rotation(35.0_degf); const Matrix3 transformation = Matrix3::rotation(35.0_degf);
Trade::MeshData out = transformTextureCoordinates2D(std::move(mesh), transformation); Trade::MeshData out = transformTextureCoordinates2D(Utility::move(mesh), transformation);
/* Indices should be passed through unchanged */ /* Indices should be passed through unchanged */
CORRADE_VERIFY(out.isIndexed()); CORRADE_VERIFY(out.isIndexed());
@ -1752,10 +1752,10 @@ void TransformTest::meshDataTextureCoordinates2DRvaluePassthroughWrongFormat() {
const void* originalAttributeData = attributes; const void* originalAttributeData = attributes;
Trade::MeshData mesh{MeshPrimitive::TriangleStrip, Trade::MeshData mesh{MeshPrimitive::TriangleStrip,
std::move(vertexData), std::move(attributes)}; Utility::move(vertexData), Utility::move(attributes)};
const Matrix3 transformation = Matrix3::rotation(35.0_degf); const Matrix3 transformation = Matrix3::rotation(35.0_degf);
Trade::MeshData out = transformTextureCoordinates2D(std::move(mesh), transformation); Trade::MeshData out = transformTextureCoordinates2D(Utility::move(mesh), transformation);
/* The vertices should be expanded to floats and transformed */ /* The vertices should be expanded to floats and transformed */
CORRADE_COMPARE_AS(out.attribute<Vector2>(Trade::MeshAttribute::TextureCoordinates), Containers::arrayView({ CORRADE_COMPARE_AS(out.attribute<Vector2>(Trade::MeshAttribute::TextureCoordinates), Containers::arrayView({

12
src/Magnum/MeshTools/Transform.cpp

@ -96,7 +96,7 @@ Trade::MeshData transform2D(Trade::MeshData&& mesh, const Matrix3& transformatio
positionAttributeId && mesh.attributeFormat(*positionAttributeId) == VertexFormat::Vector2 positionAttributeId && mesh.attributeFormat(*positionAttributeId) == VertexFormat::Vector2
) { ) {
transform2DInPlace(mesh, transformation, id, morphTargetId); transform2DInPlace(mesh, transformation, id, morphTargetId);
return std::move(mesh); return Utility::move(mesh);
} }
/* Otherwise delegate to the function that does all the copying and format /* Otherwise delegate to the function that does all the copying and format
@ -106,7 +106,7 @@ Trade::MeshData transform2D(Trade::MeshData&& mesh, const Matrix3& transformatio
#ifdef MAGNUM_BUILD_DEPRECATED #ifdef MAGNUM_BUILD_DEPRECATED
Trade::MeshData transform2D(Trade::MeshData&& mesh, const Matrix3& transformation, const UnsignedInt id, const InterleaveFlags flags) { Trade::MeshData transform2D(Trade::MeshData&& mesh, const Matrix3& transformation, const UnsignedInt id, const InterleaveFlags flags) {
return transform2D(std::move(mesh), transformation, id, -1, flags); return transform2D(Utility::move(mesh), transformation, id, -1, flags);
} }
#endif #endif
@ -242,7 +242,7 @@ Trade::MeshData transform3D(Trade::MeshData&& mesh, const Matrix4& transformatio
(!normalAttributeId || mesh.attributeFormat(*normalAttributeId) == VertexFormat::Vector3) (!normalAttributeId || mesh.attributeFormat(*normalAttributeId) == VertexFormat::Vector3)
) { ) {
transform3DInPlace(mesh, transformation, id, morphTargetId); transform3DInPlace(mesh, transformation, id, morphTargetId);
return std::move(mesh); return Utility::move(mesh);
} }
/* Otherwise delegate to the function that does all the copying and format /* Otherwise delegate to the function that does all the copying and format
@ -252,7 +252,7 @@ Trade::MeshData transform3D(Trade::MeshData&& mesh, const Matrix4& transformatio
#ifdef MAGNUM_BUILD_DEPRECATED #ifdef MAGNUM_BUILD_DEPRECATED
Trade::MeshData transform3D(Trade::MeshData&& mesh, const Matrix4& transformation, const UnsignedInt id, const InterleaveFlags flags) { Trade::MeshData transform3D(Trade::MeshData&& mesh, const Matrix4& transformation, const UnsignedInt id, const InterleaveFlags flags) {
return transform3D(std::move(mesh), transformation, id, -1, flags); return transform3D(Utility::move(mesh), transformation, id, -1, flags);
} }
#endif #endif
@ -367,7 +367,7 @@ Trade::MeshData transformTextureCoordinates2D(Trade::MeshData&& mesh, const Matr
textureCoordinateAttributeId && mesh.attributeFormat(*textureCoordinateAttributeId) == VertexFormat::Vector2 textureCoordinateAttributeId && mesh.attributeFormat(*textureCoordinateAttributeId) == VertexFormat::Vector2
) { ) {
transformTextureCoordinates2DInPlace(mesh, transformation, id, morphTargetId); transformTextureCoordinates2DInPlace(mesh, transformation, id, morphTargetId);
return std::move(mesh); return Utility::move(mesh);
} }
/* Otherwise delegate to the function that does all the copying and format /* Otherwise delegate to the function that does all the copying and format
@ -377,7 +377,7 @@ Trade::MeshData transformTextureCoordinates2D(Trade::MeshData&& mesh, const Matr
#ifdef MAGNUM_BUILD_DEPRECATED #ifdef MAGNUM_BUILD_DEPRECATED
Trade::MeshData transformTextureCoordinates2D(Trade::MeshData&& mesh, const Matrix3& transformation, const UnsignedInt id, const InterleaveFlags flags) { Trade::MeshData transformTextureCoordinates2D(Trade::MeshData&& mesh, const Matrix3& transformation, const UnsignedInt id, const InterleaveFlags flags) {
return transformTextureCoordinates2D(std::move(mesh), transformation, id, -1, flags); return transformTextureCoordinates2D(Utility::move(mesh), transformation, id, -1, flags);
} }
#endif #endif

4
src/Magnum/MeshTools/Transform.h

@ -86,7 +86,7 @@ Returns transformed vectors instead of modifying them in-place. See
@see @ref transform2D(), @ref transform3D(), @ref transformTextureCoordinates2D() @see @ref transform2D(), @ref transform3D(), @ref transformTextureCoordinates2D()
*/ */
template<class T, class U> U transformVectors(const T& transformation, U vectors) { template<class T, class U> U transformVectors(const T& transformation, U vectors) {
U result(std::move(vectors)); U result(Utility::move(vectors));
transformVectorsInPlace(transformation, result); transformVectorsInPlace(transformation, result);
return result; return result;
} }
@ -139,7 +139,7 @@ Returns transformed points instead of modifying them in-place. See
@see @ref transform2D(), @ref transform3D(), @ref transformTextureCoordinates2D() @see @ref transform2D(), @ref transform3D(), @ref transformTextureCoordinates2D()
*/ */
template<class T, class U> U transformPoints(const T& transformation, U vectors) { template<class T, class U> U transformPoints(const T& transformation, U vectors) {
U result(std::move(vectors)); U result(Utility::move(vectors));
transformPointsInPlace(transformation, result); transformPointsInPlace(transformation, result);
return result; return result;
} }

4
src/Magnum/Platform/WindowlessCglApplication.cpp

@ -83,7 +83,7 @@ WindowlessCglContext::~WindowlessCglContext() {
} }
WindowlessCglContext& WindowlessCglContext::operator=(WindowlessCglContext&& other) noexcept { WindowlessCglContext& WindowlessCglContext::operator=(WindowlessCglContext&& other) noexcept {
using std::swap; using Utility::swap;
swap(other._pixelFormat, _pixelFormat); swap(other._pixelFormat, _pixelFormat);
swap(other._context, _context); swap(other._context, _context);
return *this; return *this;
@ -134,7 +134,7 @@ bool WindowlessCglApplication::tryCreateContext(const Configuration& configurati
if(!glContext.isCreated() || !glContext.makeCurrent() || !_context.tryCreate(configuration)) if(!glContext.isCreated() || !glContext.makeCurrent() || !_context.tryCreate(configuration))
return false; return false;
_glContext = std::move(glContext); _glContext = Utility::move(glContext);
return true; return true;
} }

4
src/Magnum/Platform/WindowlessEglApplication.cpp

@ -638,7 +638,7 @@ WindowlessEglContext::~WindowlessEglContext() {
} }
WindowlessEglContext& WindowlessEglContext::operator=(WindowlessEglContext&& other) noexcept { WindowlessEglContext& WindowlessEglContext::operator=(WindowlessEglContext&& other) noexcept {
using std::swap; using Utility::swap;
#ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_WEBGL
swap(other._sharedContext, _sharedContext); swap(other._sharedContext, _sharedContext);
#endif #endif
@ -740,7 +740,7 @@ bool WindowlessEglApplication::tryCreateContext(const Configuration& configurati
if(!glContext.isCreated() || !glContext.makeCurrent() || !_context->tryCreate(configuration)) if(!glContext.isCreated() || !glContext.makeCurrent() || !_context->tryCreate(configuration))
return false; return false;
_glContext = std::move(glContext); _glContext = Utility::move(glContext);
return true; return true;
} }

4
src/Magnum/Platform/WindowlessGlxApplication.cpp

@ -293,7 +293,7 @@ WindowlessGlxContext::~WindowlessGlxContext() {
} }
WindowlessGlxContext& WindowlessGlxContext::operator=(WindowlessGlxContext&& other) noexcept { WindowlessGlxContext& WindowlessGlxContext::operator=(WindowlessGlxContext&& other) noexcept {
using std::swap; using Utility::swap;
swap(other._display, _display); swap(other._display, _display);
swap(other._pbuffer, _pbuffer); swap(other._pbuffer, _pbuffer);
swap(other._context, _context); swap(other._context, _context);
@ -346,7 +346,7 @@ bool WindowlessGlxApplication::tryCreateContext(const Configuration& configurati
if(!glContext.isCreated() || !glContext.makeCurrent() || !_context.tryCreate(configuration)) if(!glContext.isCreated() || !glContext.makeCurrent() || !_context.tryCreate(configuration))
return false; return false;
_glContext = std::move(glContext); _glContext = Utility::move(glContext);
return true; return true;
} }

4
src/Magnum/Platform/WindowlessWglApplication.cpp

@ -278,7 +278,7 @@ WindowlessWglContext::~WindowlessWglContext() {
} }
WindowlessWglContext& WindowlessWglContext::operator=(WindowlessWglContext&& other) noexcept { WindowlessWglContext& WindowlessWglContext::operator=(WindowlessWglContext&& other) noexcept {
using std::swap; using Utility::swap;
swap(other._window, _window); swap(other._window, _window);
swap(other._deviceContext, _deviceContext); swap(other._deviceContext, _deviceContext);
swap(other._context, _context); swap(other._context, _context);
@ -331,7 +331,7 @@ bool WindowlessWglApplication::tryCreateContext(const Configuration& configurati
if(!glContext.isCreated() || !glContext.makeCurrent() || !_context.tryCreate(configuration)) if(!glContext.isCreated() || !glContext.makeCurrent() || !_context.tryCreate(configuration))
return false; return false;
_glContext = std::move(glContext); _glContext = Utility::move(glContext);
return true; return true;
} }

4
src/Magnum/Primitives/Capsule.cpp

@ -102,8 +102,8 @@ Trade::MeshData capsule2DWireframe(const UnsignedInt hemisphereRings, const Unsi
Trade::MeshIndexData indices{indexData}; Trade::MeshIndexData indices{indexData};
Trade::MeshAttributeData positions{Trade::MeshAttribute::Position, Containers::arrayView(vertexData)}; Trade::MeshAttributeData positions{Trade::MeshAttribute::Position, Containers::arrayView(vertexData)};
return Trade::MeshData{MeshPrimitive::Lines, return Trade::MeshData{MeshPrimitive::Lines,
Containers::arrayAllocatorCast<char, Trade::ArrayAllocator>(std::move(indexData)), indices, Containers::arrayAllocatorCast<char, Trade::ArrayAllocator>(Utility::move(indexData)), indices,
Containers::arrayAllocatorCast<char, Trade::ArrayAllocator>(std::move(vertexData)), {positions}}; Containers::arrayAllocatorCast<char, Trade::ArrayAllocator>(Utility::move(vertexData)), {positions}};
} }
Trade::MeshData capsule3DSolid(const UnsignedInt hemisphereRings, const UnsignedInt cylinderRings, const UnsignedInt segments, const Float halfLength, const CapsuleFlags flags) { Trade::MeshData capsule3DSolid(const UnsignedInt hemisphereRings, const UnsignedInt cylinderRings, const UnsignedInt segments, const Float halfLength, const CapsuleFlags flags) {

8
src/Magnum/Primitives/Circle.cpp

@ -84,7 +84,7 @@ Trade::MeshData circle2DSolid(const UnsignedInt segments, const Circle2DFlags fl
textureCoords[i] = positions[i]*0.5f + Vector2{0.5f}; textureCoords[i] = positions[i]*0.5f + Vector2{0.5f};
} }
return Trade::MeshData{MeshPrimitive::TriangleFan, std::move(vertexData), std::move(attributes), UnsignedInt(positions.size())}; return Trade::MeshData{MeshPrimitive::TriangleFan, Utility::move(vertexData), Utility::move(attributes), UnsignedInt(positions.size())};
} }
#ifdef MAGNUM_BUILD_DEPRECATED #ifdef MAGNUM_BUILD_DEPRECATED
@ -111,7 +111,7 @@ Trade::MeshData circle2DWireframe(const UnsignedInt segments) {
positions[i] = {sincos.second, sincos.first}; positions[i] = {sincos.second, sincos.first};
} }
return Trade::MeshData{MeshPrimitive::LineLoop, std::move(vertexData), return Trade::MeshData{MeshPrimitive::LineLoop, Utility::move(vertexData),
Trade::meshAttributeDataNonOwningArray(AttributeData2D), UnsignedInt(positions.size())}; Trade::meshAttributeDataNonOwningArray(AttributeData2D), UnsignedInt(positions.size())};
} }
@ -196,7 +196,7 @@ Trade::MeshData circle3DSolid(const UnsignedInt segments, const Circle3DFlags fl
} }
return Trade::MeshData{MeshPrimitive::TriangleFan, return Trade::MeshData{MeshPrimitive::TriangleFan,
std::move(vertexData), std::move(attributeData)}; Utility::move(vertexData), Utility::move(attributeData)};
} }
#ifdef MAGNUM_BUILD_DEPRECATED #ifdef MAGNUM_BUILD_DEPRECATED
@ -232,7 +232,7 @@ Trade::MeshData circle3DWireframe(const UnsignedInt segments) {
positions[i] = {sincos.second, sincos.first, 0.0f}; positions[i] = {sincos.second, sincos.first, 0.0f};
} }
return Trade::MeshData{MeshPrimitive::LineLoop, std::move(vertexData), return Trade::MeshData{MeshPrimitive::LineLoop, Utility::move(vertexData),
Trade::meshAttributeDataNonOwningArray(AttributeData3DWireframe), UnsignedInt(positions.size())}; Trade::meshAttributeDataNonOwningArray(AttributeData3DWireframe), UnsignedInt(positions.size())};
} }

4
src/Magnum/Primitives/Gradient.cpp

@ -69,7 +69,7 @@ Trade::MeshData gradient2D(const Vector2& a, const Color4& colorA, const Vector2
vertices[i].color = Math::lerp(colorA, colorB, t); vertices[i].color = Math::lerp(colorA, colorB, t);
} }
return Trade::MeshData{MeshPrimitive::TriangleStrip, std::move(vertexData), return Trade::MeshData{MeshPrimitive::TriangleStrip, Utility::move(vertexData),
Trade::meshAttributeDataNonOwningArray(Attributes2D)}; Trade::meshAttributeDataNonOwningArray(Attributes2D)};
} }
@ -126,7 +126,7 @@ Trade::MeshData gradient3D(const Vector3& a, const Color4& colorA, const Vector3
vertices[i].color = Math::lerp(colorA, colorB, t); vertices[i].color = Math::lerp(colorA, colorB, t);
} }
return Trade::MeshData{MeshPrimitive::TriangleStrip, std::move(vertexData), return Trade::MeshData{MeshPrimitive::TriangleStrip, Utility::move(vertexData),
Trade::meshAttributeDataNonOwningArray(Attributes3D)}; Trade::meshAttributeDataNonOwningArray(Attributes3D)};
} }

8
src/Magnum/Primitives/Grid.cpp

@ -125,8 +125,8 @@ Trade::MeshData grid3DSolid(const Vector2i& subdivisions, const GridFlags flags)
CORRADE_INTERNAL_ASSERT(attributeOffset == stride); CORRADE_INTERNAL_ASSERT(attributeOffset == stride);
return Trade::MeshData{MeshPrimitive::Triangles, return Trade::MeshData{MeshPrimitive::Triangles,
std::move(indexData), Trade::MeshIndexData{indices}, Utility::move(indexData), Trade::MeshIndexData{indices},
std::move(vertexData), std::move(attributes)}; Utility::move(vertexData), Utility::move(attributes)};
} }
namespace { namespace {
@ -176,8 +176,8 @@ Trade::MeshData grid3DWireframe(const Vector2i& subdivisions) {
} }
return Trade::MeshData{MeshPrimitive::Lines, return Trade::MeshData{MeshPrimitive::Lines,
std::move(indexData), Trade::MeshIndexData{indices}, Utility::move(indexData), Trade::MeshIndexData{indices},
std::move(vertexData), Utility::move(vertexData),
Trade::meshAttributeDataNonOwningArray(AttributeData3DWireframe), Trade::meshAttributeDataNonOwningArray(AttributeData3DWireframe),
UnsignedInt(vertexCount.product())}; UnsignedInt(vertexCount.product())};
} }

4
src/Magnum/Primitives/Icosphere.cpp

@ -138,8 +138,8 @@ Trade::MeshData icosphereSolid(const UnsignedInt subdivisions) {
for(std::size_t i = 0; i != positions.size(); ++i) for(std::size_t i = 0; i != positions.size(); ++i)
normals[i] = positions[i]; normals[i] = positions[i];
return Trade::MeshData{MeshPrimitive::Triangles, std::move(indexData), return Trade::MeshData{MeshPrimitive::Triangles, Utility::move(indexData),
Trade::MeshIndexData{indices}, std::move(vertexData), Trade::MeshIndexData{indices}, Utility::move(vertexData),
{Trade::MeshAttributeData{Trade::MeshAttribute::Position, positions}, {Trade::MeshAttributeData{Trade::MeshAttribute::Position, positions},
Trade::MeshAttributeData{Trade::MeshAttribute::Normal, normals}}}; Trade::MeshAttributeData{Trade::MeshAttribute::Normal, normals}}};
} }

4
src/Magnum/Primitives/Implementation/Spheroid.cpp

@ -272,8 +272,8 @@ Trade::MeshData Spheroid::finalize() {
CORRADE_INTERNAL_ASSERT(attributeOffset == _attributeCount); CORRADE_INTERNAL_ASSERT(attributeOffset == _attributeCount);
return Trade::MeshData{MeshPrimitive::Triangles, return Trade::MeshData{MeshPrimitive::Triangles,
Containers::arrayAllocatorCast<char, Trade::ArrayAllocator>(std::move(_indexData)), Containers::arrayAllocatorCast<char, Trade::ArrayAllocator>(Utility::move(_indexData)),
indices, std::move(_vertexData), std::move(attributes)}; indices, Utility::move(_vertexData), Utility::move(attributes)};
} }
}}} }}}

4
src/Magnum/Primitives/Implementation/WireframeSpheroid.cpp

@ -148,8 +148,8 @@ Trade::MeshData WireframeSpheroid::finalize() {
Trade::MeshAttributeData positions{Trade::MeshAttribute::Position, Containers::arrayView(_vertexData)}; Trade::MeshAttributeData positions{Trade::MeshAttribute::Position, Containers::arrayView(_vertexData)};
const UnsignedInt vertexCount = _vertexData.size(); const UnsignedInt vertexCount = _vertexData.size();
return Trade::MeshData{MeshPrimitive::Lines, return Trade::MeshData{MeshPrimitive::Lines,
Containers::arrayAllocatorCast<char, Trade::ArrayAllocator>(std::move(_indexData)), indices, Containers::arrayAllocatorCast<char, Trade::ArrayAllocator>(Utility::move(_indexData)), indices,
Containers::arrayAllocatorCast<char, Trade::ArrayAllocator>(std::move(_vertexData)), Containers::arrayAllocatorCast<char, Trade::ArrayAllocator>(Utility::move(_vertexData)),
Trade::meshAttributeDataNonOwningArray(AttributeData), vertexCount}; Trade::meshAttributeDataNonOwningArray(AttributeData), vertexCount};
} }

4
src/Magnum/Primitives/Line.cpp

@ -46,7 +46,7 @@ Trade::MeshData line2D(const Vector2& a, const Vector2& b) {
positions[0] = a; positions[0] = a;
positions[1] = b; positions[1] = b;
return Trade::MeshData{MeshPrimitive::Lines, std::move(vertexData), return Trade::MeshData{MeshPrimitive::Lines, Utility::move(vertexData),
Trade::meshAttributeDataNonOwningArray(Attributes2D)}; Trade::meshAttributeDataNonOwningArray(Attributes2D)};
} }
@ -65,7 +65,7 @@ Trade::MeshData line3D(const Vector3& a, const Vector3& b) {
positions[0] = a; positions[0] = a;
positions[1] = b; positions[1] = b;
return Trade::MeshData{MeshPrimitive::Lines, std::move(vertexData), return Trade::MeshData{MeshPrimitive::Lines, Utility::move(vertexData),
Trade::meshAttributeDataNonOwningArray(Attributes3D)}; Trade::meshAttributeDataNonOwningArray(Attributes3D)};
} }

2
src/Magnum/Primitives/Plane.cpp

@ -137,7 +137,7 @@ Trade::MeshData planeSolid(const PlaneFlags flags) {
} }
return Trade::MeshData{MeshPrimitive::TriangleStrip, return Trade::MeshData{MeshPrimitive::TriangleStrip,
std::move(vertexData), std::move(attributeData)}; Utility::move(vertexData), Utility::move(attributeData)};
} }
#ifdef MAGNUM_BUILD_DEPRECATED #ifdef MAGNUM_BUILD_DEPRECATED

4
src/Magnum/SceneTools/Copy.cpp

@ -60,7 +60,7 @@ Trade::SceneData copy(Trade::SceneData&& scene) {
the original array in its entirety */ the original array in its entirety */
Containers::Array<Trade::SceneFieldData> fieldData; Containers::Array<Trade::SceneFieldData> fieldData;
if(!originalFieldData.deleter() && (scene.dataFlags() & Trade::DataFlag::Owned)) { if(!originalFieldData.deleter() && (scene.dataFlags() & Trade::DataFlag::Owned)) {
fieldData = std::move(originalFieldData); fieldData = Utility::move(originalFieldData);
/* Otherwise we have to allocate a new one and re-route the fields to a /* Otherwise we have to allocate a new one and re-route the fields to a
potentially different data array */ potentially different data array */
@ -135,7 +135,7 @@ Trade::SceneData copy(Trade::SceneData&& scene) {
} }
return Trade::SceneData{scene.mappingType(), scene.mappingBound(), return Trade::SceneData{scene.mappingType(), scene.mappingBound(),
std::move(data), std::move(fieldData), scene.importerState()}; Utility::move(data), Utility::move(fieldData), scene.importerState()};
} }
}} }}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save