Browse Source

Return a const& from Image{View,Data}::size(), instead of a value.

Allows creating a StridedArrayView slice on the sizes to feed them to
various algorithms, instead of first having to copy the sizes out to a
freshly allocated array.
pull/578/head
Vladimír Vondruš 4 years ago
parent
commit
36ee7835d6
  1. 4
      doc/changelog.dox
  2. 4
      src/Magnum/Image.h
  3. 4
      src/Magnum/ImageView.h
  4. 4
      src/Magnum/Trade/ImageData.h

4
doc/changelog.dox

@ -329,6 +329,10 @@ See also:
- @ref MeshIndexType was enlarged to 32 bits and can now wrap
implementation-specific values similar to @ref PixelFormat,
@ref CompressedPixelFormat, @ref VertexFormat and @ref MeshPrimitive
- @ref Image::size(), @ref ImageView::size() as well as
@ref Trade::ImageData::size() now return a @cpp const& @ce instead of a
value to allow creating a @relativeref{Corrade,Containers::StridedArrayView}
slice onto this member.
@subsubsection changelog-latest-changes-debugtools DebugTools library

4
src/Magnum/Image.h

@ -364,7 +364,7 @@ template<UnsignedInt dimensions> class Image {
UnsignedInt pixelSize() const { return _pixelSize; }
/** @brief Image size in pixels */
VectorTypeFor<dimensions, Int> size() const { return _size; }
const VectorTypeFor<dimensions, Int>& size() const { return _size; }
/**
* @brief Image data properties
@ -470,7 +470,7 @@ template<UnsignedInt dimensions> class Image {
PixelFormat _format;
UnsignedInt _formatExtra;
UnsignedInt _pixelSize;
Math::Vector<Dimensions, Int> _size;
VectorTypeFor<dimensions, Int> _size;
Containers::Array<char> _data;
};

4
src/Magnum/ImageView.h

@ -410,7 +410,7 @@ template<UnsignedInt dimensions, class T> class ImageView {
UnsignedInt pixelSize() const { return _pixelSize; }
/** @brief Image size in pixels */
constexpr VectorTypeFor<dimensions, Int> size() const { return _size; }
constexpr const VectorTypeFor<dimensions, Int>& size() const { return _size; }
/**
* @brief Image data properties
@ -484,7 +484,7 @@ template<UnsignedInt dimensions, class T> class ImageView {
PixelFormat _format;
UnsignedInt _formatExtra;
UnsignedInt _pixelSize;
Math::Vector<Dimensions, Int> _size;
VectorTypeFor<dimensions, Int> _size;
Containers::ArrayView<Type> _data;
};

4
src/Magnum/Trade/ImageData.h

@ -524,7 +524,7 @@ template<UnsignedInt dimensions> class ImageData {
UnsignedInt pixelSize() const;
/** @brief Image size in pixels */
VectorTypeFor<dimensions, Int> size() const { return _size; }
const VectorTypeFor<dimensions, Int>& size() const { return _size; }
/**
* @brief Uncompressed image data properties
@ -693,7 +693,7 @@ template<UnsignedInt dimensions> class ImageData {
};
UnsignedInt _formatExtra;
UnsignedInt _pixelSize;
Math::Vector<Dimensions, Int> _size;
VectorTypeFor<dimensions, Int> _size;
Containers::Array<char> _data;
const void* _importerState;
};

Loading…
Cancel
Save