image: add stride and size queries
This commit is contained in:
parent
ca59c95c26
commit
c885e753d2
@ -51,6 +51,8 @@ namespace util { namespace image {
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
constexpr extent2u extent (void) const;
|
||||
constexpr extent2u stride (void) const;
|
||||
constexpr size_t size (void) const; // elements allocated
|
||||
|
||||
constexpr bool is_packed (void) const;
|
||||
|
||||
|
20
image.ipp
20
image.ipp
@ -29,11 +29,29 @@ namespace util { namespace image {
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
constexpr extent2u
|
||||
buffer<T>::stride (void) const
|
||||
{
|
||||
return { 1, s };
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
constexpr size_t
|
||||
buffer<T>::size (void) const
|
||||
{
|
||||
return extent ()[1] * stride ()[1];
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
constexpr bool
|
||||
buffer<T>::is_packed (void) const
|
||||
{
|
||||
return s == w;
|
||||
return stride ()[1] == extent ()[0];
|
||||
}
|
||||
} }
|
||||
|
Loading…
Reference in New Issue
Block a user