diff --git a/src/Magnum/AbstractObject.cpp b/src/Magnum/AbstractObject.cpp index 4e5fd5ebd..82a1a1c4d 100644 --- a/src/Magnum/AbstractObject.cpp +++ b/src/Magnum/AbstractObject.cpp @@ -26,7 +26,7 @@ #include "AbstractObject.h" #include -#include +#include #include "Magnum/Context.h" #include "Magnum/Extensions.h" @@ -129,9 +129,9 @@ Int AbstractObject::maxLabelLength() { return value; } -void AbstractObject::labelImplementationNoOp(GLenum, GLuint, Containers::ArrayReference) {} +void AbstractObject::labelImplementationNoOp(GLenum, GLuint, Containers::ArrayView) {} -void AbstractObject::labelImplementationKhr(const GLenum identifier, const GLuint name, const Containers::ArrayReference label) { +void AbstractObject::labelImplementationKhr(const GLenum identifier, const GLuint name, const Containers::ArrayView label) { #ifndef MAGNUM_TARGET_GLES glObjectLabel(identifier, name, label.size(), label); #elif !defined(CORRADE_TARGET_NACL) @@ -144,7 +144,7 @@ void AbstractObject::labelImplementationKhr(const GLenum identifier, const GLuin #endif } -void AbstractObject::labelImplementationExt(const GLenum identifier, const GLuint name, const Containers::ArrayReference label) { +void AbstractObject::labelImplementationExt(const GLenum identifier, const GLuint name, const Containers::ArrayView label) { #ifndef CORRADE_TARGET_NACL const GLenum type = extTypeFromKhrIdentifier(identifier); glLabelObjectEXT(type, name, label.size(), label); diff --git a/src/Magnum/AbstractObject.h b/src/Magnum/AbstractObject.h index 110472411..4d97704ac 100644 --- a/src/Magnum/AbstractObject.h +++ b/src/Magnum/AbstractObject.h @@ -107,9 +107,9 @@ class MAGNUM_EXPORT AbstractObject { private: #ifndef MAGNUM_TARGET_WEBGL - static MAGNUM_LOCAL void labelImplementationNoOp(GLenum, GLuint, Containers::ArrayReference label); - static MAGNUM_LOCAL void labelImplementationExt(GLenum identifier, GLuint name, Containers::ArrayReference label); - static MAGNUM_LOCAL void labelImplementationKhr(GLenum identifier, GLuint name, Containers::ArrayReference label); + static MAGNUM_LOCAL void labelImplementationNoOp(GLenum, GLuint, Containers::ArrayView label); + static MAGNUM_LOCAL void labelImplementationExt(GLenum identifier, GLuint name, Containers::ArrayView label); + static MAGNUM_LOCAL void labelImplementationKhr(GLenum identifier, GLuint name, Containers::ArrayView label); static MAGNUM_LOCAL std::string getLabelImplementationNoOp(GLenum, GLuint); static MAGNUM_LOCAL std::string getLabelImplementationExt(GLenum identifier, GLuint name); static MAGNUM_LOCAL std::string getLabelImplementationKhr(GLenum identifier, GLuint name); diff --git a/src/Magnum/AbstractQuery.cpp b/src/Magnum/AbstractQuery.cpp index 87db20b7c..0feead69e 100644 --- a/src/Magnum/AbstractQuery.cpp +++ b/src/Magnum/AbstractQuery.cpp @@ -85,7 +85,7 @@ std::string AbstractQuery::label() const { #endif } -AbstractQuery& AbstractQuery::setLabelInternal(const Containers::ArrayReference label) { +AbstractQuery& AbstractQuery::setLabelInternal(const Containers::ArrayView label) { #ifndef MAGNUM_TARGET_GLES Context::current()->state().debug->labelImplementation(GL_QUERY, _id, label); #else diff --git a/src/Magnum/AbstractQuery.h b/src/Magnum/AbstractQuery.h index 43b0c3931..963c7a133 100644 --- a/src/Magnum/AbstractQuery.h +++ b/src/Magnum/AbstractQuery.h @@ -31,7 +31,7 @@ */ #endif -#include +#include #include #include "Magnum/AbstractObject.h" @@ -182,7 +182,7 @@ class MAGNUM_EXPORT AbstractQuery: public AbstractObject { private: #ifndef MAGNUM_TARGET_WEBGL - AbstractQuery& setLabelInternal(Containers::ArrayReference label); + AbstractQuery& setLabelInternal(Containers::ArrayView label); #endif void MAGNUM_LOCAL createImplementationDefault(); diff --git a/src/Magnum/AbstractShaderProgram.cpp b/src/Magnum/AbstractShaderProgram.cpp index dd0b01f73..61a9db3a9 100644 --- a/src/Magnum/AbstractShaderProgram.cpp +++ b/src/Magnum/AbstractShaderProgram.cpp @@ -25,6 +25,8 @@ #include "AbstractShaderProgram.h" +#include + #include "Magnum/Context.h" #include "Magnum/Extensions.h" #include "Magnum/Shader.h" @@ -259,7 +261,7 @@ std::string AbstractShaderProgram::label() const { #endif } -AbstractShaderProgram& AbstractShaderProgram::setLabelInternal(const Containers::ArrayReference label) { +AbstractShaderProgram& AbstractShaderProgram::setLabelInternal(const Containers::ArrayView label) { #ifndef MAGNUM_TARGET_GLES Context::current()->state().debug->labelImplementation(GL_PROGRAM, _id, label); #else @@ -301,21 +303,22 @@ void AbstractShaderProgram::attachShaders(std::initializer_list name) { +void AbstractShaderProgram::bindAttributeLocationInternal(const UnsignedInt location, const Containers::ArrayView name) { glBindAttribLocation(_id, location, name); } #ifndef MAGNUM_TARGET_GLES -void AbstractShaderProgram::bindFragmentDataLocationInternal(const UnsignedInt location, const Containers::ArrayReference name) { +void AbstractShaderProgram::bindFragmentDataLocationInternal(const UnsignedInt location, const Containers::ArrayView name) { glBindFragDataLocation(_id, location, name); } -void AbstractShaderProgram::bindFragmentDataLocationIndexedInternal(const UnsignedInt location, UnsignedInt index, const Containers::ArrayReference name) { +void AbstractShaderProgram::bindFragmentDataLocationIndexedInternal(const UnsignedInt location, UnsignedInt index, const Containers::ArrayView name) { glBindFragDataLocationIndexed(_id, location, index, name); } #endif #ifndef MAGNUM_TARGET_GLES2 void AbstractShaderProgram::setTransformFeedbackOutputs(const std::initializer_list outputs, const TransformFeedbackBufferMode bufferMode) { + /** @todo VLAs */ Containers::Array names{outputs.size()}; Int i = 0; @@ -392,7 +395,7 @@ bool AbstractShaderProgram::link(std::initializer_list name) { +Int AbstractShaderProgram::uniformLocationInternal(const Containers::ArrayView name) { GLint location = glGetUniformLocation(_id, name); if(location == -1) Warning() << "AbstractShaderProgram: location of uniform \'" + std::string{name, name.size()} + "\' cannot be retrieved!"; diff --git a/src/Magnum/AbstractShaderProgram.h b/src/Magnum/AbstractShaderProgram.h index f93a93095..be99fd661 100644 --- a/src/Magnum/AbstractShaderProgram.h +++ b/src/Magnum/AbstractShaderProgram.h @@ -31,7 +31,7 @@ #include #include -#include +#include #include "Magnum/AbstractObject.h" #include "Magnum/Attribute.h" @@ -387,7 +387,7 @@ comes in handy. @see @ref portability-shaders -@todo Use Containers::ArrayReference for setting uniform arrays? +@todo Use Containers::ArrayView for setting uniform arrays? @todo `GL_NUM_{PROGRAM,SHADER}_BINARY_FORMATS` + `GL_{PROGRAM,SHADER}_BINARY_FORMATS` (vector), (@extension{ARB,ES2_compatibility}) */ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject { @@ -994,13 +994,13 @@ class MAGNUM_EXPORT AbstractShaderProgram: public AbstractObject { private: #ifndef MAGNUM_TARGET_WEBGL - AbstractShaderProgram& setLabelInternal(Containers::ArrayReference label); + AbstractShaderProgram& setLabelInternal(Containers::ArrayView label); #endif - void bindAttributeLocationInternal(UnsignedInt location, Containers::ArrayReference name); - void bindFragmentDataLocationIndexedInternal(UnsignedInt location, UnsignedInt index, Containers::ArrayReference name); - void bindFragmentDataLocationInternal(UnsignedInt location, Containers::ArrayReference name); - Int uniformLocationInternal(Containers::ArrayReference name); + void bindAttributeLocationInternal(UnsignedInt location, Containers::ArrayView name); + void bindFragmentDataLocationIndexedInternal(UnsignedInt location, UnsignedInt index, Containers::ArrayView name); + void bindFragmentDataLocationInternal(UnsignedInt location, Containers::ArrayView name); + Int uniformLocationInternal(Containers::ArrayView name); #ifndef MAGNUM_BUILD_DEPRECATED void use(); diff --git a/src/Magnum/AbstractTexture.cpp b/src/Magnum/AbstractTexture.cpp index 90d2616b7..fdb78e83a 100644 --- a/src/Magnum/AbstractTexture.cpp +++ b/src/Magnum/AbstractTexture.cpp @@ -25,6 +25,8 @@ #include "AbstractTexture.h" +#include + #ifndef MAGNUM_TARGET_GLES2 #include "Magnum/BufferImage.h" #endif @@ -164,17 +166,18 @@ void AbstractTexture::bind(const Int firstTextureUnit, std::initializer_liststate().texture->bindMultiImplementation(firstTextureUnit, {textures.begin(), textures.size()}); } -void AbstractTexture::bindImplementationFallback(const GLint firstTextureUnit, const Containers::ArrayReference textures) { +void AbstractTexture::bindImplementationFallback(const GLint firstTextureUnit, const Containers::ArrayView textures) { for(std::size_t i = 0; i != textures.size(); ++i) textures && textures[i] ? textures[i]->bind(firstTextureUnit + i) : unbind(firstTextureUnit + i); } #ifndef MAGNUM_TARGET_GLES -/** @todoc const Containers::ArrayReference makes Doxygen grumpy */ -void AbstractTexture::bindImplementationMulti(const GLint firstTextureUnit, Containers::ArrayReference textures) { +/** @todoc const Containers::ArrayView makes Doxygen grumpy */ +void AbstractTexture::bindImplementationMulti(const GLint firstTextureUnit, Containers::ArrayView textures) { Implementation::TextureState& textureState = *Context::current()->state().texture; /* Create array of IDs and also update bindings in state tracker */ + /** @todo VLAs */ Containers::Array ids{textures ? textures.size() : 0}; bool different = false; for(std::size_t i = 0; i != textures.size(); ++i) { @@ -241,7 +244,7 @@ std::string AbstractTexture::label() { return Context::current()->state().debug->getLabelImplementation(GL_TEXTURE, _id); } -AbstractTexture& AbstractTexture::setLabelInternal(const Containers::ArrayReference label) { +AbstractTexture& AbstractTexture::setLabelInternal(const Containers::ArrayView label) { createIfNotAlready(); Context::current()->state().debug->labelImplementation(GL_TEXTURE, _id, label); return *this; diff --git a/src/Magnum/AbstractTexture.h b/src/Magnum/AbstractTexture.h index 1380fd526..c91e4404b 100644 --- a/src/Magnum/AbstractTexture.h +++ b/src/Magnum/AbstractTexture.h @@ -29,7 +29,7 @@ * @brief Class @ref Magnum::AbstractTexture */ -#include +#include #include "Magnum/AbstractObject.h" #include "Magnum/DimensionTraits.h" @@ -343,7 +343,7 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject { explicit AbstractTexture(GLuint id, GLenum target, ObjectFlags flags) noexcept: _target{target}, _id{id}, _flags{flags} {} #ifndef MAGNUM_TARGET_WEBGL - AbstractTexture& setLabelInternal(Containers::ArrayReference label); + AbstractTexture& setLabelInternal(Containers::ArrayView label); #endif /* Unlike bind() this also sets the texture binding unit as active */ @@ -413,9 +413,9 @@ class MAGNUM_EXPORT AbstractTexture: public AbstractObject { static void MAGNUM_LOCAL unbindImplementationDSAEXT(GLint textureUnit); #endif - static void MAGNUM_LOCAL bindImplementationFallback(GLint firstTextureUnit, Containers::ArrayReference textures); + static void MAGNUM_LOCAL bindImplementationFallback(GLint firstTextureUnit, Containers::ArrayView textures); #ifndef MAGNUM_TARGET_GLES - static void MAGNUM_LOCAL bindImplementationMulti(GLint firstTextureUnit, Containers::ArrayReference textures); + static void MAGNUM_LOCAL bindImplementationMulti(GLint firstTextureUnit, Containers::ArrayView textures); #endif void MAGNUM_LOCAL createImplementationDefault(); diff --git a/src/Magnum/Audio/AbstractImporter.cpp b/src/Magnum/Audio/AbstractImporter.cpp index eef56d76f..ebd6df0d0 100644 --- a/src/Magnum/Audio/AbstractImporter.cpp +++ b/src/Magnum/Audio/AbstractImporter.cpp @@ -35,7 +35,7 @@ AbstractImporter::AbstractImporter() = default; AbstractImporter::AbstractImporter(PluginManager::AbstractManager& manager, std::string plugin): PluginManager::AbstractPlugin(manager, std::move(plugin)) {} -bool AbstractImporter::openData(Containers::ArrayReference data) { +bool AbstractImporter::openData(Containers::ArrayView data) { CORRADE_ASSERT(features() & Feature::OpenData, "Audio::AbstractImporter::openData(): feature not supported", {}); @@ -44,7 +44,7 @@ bool AbstractImporter::openData(Containers::ArrayReference data) { return isOpened(); } -void AbstractImporter::doOpenData(Containers::ArrayReference) { +void AbstractImporter::doOpenData(Containers::ArrayView) { CORRADE_ASSERT(false, "Audio::AbstractImporter::openData(): feature advertised but not implemented", ); } diff --git a/src/Magnum/Audio/AbstractImporter.h b/src/Magnum/Audio/AbstractImporter.h index 7ecc338c4..3b39c3072 100644 --- a/src/Magnum/Audio/AbstractImporter.h +++ b/src/Magnum/Audio/AbstractImporter.h @@ -103,7 +103,7 @@ class MAGNUM_AUDIO_EXPORT AbstractImporter: public PluginManager::AbstractPlugin * `true` on success, `false` otherwise. * @see @ref features(), @ref openFile() */ - bool openData(Containers::ArrayReference data); + bool openData(Containers::ArrayView data); /** * @brief Open file @@ -142,7 +142,7 @@ class MAGNUM_AUDIO_EXPORT AbstractImporter: public PluginManager::AbstractPlugin virtual bool doIsOpened() const = 0; /** @brief Implementation for @ref openData() */ - virtual void doOpenData(Containers::ArrayReference data); + virtual void doOpenData(Containers::ArrayView data); /** * @brief Implementation for @ref openFile() diff --git a/src/Magnum/Audio/Buffer.h b/src/Magnum/Audio/Buffer.h index 5d33e90ca..5839407f1 100644 --- a/src/Magnum/Audio/Buffer.h +++ b/src/Magnum/Audio/Buffer.h @@ -31,7 +31,7 @@ #include #include -#include +#include #include "Magnum/Magnum.h" #include "Magnum/Audio/visibility.h" @@ -95,7 +95,7 @@ class Buffer { * * @see @fn_al{BufferData} */ - Buffer& setData(Format format, Containers::ArrayReference data, ALsizei frequency) { + Buffer& setData(Format format, Containers::ArrayView data, ALsizei frequency) { alBufferData(_id, ALenum(format), data, data.size(), frequency); return *this; } diff --git a/src/Magnum/Audio/Test/AbstractImporterTest.cpp b/src/Magnum/Audio/Test/AbstractImporterTest.cpp index 0e8af085d..7233e9994 100644 --- a/src/Magnum/Audio/Test/AbstractImporterTest.cpp +++ b/src/Magnum/Audio/Test/AbstractImporterTest.cpp @@ -53,7 +53,7 @@ void AbstractImporterTest::openFile() { bool doIsOpened() const override { return opened; } void doClose() override {} - void doOpenData(Containers::ArrayReference data) override { + void doOpenData(Containers::ArrayView data) override { opened = (data.size() == 1 && data[0] == '\xa5'); } diff --git a/src/Magnum/Buffer.cpp b/src/Magnum/Buffer.cpp index fdfe6b685..86c29197d 100644 --- a/src/Magnum/Buffer.cpp +++ b/src/Magnum/Buffer.cpp @@ -25,6 +25,7 @@ #include "Buffer.h" +#include #include #include "Magnum/Context.h" @@ -239,7 +240,7 @@ std::string Buffer::label() { #endif } -Buffer& Buffer::setLabelInternal(const Containers::ArrayReference label) { +Buffer& Buffer::setLabelInternal(const Containers::ArrayView label) { createIfNotAlready(); #ifndef MAGNUM_TARGET_GLES Context::current()->state().debug->labelImplementation(GL_BUFFER, _id, label); @@ -318,12 +319,12 @@ Int Buffer::size() { return size; } -Buffer& Buffer::setData(const Containers::ArrayReference data, const BufferUsage usage) { +Buffer& Buffer::setData(const Containers::ArrayView data, const BufferUsage usage) { (this->*Context::current()->state().buffer->dataImplementation)(data.size(), data, usage); return *this; } -Buffer& Buffer::setSubData(const GLintptr offset, const Containers::ArrayReference data) { +Buffer& Buffer::setSubData(const GLintptr offset, const Containers::ArrayView data) { (this->*Context::current()->state().buffer->subDataImplementation)(offset, data.size(), data); return *this; } @@ -377,7 +378,7 @@ void Buffer::subDataInternal(GLintptr offset, GLsizeiptr size, GLvoid* data) { #endif #ifndef MAGNUM_TARGET_GLES2 -void Buffer::bindImplementationFallback(const Target target, const GLuint firstIndex, Containers::ArrayReference buffers) { +void Buffer::bindImplementationFallback(const Target target, const GLuint firstIndex, Containers::ArrayView buffers) { for(std::size_t i = 0; i != buffers.size(); ++i) { if(buffers && buffers[i]) buffers[i]->bind(target, firstIndex + i); else unbind(target, firstIndex + i); @@ -385,7 +386,8 @@ void Buffer::bindImplementationFallback(const Target target, const GLuint firstI } #ifndef MAGNUM_TARGET_GLES -void Buffer::bindImplementationMulti(const Target target, const GLuint firstIndex, Containers::ArrayReference buffers) { +void Buffer::bindImplementationMulti(const Target target, const GLuint firstIndex, Containers::ArrayView buffers) { + /** @todo C++1z: VLAs? */ Containers::Array ids{buffers ? buffers.size() : 0}; if(buffers) for(std::size_t i = 0; i != buffers.size(); ++i) { if(buffers[i]) { @@ -400,8 +402,8 @@ void Buffer::bindImplementationMulti(const Target target, const GLuint firstInde } #endif -/** @todoc const Containers::ArrayReference makes Doxygen grumpy */ -void Buffer::bindImplementationFallback(const Target target, const GLuint firstIndex, Containers::ArrayReference> buffers) { +/** @todoc const Containers::ArrayView makes Doxygen grumpy */ +void Buffer::bindImplementationFallback(const Target target, const GLuint firstIndex, Containers::ArrayView> buffers) { for(std::size_t i = 0; i != buffers.size(); ++i) { if(buffers && std::get<0>(buffers[i])) std::get<0>(buffers[i])->bind(target, firstIndex + i, std::get<1>(buffers[i]), std::get<2>(buffers[i])); @@ -410,8 +412,8 @@ void Buffer::bindImplementationFallback(const Target target, const GLuint firstI } #ifndef MAGNUM_TARGET_GLES -/** @todoc const Containers::ArrayReference makes Doxygen grumpy */ -void Buffer::bindImplementationMulti(const Target target, const GLuint firstIndex, Containers::ArrayReference> buffers) { +/** @todoc const Containers::ArrayView makes Doxygen grumpy */ +void Buffer::bindImplementationMulti(const Target target, const GLuint firstIndex, Containers::ArrayView> buffers) { /** @todo use ArrayTuple */ Containers::Array ids{buffers ? buffers.size() : 0}; Containers::Array offsetsSizes{buffers ? buffers.size()*2 : 0}; diff --git a/src/Magnum/Buffer.h b/src/Magnum/Buffer.h index 09617690a..ed5b72100 100644 --- a/src/Magnum/Buffer.h +++ b/src/Magnum/Buffer.h @@ -48,7 +48,7 @@ namespace Magnum { /** @brief Buffer usage -@see @ref Buffer, @ref Buffer::setData(Containers::ArrayReference, BufferUsage) +@see @ref Buffer, @ref Buffer::setData(Containers::ArrayView, BufferUsage) */ enum class BufferUsage: GLenum { /** Set once by the application and used infrequently for drawing. */ @@ -141,10 +141,10 @@ data updates. ## Data updating Default way to set or update buffer data with @ref setData() or @ref setSubData() -is to use @ref Corrade::Containers::ArrayReference. See its documentation for +is to use @ref Corrade::Containers::ArrayView. See its documentation for more information about automatic conversions etc. @code -Containers::ArrayReference data; +Containers::ArrayView data; buffer.setData(data, BufferUsage::StaticDraw); @endcode There is also overload for array-like containers from STL, such as `std::vector` @@ -1086,7 +1086,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject { * @fn_gl_extension{NamedBufferData,EXT,direct_state_access}, * eventually @fn_gl{BindBuffer} and @fn_gl{BufferData} */ - Buffer& setData(Containers::ArrayReference data, BufferUsage usage); + Buffer& setData(Containers::ArrayView data, BufferUsage usage); /** @overload */ template Buffer& setData(const std::vector& data, BufferUsage usage) { @@ -1114,7 +1114,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject { * @fn_gl_extension{NamedBufferSubData,EXT,direct_state_access}, * eventually @fn_gl{BindBuffer} and @fn_gl{BufferSubData} */ - Buffer& setSubData(GLintptr offset, Containers::ArrayReference data); + Buffer& setSubData(GLintptr offset, Containers::ArrayView data); /** @overload */ template Buffer& setSubData(GLintptr offset, const std::vector& data) { @@ -1310,14 +1310,14 @@ class MAGNUM_EXPORT Buffer: public AbstractObject { TargetHint MAGNUM_LOCAL bindSomewhereInternal(TargetHint hint); #ifndef MAGNUM_TARGET_GLES2 - static void MAGNUM_LOCAL bindImplementationFallback(Target target, GLuint firstIndex, Containers::ArrayReference buffers); + static void MAGNUM_LOCAL bindImplementationFallback(Target target, GLuint firstIndex, Containers::ArrayView buffers); #ifndef MAGNUM_TARGET_GLES - static void MAGNUM_LOCAL bindImplementationMulti(Target target, GLuint firstIndex, Containers::ArrayReference buffers); + static void MAGNUM_LOCAL bindImplementationMulti(Target target, GLuint firstIndex, Containers::ArrayView buffers); #endif - static void MAGNUM_LOCAL bindImplementationFallback(Target target, GLuint firstIndex, Containers::ArrayReference> buffers); + static void MAGNUM_LOCAL bindImplementationFallback(Target target, GLuint firstIndex, Containers::ArrayView> buffers); #ifndef MAGNUM_TARGET_GLES - static void MAGNUM_LOCAL bindImplementationMulti(Target target, GLuint firstIndex, Containers::ArrayReference> buffers); + static void MAGNUM_LOCAL bindImplementationMulti(Target target, GLuint firstIndex, Containers::ArrayView> buffers); #endif static void MAGNUM_LOCAL copyImplementationDefault(Buffer& read, Buffer& write, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); @@ -1337,7 +1337,7 @@ class MAGNUM_EXPORT Buffer: public AbstractObject { void MAGNUM_LOCAL createIfNotAlready(); #ifndef MAGNUM_TARGET_WEBGL - Buffer& setLabelInternal(Containers::ArrayReference label); + Buffer& setLabelInternal(Containers::ArrayView label); #endif #ifndef MAGNUM_TARGET_GLES diff --git a/src/Magnum/DebugOutput.cpp b/src/Magnum/DebugOutput.cpp index f75786675..d00cb4ed8 100644 --- a/src/Magnum/DebugOutput.cpp +++ b/src/Magnum/DebugOutput.cpp @@ -272,13 +272,13 @@ Debug operator<<(Debug debug, const DebugOutput::Severity value) { } #endif -void DebugMessage::insertInternal(const Source source, const Type type, const UnsignedInt id, const DebugOutput::Severity severity, const Containers::ArrayReference string) { +void DebugMessage::insertInternal(const Source source, const Type type, const UnsignedInt id, const DebugOutput::Severity severity, const Containers::ArrayView string) { Context::current()->state().debug->messageInsertImplementation(source, type, id, severity, string); } -void DebugMessage::insertImplementationNoOp(Source, Type, UnsignedInt, DebugOutput::Severity, const Containers::ArrayReference) {} +void DebugMessage::insertImplementationNoOp(Source, Type, UnsignedInt, DebugOutput::Severity, const Containers::ArrayView) {} -void DebugMessage::insertImplementationKhr(const Source source, const Type type, const UnsignedInt id, const DebugOutput::Severity severity, const Containers::ArrayReference string) { +void DebugMessage::insertImplementationKhr(const Source source, const Type type, const UnsignedInt id, const DebugOutput::Severity severity, const Containers::ArrayView string) { #ifndef CORRADE_TARGET_NACL #ifndef MAGNUM_TARGET_GLES glDebugMessageInsert @@ -296,7 +296,7 @@ void DebugMessage::insertImplementationKhr(const Source source, const Type type, #endif } -void DebugMessage::insertImplementationExt(Source, Type, UnsignedInt, DebugOutput::Severity, const Containers::ArrayReference string) { +void DebugMessage::insertImplementationExt(Source, Type, UnsignedInt, DebugOutput::Severity, const Containers::ArrayView string) { #ifndef CORRADE_TARGET_NACL glInsertEventMarkerEXT(string.size(), string.data()); #else @@ -306,7 +306,7 @@ void DebugMessage::insertImplementationExt(Source, Type, UnsignedInt, DebugOutpu } #ifndef MAGNUM_TARGET_GLES -void DebugMessage::insertImplementationGremedy(Source, Type, UnsignedInt, DebugOutput::Severity, const Containers::ArrayReference string) { +void DebugMessage::insertImplementationGremedy(Source, Type, UnsignedInt, DebugOutput::Severity, const Containers::ArrayView string) { glStringMarkerGREMEDY(string.size(), string.data()); } #endif @@ -364,7 +364,7 @@ Int DebugGroup::maxStackDepth() { return value; } -void DebugGroup::pushInternal(const Source source, const UnsignedInt id, const Containers::ArrayReference message) { +void DebugGroup::pushInternal(const Source source, const UnsignedInt id, const Containers::ArrayView message) { CORRADE_ASSERT(!_active, "DebugGroup::push(): group is already active", ); Context::current()->state().debug->pushGroupImplementation(source, id, message); _active = true; @@ -376,9 +376,9 @@ void DebugGroup::pop() { _active = false; } -void DebugGroup::pushImplementationNoOp(Source, UnsignedInt, Containers::ArrayReference) {} +void DebugGroup::pushImplementationNoOp(Source, UnsignedInt, Containers::ArrayView) {} -void DebugGroup::pushImplementationKhr(const Source source, const UnsignedInt id, const Containers::ArrayReference message) { +void DebugGroup::pushImplementationKhr(const Source source, const UnsignedInt id, const Containers::ArrayView message) { #ifndef CORRADE_TARGET_NACL #ifndef MAGNUM_TARGET_GLES glPushDebugGroup @@ -394,7 +394,7 @@ void DebugGroup::pushImplementationKhr(const Source source, const UnsignedInt id #endif } -void DebugGroup::pushImplementationExt(Source, UnsignedInt, const Containers::ArrayReference message) { +void DebugGroup::pushImplementationExt(Source, UnsignedInt, const Containers::ArrayView message) { #ifndef CORRADE_TARGET_NACL glPushGroupMarkerEXT(message.size(), message.data()); #else diff --git a/src/Magnum/DebugOutput.h b/src/Magnum/DebugOutput.h index eb59569df..b7570a7e8 100644 --- a/src/Magnum/DebugOutput.h +++ b/src/Magnum/DebugOutput.h @@ -32,7 +32,7 @@ #endif #include -#include +#include #include "Magnum/OpenGL.h" #include "Magnum/Magnum.h" @@ -675,12 +675,12 @@ class MAGNUM_EXPORT DebugMessage { DebugMessage() = delete; private: - static void insertInternal(Source source, Type type, UnsignedInt id, DebugOutput::Severity severity, Containers::ArrayReference string); - static MAGNUM_LOCAL void insertImplementationNoOp(Source, Type, UnsignedInt, DebugOutput::Severity, Containers::ArrayReference); - static MAGNUM_LOCAL void insertImplementationKhr(Source source, Type type, UnsignedInt id, DebugOutput::Severity severity, Containers::ArrayReference string); - static MAGNUM_LOCAL void insertImplementationExt(Source, Type, UnsignedInt, DebugOutput::Severity, Containers::ArrayReference string); + static void insertInternal(Source source, Type type, UnsignedInt id, DebugOutput::Severity severity, Containers::ArrayView string); + static MAGNUM_LOCAL void insertImplementationNoOp(Source, Type, UnsignedInt, DebugOutput::Severity, Containers::ArrayView); + static MAGNUM_LOCAL void insertImplementationKhr(Source source, Type type, UnsignedInt id, DebugOutput::Severity severity, Containers::ArrayView string); + static MAGNUM_LOCAL void insertImplementationExt(Source, Type, UnsignedInt, DebugOutput::Severity, Containers::ArrayView string); #ifndef MAGNUM_TARGET_GLES - static MAGNUM_LOCAL void insertImplementationGremedy(Source, Type, UnsignedInt, DebugOutput::Severity, Containers::ArrayReference string); + static MAGNUM_LOCAL void insertImplementationGremedy(Source, Type, UnsignedInt, DebugOutput::Severity, Containers::ArrayView string); #endif }; @@ -880,11 +880,11 @@ class MAGNUM_EXPORT DebugGroup { void pop(); private: - void pushInternal(Source source, UnsignedInt id, Containers::ArrayReference message); + void pushInternal(Source source, UnsignedInt id, Containers::ArrayView message); - static MAGNUM_LOCAL void pushImplementationNoOp(Source source, UnsignedInt id, Containers::ArrayReference message); - static MAGNUM_LOCAL void pushImplementationKhr(Source source, UnsignedInt id, Containers::ArrayReference message); - static MAGNUM_LOCAL void pushImplementationExt(Source source, UnsignedInt id, Containers::ArrayReference message); + static MAGNUM_LOCAL void pushImplementationNoOp(Source source, UnsignedInt id, Containers::ArrayView message); + static MAGNUM_LOCAL void pushImplementationKhr(Source source, UnsignedInt id, Containers::ArrayView message); + static MAGNUM_LOCAL void pushImplementationExt(Source source, UnsignedInt id, Containers::ArrayView message); static MAGNUM_LOCAL void popImplementationNoOp(); static MAGNUM_LOCAL void popImplementationKhr(); diff --git a/src/Magnum/Framebuffer.cpp b/src/Magnum/Framebuffer.cpp index 2f2d4e2f4..fdb9c20e8 100644 --- a/src/Magnum/Framebuffer.cpp +++ b/src/Magnum/Framebuffer.cpp @@ -140,7 +140,7 @@ std::string Framebuffer::label() { return Context::current()->state().debug->getLabelImplementation(GL_FRAMEBUFFER, _id); } -Framebuffer& Framebuffer::setLabelInternal(const Containers::ArrayReference label) { +Framebuffer& Framebuffer::setLabelInternal(const Containers::ArrayView label) { createIfNotAlready(); Context::current()->state().debug->labelImplementation(GL_FRAMEBUFFER, _id, label); return *this; diff --git a/src/Magnum/Framebuffer.h b/src/Magnum/Framebuffer.h index 6bd092ac2..4f06e2b05 100644 --- a/src/Magnum/Framebuffer.h +++ b/src/Magnum/Framebuffer.h @@ -722,7 +722,7 @@ class MAGNUM_EXPORT Framebuffer: public AbstractFramebuffer, public AbstractObje #endif #ifndef MAGNUM_TARGET_WEBGL - Framebuffer& setLabelInternal(Containers::ArrayReference label); + Framebuffer& setLabelInternal(Containers::ArrayView label); #endif void MAGNUM_LOCAL renderbufferImplementationDefault(BufferAttachment attachment, Renderbuffer& renderbuffer); diff --git a/src/Magnum/Implementation/BufferState.h b/src/Magnum/Implementation/BufferState.h index 875c9bef8..7b0190edd 100644 --- a/src/Magnum/Implementation/BufferState.h +++ b/src/Magnum/Implementation/BufferState.h @@ -49,8 +49,8 @@ struct BufferState { void reset(); #ifndef MAGNUM_TARGET_GLES2 - void(*bindBasesImplementation)(Buffer::Target, UnsignedInt, Containers::ArrayReference); - void(*bindRangesImplementation)(Buffer::Target, UnsignedInt, Containers::ArrayReference>); + void(*bindBasesImplementation)(Buffer::Target, UnsignedInt, Containers::ArrayView); + void(*bindRangesImplementation)(Buffer::Target, UnsignedInt, Containers::ArrayView>); void(*copyImplementation)(Buffer&, Buffer&, GLintptr, GLintptr, GLsizeiptr); #endif void(Buffer::*createImplementation)(); diff --git a/src/Magnum/Implementation/DebugState.h b/src/Magnum/Implementation/DebugState.h index 1199fc465..599332190 100644 --- a/src/Magnum/Implementation/DebugState.h +++ b/src/Magnum/Implementation/DebugState.h @@ -40,12 +40,12 @@ struct DebugState { explicit DebugState(Context& context, std::vector& extensions); std::string(*getLabelImplementation)(GLenum, GLuint); - void(*labelImplementation)(GLenum, GLuint, Containers::ArrayReference); + void(*labelImplementation)(GLenum, GLuint, Containers::ArrayView); - void(*messageInsertImplementation)(DebugMessage::Source, DebugMessage::Type, UnsignedInt, DebugOutput::Severity, Containers::ArrayReference); + void(*messageInsertImplementation)(DebugMessage::Source, DebugMessage::Type, UnsignedInt, DebugOutput::Severity, Containers::ArrayView); void(*controlImplementation)(GLenum, GLenum, GLenum, std::initializer_list, bool); void(*callbackImplementation)(DebugOutput::Callback, const void*); - void(*pushGroupImplementation)(DebugGroup::Source, UnsignedInt, Containers::ArrayReference); + void(*pushGroupImplementation)(DebugGroup::Source, UnsignedInt, Containers::ArrayView); void(*popGroupImplementation)(); GLint maxLabelLength, maxLoggedMessages, maxMessageLength, maxStackDepth; diff --git a/src/Magnum/Implementation/TextureState.h b/src/Magnum/Implementation/TextureState.h index 44b1454d6..348887ebb 100644 --- a/src/Magnum/Implementation/TextureState.h +++ b/src/Magnum/Implementation/TextureState.h @@ -39,7 +39,7 @@ struct TextureState { void reset(); void(*unbindImplementation)(GLint); - void(*bindMultiImplementation)(GLint, Containers::ArrayReference); + void(*bindMultiImplementation)(GLint, Containers::ArrayView); void(AbstractTexture::*createImplementation)(); void(AbstractTexture::*bindImplementation)(GLint); void(AbstractTexture::*parameteriImplementation)(GLenum, GLint); diff --git a/src/Magnum/Mesh.cpp b/src/Magnum/Mesh.cpp index 5d00a29b4..70ca9dc03 100644 --- a/src/Magnum/Mesh.cpp +++ b/src/Magnum/Mesh.cpp @@ -199,7 +199,7 @@ std::string Mesh::label() { #endif } -Mesh& Mesh::setLabelInternal(const Containers::ArrayReference label) { +Mesh& Mesh::setLabelInternal(const Containers::ArrayView label) { createIfNotAlready(); #ifndef MAGNUM_TARGET_GLES Context::current()->state().debug->labelImplementation(GL_VERTEX_ARRAY, _id, label); diff --git a/src/Magnum/Mesh.h b/src/Magnum/Mesh.h index 075b1f703..f401b741d 100644 --- a/src/Magnum/Mesh.h +++ b/src/Magnum/Mesh.h @@ -30,7 +30,7 @@ */ #include -#include +#include #include #include "Magnum/AbstractObject.h" @@ -884,7 +884,7 @@ class MAGNUM_EXPORT Mesh: public AbstractObject { void MAGNUM_LOCAL createIfNotAlready(); #ifndef MAGNUM_TARGET_WEBGL - Mesh& setLabelInternal(Containers::ArrayReference label); + Mesh& setLabelInternal(Containers::ArrayView label); #endif /* Computing stride of interleaved vertex attributes */ diff --git a/src/Magnum/MeshTools/Interleave.h b/src/Magnum/MeshTools/Interleave.h index f1561c588..49a493889 100644 --- a/src/Magnum/MeshTools/Interleave.h +++ b/src/Magnum/MeshTools/Interleave.h @@ -162,7 +162,7 @@ parameters. arrays have the same size. The passed buffer must also be large enough to contain the interleaved data. */ -template void interleaveInto(Containers::ArrayReference buffer, const T& first, const U&... next) { +template void interleaveInto(Containers::ArrayView buffer, const T& first, const U&... next) { /* Verify expected buffer size */ const std::size_t attributeCount = Implementation::AttributeCount{}(first, next...); const std::size_t stride = Implementation::Stride{}(first, next...); diff --git a/src/Magnum/Renderbuffer.cpp b/src/Magnum/Renderbuffer.cpp index 9544dae19..9872f7dee 100644 --- a/src/Magnum/Renderbuffer.cpp +++ b/src/Magnum/Renderbuffer.cpp @@ -111,7 +111,7 @@ std::string Renderbuffer::label() { return Context::current()->state().debug->getLabelImplementation(GL_RENDERBUFFER, _id); } -Renderbuffer& Renderbuffer::setLabelInternal(const Containers::ArrayReference label) { +Renderbuffer& Renderbuffer::setLabelInternal(const Containers::ArrayView label) { createIfNotAlready(); Context::current()->state().debug->labelImplementation(GL_RENDERBUFFER, _id, label); return *this; diff --git a/src/Magnum/Renderbuffer.h b/src/Magnum/Renderbuffer.h index 849af7a9a..d387f36be 100644 --- a/src/Magnum/Renderbuffer.h +++ b/src/Magnum/Renderbuffer.h @@ -29,7 +29,7 @@ * @brief Class @ref Magnum::Renderbuffer */ -#include +#include #include "Magnum/AbstractObject.h" #include "Magnum/Magnum.h" @@ -235,7 +235,7 @@ class MAGNUM_EXPORT Renderbuffer: public AbstractObject { void MAGNUM_LOCAL createIfNotAlready(); #ifndef MAGNUM_TARGET_WEBGL - Renderbuffer& setLabelInternal(Containers::ArrayReference label); + Renderbuffer& setLabelInternal(Containers::ArrayView label); #endif void MAGNUM_LOCAL storageImplementationDefault(RenderbufferFormat internalFormat, const Vector2i& size); diff --git a/src/Magnum/Shader.cpp b/src/Magnum/Shader.cpp index d7fe70f10..5b2593cb8 100644 --- a/src/Magnum/Shader.cpp +++ b/src/Magnum/Shader.cpp @@ -662,7 +662,7 @@ std::string Shader::label() const { #endif } -Shader& Shader::setLabelInternal(const Containers::ArrayReference label) { +Shader& Shader::setLabelInternal(const Containers::ArrayView label) { #ifndef MAGNUM_TARGET_GLES Context::current()->state().debug->labelImplementation(GL_SHADER, _id, label); #else @@ -715,6 +715,7 @@ bool Shader::compile(std::initializer_list> shade CORRADE_ASSERT(shader._sources.size() > 1, "Shader::compile(): no files added", false); maxSourceCount = std::max(shader._sources.size(), maxSourceCount); } + /** @todo ArrayTuple/VLAs */ Containers::Array pointers(maxSourceCount); Containers::Array sizes(maxSourceCount); diff --git a/src/Magnum/Shader.h b/src/Magnum/Shader.h index b572b4bcd..4f4e84107 100644 --- a/src/Magnum/Shader.h +++ b/src/Magnum/Shader.h @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include "Magnum/AbstractObject.h" #include "Magnum/Magnum.h" @@ -587,7 +587,7 @@ class MAGNUM_EXPORT Shader: public AbstractObject { bool compile() { return compile({*this}); } private: - Shader& setLabelInternal(Containers::ArrayReference label); + Shader& setLabelInternal(Containers::ArrayView label); Type _type; GLuint _id; diff --git a/src/Magnum/Test/CubeMapTextureArrayGLTest.cpp b/src/Magnum/Test/CubeMapTextureArrayGLTest.cpp index ceaa84182..9cee85630 100644 --- a/src/Magnum/Test/CubeMapTextureArrayGLTest.cpp +++ b/src/Magnum/Test/CubeMapTextureArrayGLTest.cpp @@ -276,8 +276,8 @@ void CubeMapTextureArrayGLTest::image() { CORRADE_COMPARE(image.size(), Vector3i(2, 2, 6)); CORRADE_COMPARE_AS( - Containers::ArrayReference(image.data(), image.pixelSize()*image.size().product()), - Containers::ArrayReference{Data}, TestSuite::Compare::Container); + Containers::ArrayView(image.data(), image.pixelSize()*image.size().product()), + Containers::ArrayView{Data}, TestSuite::Compare::Container); } void CubeMapTextureArrayGLTest::imageBuffer() { @@ -296,7 +296,7 @@ void CubeMapTextureArrayGLTest::imageBuffer() { MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(image.size(), Vector3i(2, 2, 6)); - CORRADE_COMPARE_AS(imageData, Containers::ArrayReference{Data}, TestSuite::Compare::Container); + CORRADE_COMPARE_AS(imageData, Containers::ArrayView{Data}, TestSuite::Compare::Container); } namespace { @@ -367,8 +367,8 @@ void CubeMapTextureArrayGLTest::subImage() { CORRADE_COMPARE(image.size(), Vector3i(4, 4, 6)); CORRADE_COMPARE_AS( - Containers::ArrayReference(image.data(), image.pixelSize()*image.size().product()), - Containers::ArrayReference{SubDataComplete}, TestSuite::Compare::Container); + Containers::ArrayView(image.data(), image.pixelSize()*image.size().product()), + Containers::ArrayView{SubDataComplete}, TestSuite::Compare::Container); } void CubeMapTextureArrayGLTest::subImageBuffer() { @@ -389,7 +389,7 @@ void CubeMapTextureArrayGLTest::subImageBuffer() { MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(image.size(), Vector3i(4, 4, 6)); - CORRADE_COMPARE_AS(imageData, Containers::ArrayReference{SubDataComplete}, TestSuite::Compare::Container); + CORRADE_COMPARE_AS(imageData, Containers::ArrayView{SubDataComplete}, TestSuite::Compare::Container); } void CubeMapTextureArrayGLTest::subImageQuery() { @@ -410,8 +410,8 @@ void CubeMapTextureArrayGLTest::subImageQuery() { CORRADE_COMPARE(image.size(), Vector3i(2, 2, 4)); CORRADE_COMPARE_AS( - Containers::ArrayReference(image.data(), image.pixelSize()*image.size().product()), - Containers::ArrayReference{SubData}, TestSuite::Compare::Container); + Containers::ArrayView(image.data(), image.pixelSize()*image.size().product()), + Containers::ArrayView{SubData}, TestSuite::Compare::Container); } void CubeMapTextureArrayGLTest::subImageQueryBuffer() { @@ -432,7 +432,7 @@ void CubeMapTextureArrayGLTest::subImageQueryBuffer() { MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(image.size(), Vector3i(2, 2, 4)); - CORRADE_COMPARE_AS(imageData, Containers::ArrayReference{SubData}, TestSuite::Compare::Container); + CORRADE_COMPARE_AS(imageData, Containers::ArrayView{SubData}, TestSuite::Compare::Container); } void CubeMapTextureArrayGLTest::generateMipmap() { diff --git a/src/Magnum/Test/CubeMapTextureGLTest.cpp b/src/Magnum/Test/CubeMapTextureGLTest.cpp index 78fda7839..6d9adf2a8 100644 --- a/src/Magnum/Test/CubeMapTextureGLTest.cpp +++ b/src/Magnum/Test/CubeMapTextureGLTest.cpp @@ -361,8 +361,8 @@ void CubeMapTextureGLTest::imageFull() { CORRADE_COMPARE(image.size(), Vector3i(2, 2, 6)); CORRADE_COMPARE_AS( - Containers::ArrayReference(image.data(), image.pixelSize()*image.size().product()), - Containers::ArrayReference{DataFull}, TestSuite::Compare::Container); + Containers::ArrayView(image.data(), image.pixelSize()*image.size().product()), + Containers::ArrayView{DataFull}, TestSuite::Compare::Container); } void CubeMapTextureGLTest::imageFullBuffer() { @@ -381,7 +381,7 @@ void CubeMapTextureGLTest::imageFullBuffer() { CORRADE_COMPARE(image.size(), Vector3i(2, 2, 6)); const auto imageData = image.buffer().data(); - CORRADE_COMPARE_AS(imageData, Containers::ArrayReference{DataFull}, TestSuite::Compare::Container); + CORRADE_COMPARE_AS(imageData, Containers::ArrayView{DataFull}, TestSuite::Compare::Container); } #endif @@ -407,8 +407,8 @@ void CubeMapTextureGLTest::image() { CORRADE_COMPARE(image.size(), Vector2i(2)); CORRADE_COMPARE_AS( - Containers::ArrayReference(image.data(), image.pixelSize()*image.size().product()), - Containers::ArrayReference{Data}, TestSuite::Compare::Container); + Containers::ArrayView(image.data(), image.pixelSize()*image.size().product()), + Containers::ArrayView{Data}, TestSuite::Compare::Container); #endif } @@ -428,7 +428,7 @@ void CubeMapTextureGLTest::imageBuffer() { MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(image.size(), Vector2i(2)); - CORRADE_COMPARE_AS(imageData, Containers::ArrayReference{Data}, TestSuite::Compare::Container); + CORRADE_COMPARE_AS(imageData, Containers::ArrayView{Data}, TestSuite::Compare::Container); #endif } #endif @@ -460,8 +460,8 @@ void CubeMapTextureGLTest::subImage() { CORRADE_COMPARE(image.size(), Vector2i(4)); CORRADE_COMPARE_AS( - Containers::ArrayReference(image.data(), image.pixelSize()*image.size().product()), - Containers::ArrayReference{SubDataComplete}, TestSuite::Compare::Container); + Containers::ArrayView(image.data(), image.pixelSize()*image.size().product()), + Containers::ArrayView{SubDataComplete}, TestSuite::Compare::Container); #endif } @@ -483,7 +483,7 @@ void CubeMapTextureGLTest::subImageBuffer() { MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(image.size(), Vector2i(4)); - CORRADE_COMPARE_AS(imageData, Containers::ArrayReference{SubDataComplete}, TestSuite::Compare::Container); + CORRADE_COMPARE_AS(imageData, Containers::ArrayView{SubDataComplete}, TestSuite::Compare::Container); #endif } #endif @@ -508,8 +508,8 @@ void CubeMapTextureGLTest::subImageQuery() { CORRADE_COMPARE(image.size(), Vector3i(2, 2, 1)); CORRADE_COMPARE_AS( - Containers::ArrayReference(image.data(), image.pixelSize()*image.size().product()), - Containers::ArrayReference{Data}, TestSuite::Compare::Container); + Containers::ArrayView(image.data(), image.pixelSize()*image.size().product()), + Containers::ArrayView{Data}, TestSuite::Compare::Container); } void CubeMapTextureGLTest::subImageQueryBuffer() { @@ -531,7 +531,7 @@ void CubeMapTextureGLTest::subImageQueryBuffer() { MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(image.size(), Vector3i(2, 2, 1)); - CORRADE_COMPARE_AS(imageData, Containers::ArrayReference{Data}, TestSuite::Compare::Container); + CORRADE_COMPARE_AS(imageData, Containers::ArrayView{Data}, TestSuite::Compare::Container); } #endif diff --git a/src/Magnum/Test/RectangleTextureGLTest.cpp b/src/Magnum/Test/RectangleTextureGLTest.cpp index 7a02b2014..b0eff3d16 100644 --- a/src/Magnum/Test/RectangleTextureGLTest.cpp +++ b/src/Magnum/Test/RectangleTextureGLTest.cpp @@ -23,6 +23,7 @@ DEALINGS IN THE SOFTWARE. */ +#include #include #include "Magnum/configure.h" @@ -249,8 +250,8 @@ void RectangleTextureGLTest::image() { CORRADE_COMPARE(image.size(), Vector2i(2)); CORRADE_COMPARE_AS( - Containers::ArrayReference(image.data(), image.pixelSize()*image.size().product()), - Containers::ArrayReference{Data}, TestSuite::Compare::Container); + Containers::ArrayView(image.data(), image.pixelSize()*image.size().product()), + Containers::ArrayView{Data}, TestSuite::Compare::Container); } void RectangleTextureGLTest::imageBuffer() { @@ -269,7 +270,7 @@ void RectangleTextureGLTest::imageBuffer() { MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(image.size(), Vector2i(2)); - CORRADE_COMPARE_AS(imageData, Containers::ArrayReference{Data}, TestSuite::Compare::Container); + CORRADE_COMPARE_AS(imageData, Containers::ArrayView{Data}, TestSuite::Compare::Container); } namespace { @@ -301,8 +302,8 @@ void RectangleTextureGLTest::subImage() { CORRADE_COMPARE(image.size(), Vector2i(4)); CORRADE_COMPARE_AS( - Containers::ArrayReference(image.data(), image.pixelSize()*image.size().product()), - Containers::ArrayReference{SubDataComplete}, TestSuite::Compare::Container); + Containers::ArrayView(image.data(), image.pixelSize()*image.size().product()), + Containers::ArrayView{SubDataComplete}, TestSuite::Compare::Container); } void RectangleTextureGLTest::subImageBuffer() { @@ -323,7 +324,7 @@ void RectangleTextureGLTest::subImageBuffer() { MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(image.size(), Vector2i(4)); - CORRADE_COMPARE_AS(imageData, Containers::ArrayReference{SubDataComplete}, TestSuite::Compare::Container); + CORRADE_COMPARE_AS(imageData, Containers::ArrayView{SubDataComplete}, TestSuite::Compare::Container); } void RectangleTextureGLTest::subImageQuery() { @@ -344,8 +345,8 @@ void RectangleTextureGLTest::subImageQuery() { CORRADE_COMPARE(image.size(), Vector2i{2}); CORRADE_COMPARE_AS( - Containers::ArrayReference(image.data(), image.pixelSize()*image.size().product()), - Containers::ArrayReference{Data}, TestSuite::Compare::Container); + Containers::ArrayView(image.data(), image.pixelSize()*image.size().product()), + Containers::ArrayView{Data}, TestSuite::Compare::Container); } void RectangleTextureGLTest::subImageQueryBuffer() { @@ -366,7 +367,7 @@ void RectangleTextureGLTest::subImageQueryBuffer() { MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(image.size(), Vector2i{2}); - CORRADE_COMPARE_AS(imageData, Containers::ArrayReference{Data}, TestSuite::Compare::Container); + CORRADE_COMPARE_AS(imageData, Containers::ArrayView{Data}, TestSuite::Compare::Container); } void RectangleTextureGLTest::invalidateImage() { diff --git a/src/Magnum/Test/TextureArrayGLTest.cpp b/src/Magnum/Test/TextureArrayGLTest.cpp index 8c5979fd5..ea22a4dcd 100644 --- a/src/Magnum/Test/TextureArrayGLTest.cpp +++ b/src/Magnum/Test/TextureArrayGLTest.cpp @@ -618,8 +618,8 @@ void TextureArrayGLTest::image1D() { CORRADE_COMPARE(image.size(), Vector2i(2)); CORRADE_COMPARE_AS( - Containers::ArrayReference(image.data(), image.pixelSize()*image.size().product()), - Containers::ArrayReference{Data1D}, TestSuite::Compare::Container); + Containers::ArrayView(image.data(), image.pixelSize()*image.size().product()), + Containers::ArrayView{Data1D}, TestSuite::Compare::Container); } void TextureArrayGLTest::image1DBuffer() { @@ -638,7 +638,7 @@ void TextureArrayGLTest::image1DBuffer() { MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(image.size(), Vector2i(2)); - CORRADE_COMPARE_AS(imageData, Containers::ArrayReference{Data1D}, TestSuite::Compare::Container); + CORRADE_COMPARE_AS(imageData, Containers::ArrayView{Data1D}, TestSuite::Compare::Container); } #endif @@ -673,8 +673,8 @@ void TextureArrayGLTest::image2D() { CORRADE_COMPARE(image.size(), Vector3i(2)); CORRADE_COMPARE_AS( - Containers::ArrayReference(image.data(), image.pixelSize()*image.size().product()), - Containers::ArrayReference{Data2D}, TestSuite::Compare::Container); + Containers::ArrayView(image.data(), image.pixelSize()*image.size().product()), + Containers::ArrayView{Data2D}, TestSuite::Compare::Container); #endif } @@ -698,7 +698,7 @@ void TextureArrayGLTest::image2DBuffer() { MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(image.size(), Vector3i(2)); - CORRADE_COMPARE_AS(imageData, Containers::ArrayReference{Data2D}, TestSuite::Compare::Container); + CORRADE_COMPARE_AS(imageData, Containers::ArrayView{Data2D}, TestSuite::Compare::Container); #endif } @@ -735,8 +735,8 @@ void TextureArrayGLTest::subImage1D() { CORRADE_COMPARE(image.size(), Vector2i(4)); CORRADE_COMPARE_AS( - Containers::ArrayReference(image.data(), image.pixelSize()*image.size().product()), - Containers::ArrayReference{SubData1DComplete}, TestSuite::Compare::Container); + Containers::ArrayView(image.data(), image.pixelSize()*image.size().product()), + Containers::ArrayView{SubData1DComplete}, TestSuite::Compare::Container); } void TextureArrayGLTest::subImage1DBuffer() { @@ -757,7 +757,7 @@ void TextureArrayGLTest::subImage1DBuffer() { MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(image.size(), Vector2i(4)); - CORRADE_COMPARE_AS(imageData, Containers::ArrayReference{SubData1DComplete}, TestSuite::Compare::Container); + CORRADE_COMPARE_AS(imageData, Containers::ArrayView{SubData1DComplete}, TestSuite::Compare::Container); } void TextureArrayGLTest::subImage1DQuery() { @@ -778,7 +778,7 @@ void TextureArrayGLTest::subImage1DQuery() { CORRADE_COMPARE(image.size(), Vector2i{2}); CORRADE_COMPARE_AS( - Containers::ArrayReference(image.data(), image.pixelSize()*image.size().product()), Containers::ArrayReference{Data1D}, TestSuite::Compare::Container); + Containers::ArrayView(image.data(), image.pixelSize()*image.size().product()), Containers::ArrayView{Data1D}, TestSuite::Compare::Container); } void TextureArrayGLTest::subImage1DQueryBuffer() { @@ -799,7 +799,7 @@ void TextureArrayGLTest::subImage1DQueryBuffer() { MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(image.size(), Vector2i{2}); - CORRADE_COMPARE_AS(imageData, Containers::ArrayReference{Data1D}, TestSuite::Compare::Container); + CORRADE_COMPARE_AS(imageData, Containers::ArrayView{Data1D}, TestSuite::Compare::Container); } #endif @@ -858,7 +858,7 @@ void TextureArrayGLTest::subImage2D() { CORRADE_COMPARE(image.size(), Vector3i(4)); CORRADE_COMPARE_AS( - Containers::ArrayReference(image.data(), image.pixelSize()*image.size().product()), Containers::ArrayReference{SubData2DComplete}, TestSuite::Compare::Container); + Containers::ArrayView(image.data(), image.pixelSize()*image.size().product()), Containers::ArrayView{SubData2DComplete}, TestSuite::Compare::Container); #endif } @@ -884,7 +884,7 @@ void TextureArrayGLTest::subImage2DBuffer() { MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(image.size(), Vector3i(4)); - CORRADE_COMPARE_AS(imageData, Containers::ArrayReference{SubData2DComplete}, TestSuite::Compare::Container); + CORRADE_COMPARE_AS(imageData, Containers::ArrayView{SubData2DComplete}, TestSuite::Compare::Container); #endif } @@ -907,7 +907,7 @@ void TextureArrayGLTest::subImage2DQuery() { CORRADE_COMPARE(image.size(), Vector3i{2}); CORRADE_COMPARE_AS( - Containers::ArrayReference(image.data(), image.pixelSize()*image.size().product()), Containers::ArrayReference{Data2D}, TestSuite::Compare::Container); + Containers::ArrayView(image.data(), image.pixelSize()*image.size().product()), Containers::ArrayView{Data2D}, TestSuite::Compare::Container); } void TextureArrayGLTest::subImage2DQueryBuffer() { @@ -928,7 +928,7 @@ void TextureArrayGLTest::subImage2DQueryBuffer() { MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(image.size(), Vector3i{2}); - CORRADE_COMPARE_AS(imageData, Containers::ArrayReference{Data2D}, TestSuite::Compare::Container); + CORRADE_COMPARE_AS(imageData, Containers::ArrayView{Data2D}, TestSuite::Compare::Container); } void TextureArrayGLTest::generateMipmap1D() { diff --git a/src/Magnum/Test/TextureGLTest.cpp b/src/Magnum/Test/TextureGLTest.cpp index 1a9b56d61..d1fea809a 100644 --- a/src/Magnum/Test/TextureGLTest.cpp +++ b/src/Magnum/Test/TextureGLTest.cpp @@ -818,8 +818,8 @@ void TextureGLTest::image1D() { CORRADE_COMPARE(image.size(), 2); CORRADE_COMPARE_AS( - Containers::ArrayReference(image.data(), image.pixelSize()*image.size().product()), - Containers::ArrayReference{Data1D}, TestSuite::Compare::Container); + Containers::ArrayView(image.data(), image.pixelSize()*image.size().product()), + Containers::ArrayView{Data1D}, TestSuite::Compare::Container); } void TextureGLTest::image1DBuffer() { @@ -835,7 +835,7 @@ void TextureGLTest::image1DBuffer() { MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(image.size(), 2); - CORRADE_COMPARE_AS(imageData, Containers::ArrayReference{Data1D}, TestSuite::Compare::Container); + CORRADE_COMPARE_AS(imageData, Containers::ArrayView{Data1D}, TestSuite::Compare::Container); } #endif @@ -861,8 +861,8 @@ void TextureGLTest::image2D() { CORRADE_COMPARE(image.size(), Vector2i(2)); CORRADE_COMPARE_AS( - Containers::ArrayReference(image.data(), image.pixelSize()*image.size().product()), - Containers::ArrayReference{Data2D}, TestSuite::Compare::Container); + Containers::ArrayView(image.data(), image.pixelSize()*image.size().product()), + Containers::ArrayView{Data2D}, TestSuite::Compare::Container); #endif } @@ -882,7 +882,7 @@ void TextureGLTest::image2DBuffer() { MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(image.size(), Vector2i(2)); - CORRADE_COMPARE_AS(imageData, Containers::ArrayReference{Data2D}, TestSuite::Compare::Container); + CORRADE_COMPARE_AS(imageData, Containers::ArrayView{Data2D}, TestSuite::Compare::Container); #endif } #endif @@ -918,8 +918,8 @@ void TextureGLTest::image3D() { CORRADE_COMPARE(image.size(), Vector3i(2)); CORRADE_COMPARE_AS( - Containers::ArrayReference(image.data(), image.pixelSize()*image.size().product()), - Containers::ArrayReference{Data3D}, TestSuite::Compare::Container); + Containers::ArrayView(image.data(), image.pixelSize()*image.size().product()), + Containers::ArrayView{Data3D}, TestSuite::Compare::Container); #endif } @@ -939,7 +939,7 @@ void TextureGLTest::image3DBuffer() { MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(image.size(), Vector3i(2)); - CORRADE_COMPARE_AS(imageData, Containers::ArrayReference{Data3D}, TestSuite::Compare::Container); + CORRADE_COMPARE_AS(imageData, Containers::ArrayView{Data3D}, TestSuite::Compare::Container); #endif } #endif @@ -967,8 +967,8 @@ void TextureGLTest::subImage1D() { CORRADE_COMPARE(image.size(), 4); CORRADE_COMPARE_AS( - Containers::ArrayReference(image.data(), image.pixelSize()*image.size().product()), - Containers::ArrayReference{SubData1DComplete}, TestSuite::Compare::Container); + Containers::ArrayView(image.data(), image.pixelSize()*image.size().product()), + Containers::ArrayView{SubData1DComplete}, TestSuite::Compare::Container); } void TextureGLTest::subImage1DBuffer() { @@ -986,7 +986,7 @@ void TextureGLTest::subImage1DBuffer() { MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(image.size(), 4); - CORRADE_COMPARE_AS(imageData, Containers::ArrayReference{SubData1DComplete}, TestSuite::Compare::Container); + CORRADE_COMPARE_AS(imageData, Containers::ArrayView{SubData1DComplete}, TestSuite::Compare::Container); } void TextureGLTest::subImage1DQuery() { @@ -1005,7 +1005,7 @@ void TextureGLTest::subImage1DQuery() { CORRADE_COMPARE(image.size(), 2); CORRADE_COMPARE_AS( - Containers::ArrayReference(image.data(), image.pixelSize()*image.size().product()), Containers::ArrayReference{Data1D}, TestSuite::Compare::Container); + Containers::ArrayView(image.data(), image.pixelSize()*image.size().product()), Containers::ArrayView{Data1D}, TestSuite::Compare::Container); } void TextureGLTest::subImage1DQueryBuffer() { @@ -1024,7 +1024,7 @@ void TextureGLTest::subImage1DQueryBuffer() { MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(image.size(), 2); - CORRADE_COMPARE_AS(imageData, Containers::ArrayReference{Data1D}, TestSuite::Compare::Container); + CORRADE_COMPARE_AS(imageData, Containers::ArrayView{Data1D}, TestSuite::Compare::Container); } #endif @@ -1055,8 +1055,8 @@ void TextureGLTest::subImage2D() { CORRADE_COMPARE(image.size(), Vector2i(4)); CORRADE_COMPARE_AS( - Containers::ArrayReference(image.data(), image.pixelSize()*image.size().product()), - Containers::ArrayReference{SubData2DComplete}, TestSuite::Compare::Container); + Containers::ArrayView(image.data(), image.pixelSize()*image.size().product()), + Containers::ArrayView{SubData2DComplete}, TestSuite::Compare::Container); #endif } @@ -1078,7 +1078,7 @@ void TextureGLTest::subImage2DBuffer() { MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(image.size(), Vector2i(4)); - CORRADE_COMPARE_AS(imageData, Containers::ArrayReference{SubData2DComplete}, TestSuite::Compare::Container); + CORRADE_COMPARE_AS(imageData, Containers::ArrayView{SubData2DComplete}, TestSuite::Compare::Container); #endif } #endif @@ -1100,7 +1100,7 @@ void TextureGLTest::subImage2DQuery() { CORRADE_COMPARE(image.size(), Vector2i{2}); CORRADE_COMPARE_AS( - Containers::ArrayReference(image.data(), image.pixelSize()*image.size().product()), Containers::ArrayReference{Data2D}, TestSuite::Compare::Container); + Containers::ArrayView(image.data(), image.pixelSize()*image.size().product()), Containers::ArrayView{Data2D}, TestSuite::Compare::Container); } void TextureGLTest::subImage2DQueryBuffer() { @@ -1119,7 +1119,7 @@ void TextureGLTest::subImage2DQueryBuffer() { MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(image.size(), Vector2i{2}); - CORRADE_COMPARE_AS(imageData, Containers::ArrayReference{Data2D}, TestSuite::Compare::Container); + CORRADE_COMPARE_AS(imageData, Containers::ArrayView{Data2D}, TestSuite::Compare::Container); } #endif @@ -1170,8 +1170,8 @@ void TextureGLTest::subImage3D() { CORRADE_COMPARE(image.size(), Vector3i(4)); CORRADE_COMPARE_AS( - Containers::ArrayReference(image.data(), image.pixelSize()*image.size().product()), - Containers::ArrayReference{SubData3DComplete}, TestSuite::Compare::Container); + Containers::ArrayView(image.data(), image.pixelSize()*image.size().product()), + Containers::ArrayView{SubData3DComplete}, TestSuite::Compare::Container); #endif } @@ -1193,7 +1193,7 @@ void TextureGLTest::subImage3DBuffer() { MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(image.size(), Vector3i(4)); - CORRADE_COMPARE_AS(imageData, Containers::ArrayReference{SubData3DComplete}, TestSuite::Compare::Container); + CORRADE_COMPARE_AS(imageData, Containers::ArrayView{SubData3DComplete}, TestSuite::Compare::Container); #endif } #endif @@ -1215,7 +1215,7 @@ void TextureGLTest::subImage3DQuery() { CORRADE_COMPARE(image.size(), Vector3i{2}); CORRADE_COMPARE_AS( - Containers::ArrayReference(image.data(), image.pixelSize()*image.size().product()), Containers::ArrayReference{Data3D}, TestSuite::Compare::Container); + Containers::ArrayView(image.data(), image.pixelSize()*image.size().product()), Containers::ArrayView{Data3D}, TestSuite::Compare::Container); } void TextureGLTest::subImage3DQueryBuffer() { @@ -1234,7 +1234,7 @@ void TextureGLTest::subImage3DQueryBuffer() { MAGNUM_VERIFY_NO_ERROR(); CORRADE_COMPARE(image.size(), Vector3i{2}); - CORRADE_COMPARE_AS(imageData, Containers::ArrayReference{Data3D}, TestSuite::Compare::Container); + CORRADE_COMPARE_AS(imageData, Containers::ArrayView{Data3D}, TestSuite::Compare::Container); } void TextureGLTest::generateMipmap1D() { diff --git a/src/Magnum/Text/AbstractFont.cpp b/src/Magnum/Text/AbstractFont.cpp index 5c182924d..8b2af4c12 100644 --- a/src/Magnum/Text/AbstractFont.cpp +++ b/src/Magnum/Text/AbstractFont.cpp @@ -38,7 +38,7 @@ AbstractFont::AbstractFont(): _size(0.0f) {} AbstractFont::AbstractFont(PluginManager::AbstractManager& manager, std::string plugin): AbstractPlugin(manager, std::move(plugin)), _size(0.0f), _lineHeight(0.0f) {} -bool AbstractFont::openData(const std::vector>>& data, const Float size) { +bool AbstractFont::openData(const std::vector>>& data, const Float size) { CORRADE_ASSERT(features() & Feature::OpenData, "Text::AbstractFont::openData(): feature not supported", false); CORRADE_ASSERT(!data.empty(), @@ -50,7 +50,7 @@ bool AbstractFont::openData(const std::vector AbstractFont::doOpenData(const std::vector>>& data, const Float size) { +std::pair AbstractFont::doOpenData(const std::vector>>& data, const Float size) { CORRADE_ASSERT(!(features() & Feature::MultiFile), "Text::AbstractFont::openData(): feature advertised but not implemented", {}); CORRADE_ASSERT(data.size() == 1, @@ -60,7 +60,7 @@ std::pair AbstractFont::doOpenData(const std::vector data, const Float size) { +bool AbstractFont::openSingleData(const Containers::ArrayView data, const Float size) { CORRADE_ASSERT(features() & Feature::OpenData, "Text::AbstractFont::openSingleData(): feature not supported", false); CORRADE_ASSERT(!(features() & Feature::MultiFile), @@ -72,7 +72,7 @@ bool AbstractFont::openSingleData(const Containers::ArrayReference d return isOpened(); } -std::pair AbstractFont::doOpenSingleData(Containers::ArrayReference, Float) { +std::pair AbstractFont::doOpenSingleData(Containers::ArrayView, Float) { CORRADE_ASSERT(false, "Text::AbstractFont::openSingleData(): feature advertised but not implemented", {}); return {}; } diff --git a/src/Magnum/Text/AbstractFont.h b/src/Magnum/Text/AbstractFont.h index 4389b64b9..f639fed4e 100644 --- a/src/Magnum/Text/AbstractFont.h +++ b/src/Magnum/Text/AbstractFont.h @@ -125,7 +125,7 @@ class MAGNUM_TEXT_EXPORT AbstractFont: public PluginManager::AbstractPlugin { * file. Available only if @ref Feature::OpenData is supported. Returns * `true` on success, `false` otherwise. */ - bool openData(const std::vector>>& data, Float size); + bool openData(const std::vector>>& data, Float size); /** * @brief Open font from single data @@ -137,7 +137,7 @@ class MAGNUM_TEXT_EXPORT AbstractFont: public PluginManager::AbstractPlugin { * plugin doesn't have @ref Feature::MultiFile. Returns `true` on * success, `false` otherwise. */ - bool openSingleData(Containers::ArrayReference data, Float size); + bool openSingleData(Containers::ArrayView data, Float size); /** * @brief Open font from file @@ -243,7 +243,7 @@ class MAGNUM_TEXT_EXPORT AbstractFont: public PluginManager::AbstractPlugin { * zeros otherwise. If the plugin doesn't have @ref Feature::MultiFile, * default implementation calls @ref doOpenSingleData(). */ - virtual std::pair doOpenData(const std::vector>>& data, Float size); + virtual std::pair doOpenData(const std::vector>>& data, Float size); /** * @brief Implementation for @ref openSingleData() @@ -251,7 +251,7 @@ class MAGNUM_TEXT_EXPORT AbstractFont: public PluginManager::AbstractPlugin { * Return size and line height of opened font on successful opening, * zeros otherwise. */ - virtual std::pair doOpenSingleData(Containers::ArrayReference data, Float size); + virtual std::pair doOpenSingleData(Containers::ArrayView data, Float size); /** * @brief Implementation for @ref openFile() diff --git a/src/Magnum/Text/AbstractFontConverter.cpp b/src/Magnum/Text/AbstractFontConverter.cpp index d1f87a5a8..2a706d8df 100644 --- a/src/Magnum/Text/AbstractFontConverter.cpp +++ b/src/Magnum/Text/AbstractFontConverter.cpp @@ -182,7 +182,7 @@ bool AbstractFontConverter::doExportGlyphCacheToFile(GlyphCache& cache, const st return true; } -std::unique_ptr AbstractFontConverter::importGlyphCacheFromData(const std::vector>>& data) const { +std::unique_ptr AbstractFontConverter::importGlyphCacheFromData(const std::vector>>& data) const { CORRADE_ASSERT(features() >= (Feature::ImportGlyphCache|Feature::ConvertData), "Text::AbstractFontConverter::importGlyphCacheFromData(): feature not supported", nullptr); CORRADE_ASSERT(!data.empty(), @@ -191,7 +191,7 @@ std::unique_ptr AbstractFontConverter::importGlyphCacheFromData(cons return doImportGlyphCacheFromData(data); } -std::unique_ptr AbstractFontConverter::doImportGlyphCacheFromData(const std::vector>>& data) const { +std::unique_ptr AbstractFontConverter::doImportGlyphCacheFromData(const std::vector>>& data) const { CORRADE_ASSERT(!(features() & Feature::MultiFile), "Text::AbstractFontConverter::importGlyphCacheFromData(): feature advertised but not implemented", nullptr); CORRADE_ASSERT(data.size() == 1, @@ -200,7 +200,7 @@ std::unique_ptr AbstractFontConverter::doImportGlyphCacheFromData(co return doImportGlyphCacheFromSingleData(data[0].second); } -std::unique_ptr AbstractFontConverter::importGlyphCacheFromSingleData(Containers::ArrayReference data) const { +std::unique_ptr AbstractFontConverter::importGlyphCacheFromSingleData(Containers::ArrayView data) const { CORRADE_ASSERT(features() >= (Feature::ImportGlyphCache|Feature::ConvertData), "Text::AbstractFontConverter::importGlyphCacheFromSingleData(): feature not supported", nullptr); CORRADE_ASSERT(!(features() & Feature::MultiFile), @@ -209,7 +209,7 @@ std::unique_ptr AbstractFontConverter::importGlyphCacheFromSingleDat return doImportGlyphCacheFromSingleData(data); } -std::unique_ptr AbstractFontConverter::doImportGlyphCacheFromSingleData(Containers::ArrayReference) const { +std::unique_ptr AbstractFontConverter::doImportGlyphCacheFromSingleData(Containers::ArrayView) const { CORRADE_ASSERT(false, "Text::AbstractFontConverter::importGlyphCacheFromSingleData(): feature advertised but not implemented", nullptr); return nullptr; diff --git a/src/Magnum/Text/AbstractFontConverter.h b/src/Magnum/Text/AbstractFontConverter.h index 6d35136fe..eb907cb88 100644 --- a/src/Magnum/Text/AbstractFontConverter.h +++ b/src/Magnum/Text/AbstractFontConverter.h @@ -232,7 +232,7 @@ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPl * @see @ref features(), @ref importGlyphCacheFromFile(), * @ref exportGlyphCacheToData() */ - std::unique_ptr importGlyphCacheFromData(const std::vector>>& data) const; + std::unique_ptr importGlyphCacheFromData(const std::vector>>& data) const; /** * @brief Import glyph cache from single raw data @@ -244,7 +244,7 @@ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPl * @see @ref features(), @ref importGlyphCacheFromFile(), * @ref exportFontToSingleData() */ - std::unique_ptr importGlyphCacheFromSingleData(Containers::ArrayReference data) const; + std::unique_ptr importGlyphCacheFromSingleData(Containers::ArrayView data) const; /** * @brief Import glyph cache from file @@ -337,10 +337,10 @@ class MAGNUM_TEXT_EXPORT AbstractFontConverter: public PluginManager::AbstractPl * If the plugin doesn't have @ref Feature::MultiFile, default * implementation calls @ref doImportGlyphCacheFromSingleData(). */ - virtual std::unique_ptr doImportGlyphCacheFromData(const std::vector>>& data) const; + virtual std::unique_ptr doImportGlyphCacheFromData(const std::vector>>& data) const; /** @brief Implementation for @ref importGlyphCacheFromSingleData() */ - virtual std::unique_ptr doImportGlyphCacheFromSingleData(Containers::ArrayReference data) const; + virtual std::unique_ptr doImportGlyphCacheFromSingleData(Containers::ArrayView data) const; /** * @brief Implementation for @ref importGlyphCacheFromFile() diff --git a/src/Magnum/Text/Renderer.cpp b/src/Magnum/Text/Renderer.cpp index 1cee70d8c..3d13faa72 100644 --- a/src/Magnum/Text/Renderer.cpp +++ b/src/Magnum/Text/Renderer.cpp @@ -387,7 +387,7 @@ void AbstractRenderer::render(const std::string& text) { "Text::Renderer::render(): capacity" << _capacity << "too small to render" << glyphCount << "glyphs", ); /* Interleave the data into mapped buffer*/ - Containers::ArrayReference vertices(static_cast(bufferMapImplementation(_vertexBuffer, + Containers::ArrayView vertices(static_cast(bufferMapImplementation(_vertexBuffer, vertexCount*sizeof(Vertex))), vertexCount); CORRADE_INTERNAL_ASSERT_OUTPUT(vertices); std::copy(vertexData.begin(), vertexData.end(), vertices.begin()); diff --git a/src/Magnum/Text/Test/AbstractFontConverterTest.cpp b/src/Magnum/Text/Test/AbstractFontConverterTest.cpp index 764e30496..ba70229b0 100644 --- a/src/Magnum/Text/Test/AbstractFontConverterTest.cpp +++ b/src/Magnum/Text/Test/AbstractFontConverterTest.cpp @@ -228,7 +228,7 @@ class SingleGlyphCacheDataImporter: public Text::AbstractFontConverter { private: Features doFeatures() const override { return Feature::ConvertData|Feature::ImportGlyphCache; } - std::unique_ptr doImportGlyphCacheFromSingleData(const Containers::ArrayReference data) const override { + std::unique_ptr doImportGlyphCacheFromSingleData(const Containers::ArrayView data) const override { if(data.size() == 1 && data[0] == '\xa5') return std::unique_ptr(reinterpret_cast(0xdeadbeef)); return nullptr; diff --git a/src/Magnum/Text/Test/AbstractFontTest.cpp b/src/Magnum/Text/Test/AbstractFontTest.cpp index d4b780950..0d8632eab 100644 --- a/src/Magnum/Text/Test/AbstractFontTest.cpp +++ b/src/Magnum/Text/Test/AbstractFontTest.cpp @@ -23,7 +23,7 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include #include @@ -56,7 +56,7 @@ class SingleDataFont: public Text::AbstractFont { bool doIsOpened() const override { return opened; } void doClose() override {} - std::pair doOpenSingleData(const Containers::ArrayReference data, Float) override { + std::pair doOpenSingleData(const Containers::ArrayView data, Float) override { opened = (data.size() == 1 && data[0] == '\xa5'); return {}; } diff --git a/src/Magnum/Trade/AbstractImporter.cpp b/src/Magnum/Trade/AbstractImporter.cpp index 6925a7646..7d6733ba2 100644 --- a/src/Magnum/Trade/AbstractImporter.cpp +++ b/src/Magnum/Trade/AbstractImporter.cpp @@ -49,7 +49,7 @@ AbstractImporter::AbstractImporter(PluginManager::Manager& man AbstractImporter::AbstractImporter(PluginManager::AbstractManager& manager, std::string plugin): PluginManager::AbstractManagingPlugin(manager, std::move(plugin)) {} -bool AbstractImporter::openData(Containers::ArrayReference data) { +bool AbstractImporter::openData(Containers::ArrayView data) { CORRADE_ASSERT(features() & Feature::OpenData, "Trade::AbstractImporter::openData(): feature not supported", {}); @@ -58,7 +58,7 @@ bool AbstractImporter::openData(Containers::ArrayReference data) { return isOpened(); } -void AbstractImporter::doOpenData(Containers::ArrayReference) { +void AbstractImporter::doOpenData(Containers::ArrayView) { CORRADE_ASSERT(false, "Trade::AbstractImporter::openData(): feature advertised but not implemented", ); } diff --git a/src/Magnum/Trade/AbstractImporter.h b/src/Magnum/Trade/AbstractImporter.h index f194cb7ad..ad1893ac1 100644 --- a/src/Magnum/Trade/AbstractImporter.h +++ b/src/Magnum/Trade/AbstractImporter.h @@ -116,7 +116,7 @@ class MAGNUM_EXPORT AbstractImporter: public PluginManager::AbstractManagingPlug * `true` on success, `false` otherwise. * @see @ref features(), @ref openFile() */ - bool openData(Containers::ArrayReference data); + bool openData(Containers::ArrayView data); /** * @brief Open file @@ -494,7 +494,7 @@ class MAGNUM_EXPORT AbstractImporter: public PluginManager::AbstractManagingPlug virtual bool doIsOpened() const = 0; /** @brief Implementation for @ref openData() */ - virtual void doOpenData(Containers::ArrayReference data); + virtual void doOpenData(Containers::ArrayView data); /** @brief Implementation for @ref close() */ virtual void doClose() = 0; diff --git a/src/Magnum/Trade/Test/AbstractImporterTest.cpp b/src/Magnum/Trade/Test/AbstractImporterTest.cpp index 06f2a6b58..332720801 100644 --- a/src/Magnum/Trade/Test/AbstractImporterTest.cpp +++ b/src/Magnum/Trade/Test/AbstractImporterTest.cpp @@ -23,7 +23,7 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include #include @@ -54,7 +54,7 @@ void AbstractImporterTest::openFile() { bool doIsOpened() const override { return opened; } void doClose() override {} - void doOpenData(Containers::ArrayReference data) override { + void doOpenData(Containers::ArrayView data) override { opened = (data.size() == 1 && data[0] == '\xa5'); } diff --git a/src/Magnum/TransformFeedback.cpp b/src/Magnum/TransformFeedback.cpp index ef04d55f1..8be2f5588 100644 --- a/src/Magnum/TransformFeedback.cpp +++ b/src/Magnum/TransformFeedback.cpp @@ -152,7 +152,7 @@ std::string TransformFeedback::label() { return Context::current()->state().debug->getLabelImplementation(GL_TRANSFORM_FEEDBACK, _id); } -TransformFeedback& TransformFeedback::setLabelInternal(const Containers::ArrayReference label) { +TransformFeedback& TransformFeedback::setLabelInternal(const Containers::ArrayView label) { createIfNotAlready(); Context::current()->state().debug->labelImplementation(GL_TRANSFORM_FEEDBACK, _id, label); return *this; @@ -210,7 +210,7 @@ void TransformFeedback::attachImplementationFallback(const GLuint firstIndex, st } #ifndef MAGNUM_TARGET_GLES -/** @todoc const Containers::ArrayReference makes Doxygen grumpy */ +/** @todoc const Containers::ArrayView makes Doxygen grumpy */ void TransformFeedback::attachImplementationDSA(const GLuint firstIndex, std::initializer_list> buffers) { for(std::size_t i = 0; i != buffers.size(); ++i) { Buffer* buffer; @@ -223,14 +223,14 @@ void TransformFeedback::attachImplementationDSA(const GLuint firstIndex, std::in } #endif -/** @todoc const Containers::ArrayReference makes Doxygen grumpy */ +/** @todoc const Containers::ArrayView makes Doxygen grumpy */ void TransformFeedback::attachImplementationFallback(const GLuint firstIndex, std::initializer_list buffers) { bindInternal(); Buffer::bind(Buffer::Target(GL_TRANSFORM_FEEDBACK_BUFFER), firstIndex, buffers); } #ifndef MAGNUM_TARGET_GLES -/** @todoc const Containers::ArrayReference makes Doxygen grumpy */ +/** @todoc const Containers::ArrayView makes Doxygen grumpy */ void TransformFeedback::attachImplementationDSA(const GLuint firstIndex, std::initializer_list buffers) { for(std::size_t i = 0; i != buffers.size(); ++i) glTransformFeedbackBufferBase(_id, firstIndex + i, *(buffers.begin() + i) ? (*(buffers.begin() + i))->id() : 0); diff --git a/src/Magnum/TransformFeedback.h b/src/Magnum/TransformFeedback.h index 5605948b4..1c8f803ea 100644 --- a/src/Magnum/TransformFeedback.h +++ b/src/Magnum/TransformFeedback.h @@ -25,7 +25,7 @@ DEALINGS IN THE SOFTWARE. */ -#include +#include #include "Magnum/AbstractObject.h" @@ -398,7 +398,7 @@ class MAGNUM_EXPORT TransformFeedback: public AbstractObject { #endif #ifndef MAGNUM_TARGET_WEBGL - TransformFeedback& setLabelInternal(Containers::ArrayReference label); + TransformFeedback& setLabelInternal(Containers::ArrayView label); #endif GLuint _id; diff --git a/src/MagnumPlugins/MagnumFont/MagnumFont.cpp b/src/MagnumPlugins/MagnumFont/MagnumFont.cpp index 6578b7ccb..2295cbd00 100644 --- a/src/MagnumPlugins/MagnumFont/MagnumFont.cpp +++ b/src/MagnumPlugins/MagnumFont/MagnumFont.cpp @@ -26,7 +26,7 @@ #include "MagnumFont.h" #include -#include +#include #include #include @@ -68,7 +68,7 @@ auto MagnumFont::doFeatures() const -> Features { return Feature::OpenData|Featu bool MagnumFont::doIsOpened() const { return _opened; } -std::pair MagnumFont::doOpenData(const std::vector>>& data, const Float) { +std::pair MagnumFont::doOpenData(const std::vector>>& data, const Float) { /* We need just the configuration file and image file */ if(data.size() != 2) { Error() << "Text::MagnumFont::openData(): wanted two files, got" << data.size(); diff --git a/src/MagnumPlugins/MagnumFont/MagnumFont.h b/src/MagnumPlugins/MagnumFont/MagnumFont.h index 4ff51174c..957c81de5 100644 --- a/src/MagnumPlugins/MagnumFont/MagnumFont.h +++ b/src/MagnumPlugins/MagnumFont/MagnumFont.h @@ -120,7 +120,7 @@ class MagnumFont: public AbstractFont { bool doIsOpened() const override; - std::pair doOpenData(const std::vector>>& data, Float) override; + std::pair doOpenData(const std::vector>>& data, Float) override; std::pair doOpenFile(const std::string& filename, Float) override; diff --git a/src/MagnumPlugins/ObjImporter/ObjImporter.cpp b/src/MagnumPlugins/ObjImporter/ObjImporter.cpp index bc8b5134e..09be6142d 100644 --- a/src/MagnumPlugins/ObjImporter/ObjImporter.cpp +++ b/src/MagnumPlugins/ObjImporter/ObjImporter.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include "Magnum/Mesh.h" @@ -132,7 +132,7 @@ void ObjImporter::doOpenFile(const std::string& filename) { parseMeshNames(); } -void ObjImporter::doOpenData(Containers::ArrayReference data) { +void ObjImporter::doOpenData(Containers::ArrayView data) { /* Open file in *text* mode (to avoid \r handling) */ _file.reset(new File); _file->in.reset(new std::istringstream{{data.begin(), data.size()}}); diff --git a/src/MagnumPlugins/ObjImporter/ObjImporter.h b/src/MagnumPlugins/ObjImporter/ObjImporter.h index 28fe640d6..14d2a7d78 100644 --- a/src/MagnumPlugins/ObjImporter/ObjImporter.h +++ b/src/MagnumPlugins/ObjImporter/ObjImporter.h @@ -67,7 +67,7 @@ class ObjImporter: public AbstractImporter { Features doFeatures() const override; bool doIsOpened() const override; - void doOpenData(Containers::ArrayReference data) override; + void doOpenData(Containers::ArrayView data) override; void doOpenFile(const std::string& filename) override; void doClose() override; diff --git a/src/MagnumPlugins/TgaImporter/Test/TgaImporterTest.cpp b/src/MagnumPlugins/TgaImporter/Test/TgaImporterTest.cpp index 20594b2fc..20e7d01ba 100644 --- a/src/MagnumPlugins/TgaImporter/Test/TgaImporterTest.cpp +++ b/src/MagnumPlugins/TgaImporter/Test/TgaImporterTest.cpp @@ -24,7 +24,7 @@ */ #include -#include +#include #include #include diff --git a/src/MagnumPlugins/TgaImporter/TgaImporter.cpp b/src/MagnumPlugins/TgaImporter/TgaImporter.cpp index b5a13754f..09324ea8c 100644 --- a/src/MagnumPlugins/TgaImporter/TgaImporter.cpp +++ b/src/MagnumPlugins/TgaImporter/TgaImporter.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include "Magnum/ColorFormat.h" #include "Magnum/Math/Swizzle.h" @@ -54,7 +54,7 @@ auto TgaImporter::doFeatures() const -> Features { return Feature::OpenData; } bool TgaImporter::doIsOpened() const { return in; } -void TgaImporter::doOpenData(const Containers::ArrayReference data) { +void TgaImporter::doOpenData(const Containers::ArrayView data) { in = new std::istringstream{{data, data.size()}}; } diff --git a/src/MagnumPlugins/TgaImporter/TgaImporter.h b/src/MagnumPlugins/TgaImporter/TgaImporter.h index 54c2fe401..158f8e267 100644 --- a/src/MagnumPlugins/TgaImporter/TgaImporter.h +++ b/src/MagnumPlugins/TgaImporter/TgaImporter.h @@ -81,7 +81,7 @@ class MAGNUM_TGAIMPORTER_EXPORT TgaImporter: public AbstractImporter { private: Features MAGNUM_TGAIMPORTER_LOCAL doFeatures() const override; bool MAGNUM_TGAIMPORTER_LOCAL doIsOpened() const override; - void MAGNUM_TGAIMPORTER_LOCAL doOpenData(Containers::ArrayReference data) override; + void MAGNUM_TGAIMPORTER_LOCAL doOpenData(Containers::ArrayView data) override; void MAGNUM_TGAIMPORTER_LOCAL doOpenFile(const std::string& filename) override; void MAGNUM_TGAIMPORTER_LOCAL doClose() override; UnsignedInt MAGNUM_TGAIMPORTER_LOCAL doImage2DCount() const override; diff --git a/src/MagnumPlugins/WavAudioImporter/Test/WavImporterTest.cpp b/src/MagnumPlugins/WavAudioImporter/Test/WavImporterTest.cpp index c19f55134..126698ffa 100644 --- a/src/MagnumPlugins/WavAudioImporter/Test/WavImporterTest.cpp +++ b/src/MagnumPlugins/WavAudioImporter/Test/WavImporterTest.cpp @@ -24,7 +24,7 @@ */ #include -#include +#include #include #include diff --git a/src/MagnumPlugins/WavAudioImporter/WavImporter.cpp b/src/MagnumPlugins/WavAudioImporter/WavImporter.cpp index 7b0328995..849f42a58 100644 --- a/src/MagnumPlugins/WavAudioImporter/WavImporter.cpp +++ b/src/MagnumPlugins/WavAudioImporter/WavImporter.cpp @@ -43,7 +43,7 @@ auto WavImporter::doFeatures() const -> Features { return Feature::OpenData; } bool WavImporter::doIsOpened() const { return _data; } -void WavImporter::doOpenData(Containers::ArrayReference data) { +void WavImporter::doOpenData(Containers::ArrayView data) { /* Check file size */ if(data.size() < sizeof(WavHeader)) { Error() << "Audio::WavImporter::openData(): the file is too short:" << data.size() << "bytes"; diff --git a/src/MagnumPlugins/WavAudioImporter/WavImporter.h b/src/MagnumPlugins/WavAudioImporter/WavImporter.h index f8fb6ec9c..64174bafc 100644 --- a/src/MagnumPlugins/WavAudioImporter/WavImporter.h +++ b/src/MagnumPlugins/WavAudioImporter/WavImporter.h @@ -62,7 +62,7 @@ class WavImporter: public AbstractImporter { private: Features doFeatures() const override; bool doIsOpened() const override; - void doOpenData(Containers::ArrayReference data) override; + void doOpenData(Containers::ArrayView data) override; void doClose() override; Buffer::Format doFormat() const override;