Browse Source

Remove another aspect of ImageView that was deprecated in 2019.10.

This got deprecated in 069c81b9cb but
without any visible documentation bit, so it was almost impossible to
trace back to a particular version. Or know about it when using the API.
pull/659/head
Vladimír Vondruš 1 year ago
parent
commit
e43eba68db
  1. 3
      doc/changelog.dox
  2. 8
      src/Magnum/ImageView.cpp
  3. 8
      src/Magnum/Test/ImageViewTest.cpp

3
doc/changelog.dox

@ -1751,6 +1751,9 @@ See also:
- Templated @cpp Image*::data() @ce APIs returning a pointer which
allowed for dangerous data access without any bounds, type or layout
checks, use @ref Image::pixels() instead
- Passing empty data with a non-zero size to @ref ImageView constructors,
which caused a runtime deprecation warning, is not allowed anymore. Use
a constructor without the data parameter instead.
- @cpp GL::TextureFormat::R3B3G2 @ce containing a typo, use
@ref GL::TextureFormat::R3G3B2 instead
- @cpp Platform::GlfwApplication::Key::Smicolon @ce containing a typo,

8
src/Magnum/ImageView.cpp

@ -36,15 +36,7 @@ template<UnsignedInt dimensions, class T> ImageView<dimensions, T>::ImageView(co
template<UnsignedInt dimensions, class T> ImageView<dimensions, T>::ImageView(const PixelStorage storage, const UnsignedInt format, const UnsignedInt formatExtra, const UnsignedInt pixelSize, const VectorTypeFor<dimensions, Int>& size, const Containers::ArrayView<ErasedType> data, const ImageFlags<dimensions> flags) noexcept: ImageView{storage, pixelFormatWrap(format), formatExtra, pixelSize, size, data, flags} {}
template<UnsignedInt dimensions, class T> ImageView<dimensions, T>::ImageView(const PixelStorage storage, const PixelFormat format, const UnsignedInt formatExtra, const UnsignedInt pixelSize, const VectorTypeFor<dimensions, Int>& size, const Containers::ArrayView<ErasedType> data, const ImageFlags<dimensions> flags) noexcept: _storage{storage}, _format{format}, _formatExtra{formatExtra}, _pixelSize{pixelSize}, _flags{flags}, _size{size}, _data{reinterpret_cast<Type*>(data.data()), data.size()} {
#ifdef MAGNUM_BUILD_DEPRECATED
#ifndef CORRADE_NO_ASSERT
if(size.product() && !_data && !_data.size())
Warning{} << "ImageView: passing empty data to a non-empty view is deprecated, use a constructor without the data parameter instead";
#endif
CORRADE_ASSERT(!_data || Implementation::imageDataSize(*this) <= _data.size(), "ImageView: data too small, got" << _data.size() << "but expected at least" << Implementation::imageDataSize(*this) << "bytes", );
#else
CORRADE_ASSERT(Implementation::imageDataSize(*this) <= _data.size(), "ImageView: data too small, got" << _data.size() << "but expected at least" << Implementation::imageDataSize(*this) << "bytes", );
#endif
#ifndef CORRADE_NO_ASSERT
Implementation::checkImageFlagsForSize("ImageView:", flags, size);
#endif

8
src/Magnum/Test/ImageViewTest.cpp

@ -657,16 +657,12 @@ void ImageViewTest::constructCompressedFromMutable() {
}
void ImageViewTest::constructNullptr() {
#ifdef MAGNUM_BUILD_DEPRECATED
CORRADE_SKIP("This is still allowed on a deprecated build, can't test.");
#elif defined(CORRADE_NO_ASSERT)
CORRADE_SKIP("CORRADE_NO_ASSERT defined, can't test assertions");
#else
CORRADE_SKIP_IF_NO_ASSERT();
Containers::String out;
Error redirectError{&out};
ImageView2D{PixelFormat::RGB8Unorm, {1, 3}, nullptr};
CORRADE_COMPARE(out, "ImageView: data too small, got 0 but expected at least 12 bytes\n");
#endif
}
void ImageViewTest::constructInvalidSize() {

Loading…
Cancel
Save