Browse Source

Avoid unwanted decay to deprecated functions in Image constructors.

Only possible to hit this in tests, otherwise I don't see much point in
creating a 0x0 image.
pull/181/head
Vladimír Vondruš 10 years ago
parent
commit
ae4c8f55b6
  1. 5
      src/Magnum/Image.h
  2. 5
      src/Magnum/Trade/ImageData.h

5
src/Magnum/Image.h

@ -72,6 +72,11 @@ template<UnsignedInt dimensions> class Image {
* instead.
*/
explicit CORRADE_DEPRECATED("use Image(PixelFormat, PixelType, const VectorTypeFor&, Containers::Array&&) instead") Image(PixelFormat format, PixelType type, const VectorTypeFor<dimensions, Int>& size, void* data) noexcept: Image{{}, format, type, size, Containers::Array<char>{reinterpret_cast<char*>(data), Implementation::imageDataSizeFor(format, type, size)}} {}
#ifndef DOXYGEN_GENERATING_OUTPUT
/* To avoid decay of nullptr to const void* and unwanted use of
deprecated function */
explicit Image(PixelFormat format, PixelType type, const VectorTypeFor<dimensions, Int>& size, std::nullptr_t) noexcept: Image{{}, format, type, size, nullptr} {}
#endif
#endif
/**

5
src/Magnum/Trade/ImageData.h

@ -80,6 +80,11 @@ template<UnsignedInt dimensions> class ImageData {
* @deprecated Use @ref ImageData(PixelFormat, PixelType, const VectorTypeFor<dimensions, Int>&, Containers::Array<char>&&, const void*) instead.
*/
explicit CORRADE_DEPRECATED("use ImageData(PixelFormat, PixelType, const VectorTypeFor&, Containers::Array&&) instead") ImageData(PixelFormat format, PixelType type, const VectorTypeFor<dimensions, Int>& size, void* data) noexcept: ImageData{format, type, size, Containers::Array<char>{reinterpret_cast<char*>(data), Magnum::Implementation::imageDataSizeFor(format, type, size)}} {}
#ifndef DOXYGEN_GENERATING_OUTPUT
/* To avoid decay of nullptr to const void* and unwanted use of
deprecated function */
explicit ImageData(PixelFormat format, PixelType type, const VectorTypeFor<dimensions, Int>& size, std::nullptr_t) noexcept: ImageData{{}, format, type, size, nullptr} {}
#endif
#endif
#ifndef MAGNUM_TARGET_GLES

Loading…
Cancel
Save