From 6bdd20d47ba124e0fd7eecc3a0928eed3288ccee Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Sat, 23 May 2020 21:00:39 +0300 Subject: [PATCH] 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. --- src/wayland/server/buffer_interface.cpp | 10 ++++++++++ src/wayland/server/buffer_interface.h | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/src/wayland/server/buffer_interface.cpp b/src/wayland/server/buffer_interface.cpp index 977edbc03f..4e0b33a3be 100644 --- a/src/wayland/server/buffer_interface.cpp +++ b/src/wayland/server/buffer_interface.cpp @@ -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; diff --git a/src/wayland/server/buffer_interface.h b/src/wayland/server/buffer_interface.h index c3b95c6881..1be5bab74d 100644 --- a/src/wayland/server/buffer_interface.h +++ b/src/wayland/server/buffer_interface.h @@ -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,