Browse Source

Removed templated & unsafe Image*::data() APIs deprecated in 2019.10.

pull/659/head
Vladimír Vondruš 1 year ago
parent
commit
93679c6c60
  1. 3
      doc/changelog.dox
  2. 44
      src/Magnum/Image.h
  3. 24
      src/Magnum/ImageView.h
  4. 22
      src/Magnum/Trade/ImageData.h

3
doc/changelog.dox

@ -1745,6 +1745,9 @@ See also:
- @cpp TextureTools::distanceField() @ce, use the
@ref TextureTools::DistanceFieldGL class instead.
- Removed APIs deprecated in 2019.10, in particular:
- 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
- @cpp Trade::ImporterFileCallbackPolicy @ce, use the
@ref InputFileCallbackPolicy enum instead; additionally there was
@cpp Trade::ImporterFileCallbackPolicy::LoadPernament @ce containing a

44
src/Magnum/Image.h

@ -441,28 +441,6 @@ template<UnsignedInt dimensions> class Image {
*/
Containers::Array<char> data() const && = delete;
#ifdef MAGNUM_BUILD_DEPRECATED
/**
* @brief Image data in a particular type
* @m_deprecated_since{2019,10} Use non-templated @ref data() together
* with @ref Corrade::Containers::arrayCast() instead for properly
* bounds-checked type conversion.
*/
template<class T> CORRADE_DEPRECATED("use data() together with Containers::arrayCast() instead") T* data() {
return reinterpret_cast<T*>(_data.data());
}
/**
* @brief Image data in a particular type
* @m_deprecated_since{2019,10} Use non-templated @ref data() together
* with @ref Corrade::Containers::arrayCast() instead for properly
* bounds-checked type conversion.
*/
template<class T> CORRADE_DEPRECATED("use data() together with Containers::arrayCast() instead") const T* data() const {
return reinterpret_cast<const T*>(_data.data());
}
#endif
/**
* @brief Pixel data
* @m_since{2019,10}
@ -720,28 +698,6 @@ template<UnsignedInt dimensions> class CompressedImage {
*/
Containers::Array<char> data() const && = delete;
#ifdef MAGNUM_BUILD_DEPRECATED
/**
* @brief Image data in a particular type
* @m_deprecated_since{2019,10} Use non-templated @ref data() together
* with @ref Corrade::Containers::arrayCast() instead for properly
* bounds-checked type conversion.
*/
template<class T> CORRADE_DEPRECATED("use data() together with Containers::arrayCast() instead") T* data() {
return reinterpret_cast<T*>(_data.data());
}
/**
* @brief Image data in a particular type
* @m_deprecated_since{2019,10} Use non-templated @ref data() together
* with @ref Corrade::Containers::arrayCast() instead for properly
* bounds-checked type conversion.
*/
template<class T> CORRADE_DEPRECATED("use data() together with Containers::arrayCast() instead") const T* data() const {
return reinterpret_cast<const T*>(_data.data());
}
#endif
/**
* @brief Release data storage
*

24
src/Magnum/ImageView.h

@ -468,18 +468,6 @@ template<UnsignedInt dimensions, class T> class ImageView {
*/
Containers::ArrayView<Type> data() const { return _data; }
#ifdef MAGNUM_BUILD_DEPRECATED
/**
* @brief Image data in a particular type
* @m_deprecated_since{2019,10} Use non-templated @ref data() together
* with @ref Corrade::Containers::arrayCast() instead for properly
* bounds-checked type conversion.
*/
template<class U> CORRADE_DEPRECATED("use data() together with Containers::arrayCast() instead") const U* data() const {
return reinterpret_cast<const U*>(_data.data());
}
#endif
/**
* @brief Set image data
*
@ -862,18 +850,6 @@ template<UnsignedInt dimensions, class T> class CompressedImageView {
/** @brief Raw image data */
Containers::ArrayView<Type> data() const { return _data; }
#ifdef MAGNUM_BUILD_DEPRECATED
/**
* @brief Image data in a particular type
* @m_deprecated_since{2019,10} Use non-templated @ref data() together
* with @ref Corrade::Containers::arrayCast() instead for properly
* bounds-checked type conversion.
*/
template<class U> CORRADE_DEPRECATED("use data() together with Containers::arrayCast() instead") const U* data() const {
return reinterpret_cast<const U*>(_data.data());
}
#endif
/**
* @brief Set image data
*

22
src/Magnum/Trade/ImageData.h

@ -808,28 +808,6 @@ template<UnsignedInt dimensions> class ImageData {
*/
Containers::ArrayView<char> mutableData() &;
#ifdef MAGNUM_BUILD_DEPRECATED
/**
* @brief Image data in a particular type
* @m_deprecated_since{2019,10} Use non-templated @ref data() together
* with @ref Corrade::Containers::arrayCast() instead for properly
* bounds-checked type conversion.
*/
template<class T> CORRADE_DEPRECATED("use data() together with Containers::arrayCast() instead") T* data() {
return reinterpret_cast<T*>(_data.data());
}
/**
* @brief Image data in a particular type
* @m_deprecated_since{2019,10} Use non-templated @ref data() together
* with @ref Corrade::Containers::arrayCast() instead for properly
* bounds-checked type conversion.
*/
template<class T> CORRADE_DEPRECATED("use data() together with Containers::arrayCast() instead") const T* data() const {
return reinterpret_cast<const T*>(_data.data());
}
#endif
/**
* @brief Pixel data
* @m_since{2019,10}

Loading…
Cancel
Save