From patchwork Mon Apr 21 15:51:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 23198 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 1B939BE08B for ; Mon, 21 Apr 2025 15:51:21 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E314068AD8; Mon, 21 Apr 2025 17:51:18 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="FG398I6m"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D3AC668AC8 for ; Mon, 21 Apr 2025 17:51:13 +0200 (CEST) Received: from pb-laptop.local (185.221.143.16.nat.pool.zt.hu [185.221.143.16]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 3F4E573E for ; Mon, 21 Apr 2025 17:49:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1745250547; bh=lJE/4kEA7lmIZSAwvqMDjkj9Hk0V14jzAaUalEQYcvI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=FG398I6m+Dc5r+UaeX2b7KfHj9ES2ezCmVSBBfvc2xH27LMWeCyoPiMy1ZmCziqQG +NkHbPvMjlA6B9fiZCyLFpxjxfihXjkWcV9Aw/gssK2B9/gOgh+zHJ1BtwFyoD/+YL fwpCXA6FaFLiXVFaskVYiyQ2Md768Qp6r5l/vB2g= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [RFC PATCH v1 2/5] apps: cam: sdl_texture: Add single plane generic texture Date: Mon, 21 Apr 2025 17:51:06 +0200 Message-ID: <20250421155109.175930-3-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250421155109.175930-1-barnabas.pocze@ideasonboard.com> References: <20250421155109.175930-1-barnabas.pocze@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add the `SDLTexture1Plane` type that can be instantiated with an arbitrary SDL pixel format and that uses `SDL_UpdateTexture()` to update the texture using exactly a single plane. Signed-off-by: Barnabás Pőcze --- src/apps/cam/sdl_texture_1plane.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/apps/cam/sdl_texture_1plane.h diff --git a/src/apps/cam/sdl_texture_1plane.h b/src/apps/cam/sdl_texture_1plane.h new file mode 100644 index 000000000..ded35c589 --- /dev/null +++ b/src/apps/cam/sdl_texture_1plane.h @@ -0,0 +1,18 @@ +#pragma once + +#include + +#include "sdl_texture.h" + +class SDLTexture1Plane final : public SDLTexture +{ +public: + using SDLTexture::SDLTexture; + + void update(libcamera::Span> data) override + { + assert(data.size() == 1); + assert(data[0].size_bytes() == std::size_t(rect_.h * stride_)); + SDL_UpdateTexture(ptr_, nullptr, data[0].data(), stride_); + } +};