From a13676f2bb9a86ced75ed640f571512cf1a76afe Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 6 Sep 2021 01:35:22 +0300 Subject: qcam: Use Image class to access pixel data Replace the manual implementation of frame buffer mapping with the Image class to improve code sharing. The ViewFinder API is updated to take an Image pointer in the render() function to prepare for multi-planar buffer support. Signed-off-by: Laurent Pinchart Reviewed-by: Jean-Michel Hautbois Reviewed-by: Kieran Bingham --- src/qcam/viewfinder_gl.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/qcam/viewfinder_gl.cpp') diff --git a/src/qcam/viewfinder_gl.cpp b/src/qcam/viewfinder_gl.cpp index d2ef0369..87e4fe03 100644 --- a/src/qcam/viewfinder_gl.cpp +++ b/src/qcam/viewfinder_gl.cpp @@ -13,6 +13,8 @@ #include +#include "../cam/image.h" + static const QList supportedFormats{ /* YUV - packed (single plane) */ libcamera::formats::UYVY, @@ -110,8 +112,7 @@ QImage ViewFinderGL::getCurrentImage() return grabFramebuffer(); } -void ViewFinderGL::render(libcamera::FrameBuffer *buffer, - libcamera::Span mem) +void ViewFinderGL::render(libcamera::FrameBuffer *buffer, Image *image) { if (buffer->planes().size() != 1) { qWarning() << "Multi-planar buffers are not supported"; @@ -121,7 +122,7 @@ void ViewFinderGL::render(libcamera::FrameBuffer *buffer, if (buffer_) renderComplete(buffer_); - data_ = mem.data(); + data_ = image->data(0).data(); /* * \todo Get the stride from the buffer instead of computing it naively */ -- cgit v1.2.1