Introduce methods for retrieving individual buffer dimensions

The new methods can be useful when one wants to get the size of the
buffer along some specific dimension, e.g. width or height.

Of course, size() could be used for this purpose, but with the new
helper methods, one has to type less.
This commit is contained in:
Vlad Zahorodnii 2020-05-23 21:00:39 +03:00
parent 85161bb644
commit 6bdd20d47b
2 changed files with 18 additions and 0 deletions

View file

@ -314,6 +314,16 @@ wl_resource *BufferInterface::resource() const
return d->buffer;
}
int BufferInterface::width() const
{
return d->size.width();
}
int BufferInterface::height() const
{
return d->size.height();
}
QSize BufferInterface::size() const
{
return d->size;

View file

@ -119,6 +119,14 @@ public:
**/
QImage data();
/**
* Returns the width of the buffer in device pixels.
*/
int width() const;
/**
* Returns the height of the buffer in device pixels.
*/
int height() const;
/**
* Returns the size of this BufferInterface.
* Note: only for shared memory buffers (shmBuffer) the size can be derived,