Browse Source

Add even more special case workarounds to deprecated build of ImageView.

The test now compiles and passes again.
pull/175/merge
Vladimír Vondruš 10 years ago
parent
commit
8d38f1d258
  1. 16
      src/Magnum/ImageView.h

16
src/Magnum/ImageView.h

@ -35,6 +35,10 @@
#include "Magnum/PixelStorage.h"
#include "Magnum/Math/Vector4.h"
#ifdef MAGNUM_BUILD_DEPRECATED
#include <Corrade/Containers/Array.h>
#endif
namespace Magnum {
/**
@ -86,6 +90,10 @@ template<UnsignedInt dimensions> class ImageView {
explicit CORRADE_DEPRECATED("use ImageView(PixelFormat, PixelType, const VectorTypeFor&, Containers::ArrayView) instead") ImageView(PixelFormat format, PixelType type, const VectorTypeFor<dimensions, Int>& size, const void* data) noexcept: ImageView{{}, format, type, size, {reinterpret_cast<const char*>(data), Implementation::imageDataSizeFor(format, type, size)}} {}
#ifndef DOXYGEN_GENERATING_OUTPUT
/* To avoid ambiguous overload when passing ArrayView<T> to the
constructor */
template<class T> explicit ImageView(PixelFormat format, PixelType type, const VectorTypeFor<dimensions, Int>& size, Containers::ArrayView<const T> data): ImageView{{}, format, type, size, Containers::ArrayView<const void>{data}} {}
template<class T> explicit ImageView(PixelFormat format, PixelType type, const VectorTypeFor<dimensions, Int>& size, const Containers::Array<T>& data): ImageView{{}, format, type, size, Containers::ArrayView<const void>(data)} {}
/* To avoid decay of sized arrays and nullptr to const void* and
unwanted use of deprecated function */
template<class T, std::size_t dataSize> explicit ImageView(PixelFormat format, PixelType type, const VectorTypeFor<dimensions, Int>& size, const T(&data)[dataSize]): ImageView{{}, format, type, size, Containers::ArrayView<const void>{data}} {}
@ -169,6 +177,14 @@ template<UnsignedInt dimensions> class ImageView {
}
#ifndef DOXYGEN_GENERATING_OUTPUT
/* To avoid ambiguous overload when passing ArrayView<T> to the
function */
template<class T> void setData(Containers::ArrayView<const T> data) {
setData(Containers::ArrayView<const void>{data});
}
template<class T> void setData(const Containers::Array<T>& data) {
setData(Containers::ArrayView<const void>(data));
}
/* To avoid decay of sized arrays and nullptr to const void* and
unwanted use of deprecated function */
template<class T, std::size_t size> void setData(const T(&data)[size]) {

Loading…
Cancel
Save