From f6d6181d3c91efa526b5027319331db9ac75f65b Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Wed, 20 Jul 2022 14:47:33 +0300 Subject: cam: sdl_sink: Pass a Span to SDLTexture::update() The SDLTexture::update() function isn't meant to modify the data it receives. Make the Span type const to ensure this at compile time. While at it, pass the Span by value instead of reference, as a Span is only a pointer and size, which will fit in registers and will avoid pointer dereferences in the callee. Signed-off-by: Laurent Pinchart Reviewed-by: Jacopo Mondi --- src/cam/sdl_texture_mjpg.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/cam/sdl_texture_mjpg.cpp') diff --git a/src/cam/sdl_texture_mjpg.cpp b/src/cam/sdl_texture_mjpg.cpp index 7eddc00c..7542efd7 100644 --- a/src/cam/sdl_texture_mjpg.cpp +++ b/src/cam/sdl_texture_mjpg.cpp @@ -43,7 +43,7 @@ SDLTextureMJPG::SDLTextureMJPG(const SDL_Rect &rect) { } -int SDLTextureMJPG::decompress(const Span &data) +int SDLTextureMJPG::decompress(Span data) { struct jpeg_decompress_struct cinfo; @@ -76,7 +76,7 @@ int SDLTextureMJPG::decompress(const Span &data) return 0; } -void SDLTextureMJPG::update(const Span &data) +void SDLTextureMJPG::update(Span data) { decompress(data); SDL_UpdateTexture(ptr_, nullptr, rgb_.get(), pitch_); -- cgit v1.2.1