From patchwork Fri Oct 10 03:42:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 574 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1760067824; bh=6mgFPRIzQjg/wL9arcBls5B0hhD11Lj8BG7rdAel/e0=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=LVg3sT29urAUk+7ChtH0l/ksB145+QQFsO3ndCuU3IivPVHfCk8cmxH/H/Lz6NpaB XhvL7/MoFC8NGzwfKzTN4ua+/AW+fwtRE3wb2IPkjKuRb/bCAR0126HToIu+Opw5WJ XalYhKqbuj/kkR8wfNZ/joroG/s7RttOIzOBJNf+XIC4D0C1zfB++ehJQiZ38hh5+J XRIF2tQC21HwlfILO9oJPc+hmEccu81jDYzNnt4RDq+SkbhaTamG4ey+k948Tn8Frk lbYOxp+g5EBn5HoLq09V5+JA/+Ca+I7gmU0Z3EuoiPfCJ2npetsye5KPlAj473OE3V 90FvuMZa1tlpQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DF50968084 for ; Thu, 9 Oct 2025 21:43:44 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 8GkLvCrj7dY8 for ; Thu, 9 Oct 2025 21:43:44 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1760067823; bh=6mgFPRIzQjg/wL9arcBls5B0hhD11Lj8BG7rdAel/e0=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=mx6/vJHeFZb962k9e7RJxjEdug61uLbajXAkrdPtFWZj96kBlCQCZJlpYfGH+2CVB hC7+huGQUzR/1tNqB22YHnQtL/a5tRXMZ2APu8w9n9PfDjEltBXlZ36OA/DxydqAhC SQLnJEfIDoverOmTNzCeEBaqWIsFGGgOoY1e4mXcEo15D+6TgJ3csX+ZiI0gGx2IU6 4Fmf94ugAUgx42Bt7au8lplIGgNBhW/vuiIkYzxQDa8Zz6P5BCVB704fjKlaPTjwTJ j6ZiMFF4/zm9IXMNYuwKFGuG85hg1UsjybKNEdEqQMCoXFWD54RsNxahvKwonFj02/ XFZPG5jmXKkxA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E641167FE9 for ; Thu, 9 Oct 2025 21:43:43 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1760067821; bh=JHku3ka3SENUBK7GQjKoSpGGE+jvfW3JYtOxCWDY6b4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LW+swe3bmdtn68ozXnqfJUyqXxdzT40K0xrmbwd+FUVPJtDjTLz6g7jTXHApFF+NA wxtWqLNHamfne1Wl06b0/QYuiYYxnvohdjQ+jmZ6/xWRtSY66QjFXOXd9icAZalVpo YXd5hHx53DdUKZrknF/e5YxNTnDE9HCbPX6LJ6ZeiaTlakIJE5+nhYT8wQlA9FV8dR vRuWwtluAQ8Gja2U/yjJunlnB+v0wvRGbhxLhzgVQd282Jv3avKDz/oQcte3SZND4l lDLEapUG6p2qmJ9aBxUTn8xdWDjwR8wA44Tx49tb+BT/cv6JjGpVbaEuHnWtgi+nfR QLaFNcp/hSxCA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4099F67FC1; Thu, 9 Oct 2025 21:43:41 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id gygIaFaWdGWM; Thu, 9 Oct 2025 21:43:41 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1760067819; bh=zdAoW5HgddvDAymURY4iMIXEM9VzbF6EraeYLuAAxCY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PDvt0M4taukKalHDsAVzfQx46/yFRBasSm4d/AAd4LiVKIDl4wgRJdaZXlY9qBEID e+crdt8KBXsql2KwhMZWqLMC7fBD00BcFvHHkEGO/nZonmD6+QjGpUkK6eC48+0iNK RMXEnT1seqy3KvMrcC5Y1YtAYcQywpfL3IQ3UplB58mnS8UewJgkum/S6yK94Gdaz9 VFlWLXZz9MUrej5j5cJR2OmobdQi7+6fwach7AY3SXVLSEHRLXw8AAQ/GEQuLB6zGa UAuLG4hRbL1qG5LQACxqrlfT8Ir9iIkTXA8wJKsahcWYwq22RYnGnwLyrH4/pLC2rS GcCb0/jlUPYOg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 7427268030; Thu, 9 Oct 2025 21:43:39 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Thu, 9 Oct 2025 21:42:36 -0600 Message-ID: <20251010034255.1099728-9-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251010034255.1099728-1-sjg@u-boot.org> References: <20251010034255.1099728-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: ZLGOQA47YJ432F6CAZD2QY6NBYIFFUCS X-Message-ID-Hash: ZLGOQA47YJ432F6CAZD2QY6NBYIFFUCS X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 08/18] expo: Provide a version of scene_within() with takes an obj List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass When the object pointer is already available we don't want to have to look it up. Provide a new is_within() function which takes an object pointer instead of an ID. Signed-off-by: Simon Glass --- boot/scene.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/boot/scene.c b/boot/scene.c index c2e4d8e1330..c1ecbfcc67a 100644 --- a/boot/scene.c +++ b/boot/scene.c @@ -1129,6 +1129,22 @@ int scene_send_key(struct scene *scn, int key, struct expo_action *event) return 0; } +/** + * is_within() - check if a point is considered within an object ID + * + * @scn: Scene to check + * @obj: object to check + * @x: X coordinate of the point + * @y: Y coordinate of the point + * Return: true if the point is considered within the object, false if not + */ +static bool is_within(const struct scene_obj *obj, int x, int y) +{ + /* Check if point (x, y) is within object's bounding box */ + return (x >= obj->bbox.x0 && x <= obj->bbox.x1 && + y >= obj->bbox.y0 && y <= obj->bbox.y1); +} + bool scene_within(const struct scene *scn, uint id, int x, int y) { struct scene_obj *obj; @@ -1141,9 +1157,7 @@ bool scene_within(const struct scene *scn, uint id, int x, int y) log_debug("- id %d: '%s' bbox x0 %d y0 %d x1 %d y1 %d\n", id, obj->name, obj->bbox.x0, obj->bbox.y0, obj->bbox.x1, obj->bbox.x1); - /* Check if point (x, y) is within object's bounding box */ - return (x >= obj->bbox.x0 && x <= obj->bbox.x1 && - y >= obj->bbox.y0 && y <= obj->bbox.y1); + return is_within(obj, x, y); } bool scene_obj_within(const struct scene *scn, struct scene_obj *obj, int x,