Patch Detail
Show a patch.
GET /api/patches/8482/?format=api
{ "id": 8482, "url": "https://patchwork.libcamera.org/api/patches/8482/?format=api", "web_url": "https://patchwork.libcamera.org/patch/8482/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20200628190920.3206340-2-niklas.soderlund@ragnatech.se>", "date": "2020-06-28T19:09:19", "name": "[libcamera-devel,v3,1/2] libcamera: geometry: Add isNull() function to Size class", "commit_ref": "7fc65e9680f604099d5d4f294b37fe7eb93acb03", "pull_url": null, "state": "accepted", "archived": false, "hash": "1295e3e25f266a4e4bd22552ff1e0c39536ec223", "submitter": { "id": 5, "url": "https://patchwork.libcamera.org/api/people/5/?format=api", "name": "Niklas Söderlund", "email": "niklas.soderlund@ragnatech.se" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/8482/mbox/", "series": [ { "id": 1053, "url": "https://patchwork.libcamera.org/api/series/1053/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1053", "date": "2020-06-28T19:09:18", "name": "libcamera: geometry: Add isNull() function to Size class", "version": 3, "mbox": "https://patchwork.libcamera.org/series/1053/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/8482/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/8482/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 6D623C2E69\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 28 Jun 2020 19:09:32 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C2C1860AF2;\n\tSun, 28 Jun 2020 21:09:30 +0200 (CEST)", "from bin-mail-out-05.binero.net (bin-mail-out-05.binero.net\n\t[195.74.38.228])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 51F55609A3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 28 Jun 2020 21:09:29 +0200 (CEST)", "from bismarck.berto.se (p4fca2eca.dip0.t-ipconnect.de\n\t[79.202.46.202]) by bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA\n\tid cea249fb-b972-11ea-86ee-0050569116f7;\n\tSun, 28 Jun 2020 21:08:53 +0200 (CEST)" ], "X-Halon-ID": "cea249fb-b972-11ea-86ee-0050569116f7", "Authorized-sender": "niklas@soderlund.pp.se", "From": "=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Sun, 28 Jun 2020 21:09:19 +0200", "Message-Id": "<20200628190920.3206340-2-niklas.soderlund@ragnatech.se>", "X-Mailer": "git-send-email 2.27.0", "In-Reply-To": "<20200628190920.3206340-1-niklas.soderlund@ragnatech.se>", "References": "<20200628190920.3206340-1-niklas.soderlund@ragnatech.se>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v3 1/2] libcamera: geometry: Add isNull()\n\tfunction to Size class", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "base64", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nIt's common for code to check if a size is null. Add a helper function\nto do so.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Umang Jain <email@uajain.com>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n include/libcamera/geometry.h | 1 +\n src/libcamera/geometry.cpp | 6 ++++++\n test/geometry.cpp | 10 ++++++++++\n 3 files changed, 17 insertions(+)", "diff": "diff --git a/include/libcamera/geometry.h b/include/libcamera/geometry.h\nindex edda42cf34ccbaf0..7d4b8bcfe3d8179e 100644\n--- a/include/libcamera/geometry.h\n+++ b/include/libcamera/geometry.h\n@@ -41,6 +41,7 @@ struct Size {\n \tunsigned int width;\n \tunsigned int height;\n \n+\tbool isNull() const { return !width && !height; }\n \tconst std::string toString() const;\n };\n \ndiff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp\nindex fd78cf2c0ab79f8a..24c44fb43acf66ef 100644\n--- a/src/libcamera/geometry.cpp\n+++ b/src/libcamera/geometry.cpp\n@@ -107,6 +107,12 @@ bool operator==(const Rectangle &lhs, const Rectangle &rhs)\n * \\brief The Size height\n */\n \n+/**\n+ * \\fn bool Size::isNull() const\n+ * \\brief Check if the size is null\n+ * \\return True if both the width and height are 0, or false otherwise\n+ */\n+\n /**\n * \\brief Assemble and return a string describing the size\n * \\return A string describing the size\ndiff --git a/test/geometry.cpp b/test/geometry.cpp\nindex 27e65565d7c60b47..904ad92c944816b4 100644\n--- a/test/geometry.cpp\n+++ b/test/geometry.cpp\n@@ -36,6 +36,16 @@ protected:\n \n \tint run()\n \t{\n+\t\tif (!Size().isNull() || !Size(0, 0).isNull()) {\n+\t\t\tcout << \"Null size incorrectly reported as not null\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (Size(0, 100).isNull() || Size(100, 0).isNull() || Size(100, 100).isNull()) {\n+\t\t\tcout << \"Non-null size incorrectly reported as null\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n \t\t/* Test Size equality and inequality. */\n \t\tif (!compare(Size(100, 100), Size(100, 100), &operator==, \"==\", true))\n \t\t\treturn TestFail;\n", "prefixes": [ "libcamera-devel", "v3", "1/2" ] }