libcamera: framebuffer: Replace vector with span in constructor
The FrameBuffer constructor takes a list of planes as an std::vector. The caller may stores the planes in a different type of container, resulting in the needless allocation of a temporary vector. Replace it with a span. Suggested-by: Daniel Rákos <daniel.rakos@rastergrid.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
This commit is contained in:
@@ -58,11 +58,11 @@ public:
|
||||
unsigned int length;
|
||||
};
|
||||
|
||||
FrameBuffer(const std::vector<Plane> &planes, unsigned int cookie = 0);
|
||||
FrameBuffer(Span<const Plane> planes, unsigned int cookie = 0);
|
||||
FrameBuffer(std::unique_ptr<Private> d);
|
||||
virtual ~FrameBuffer() {}
|
||||
|
||||
const std::vector<Plane> &planes() const;
|
||||
Span<const Plane> planes() const;
|
||||
Request *request() const;
|
||||
const FrameMetadata &metadata() const;
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include <libcamera/base/class.h>
|
||||
#include <libcamera/base/span.h>
|
||||
|
||||
#include <libcamera/fence.h>
|
||||
#include <libcamera/framebuffer.h>
|
||||
@@ -23,7 +24,7 @@ class FrameBuffer::Private : public Extensible::Private
|
||||
LIBCAMERA_DECLARE_PUBLIC(FrameBuffer)
|
||||
|
||||
public:
|
||||
Private(const std::vector<Plane> &planes, uint64_t cookie = 0);
|
||||
Private(Span<const Plane> planes, uint64_t cookie = 0);
|
||||
virtual ~Private();
|
||||
|
||||
void setRequest(Request *request) { request_ = request; }
|
||||
|
||||
Reference in New Issue
Block a user