[{"id":11326,"web_url":"https://patchwork.libcamera.org/comment/11326/","msgid":"<20200710121311.GR5964@pendragon.ideasonboard.com>","date":"2020-07-10T12:13:11","subject":"Re: [libcamera-devel] [PATCH v2 16/20] libcamera: geometry: Add\n\tisNull() function to Rectangle class","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Jacopo,\n\nThank you for the patch.\n\nOn Thu, Jul 09, 2020 at 10:41:24AM +0200, Jacopo Mondi wrote:\n> It's common for code to check if a rectangle is null. Add a helper function\n> to do so.\n> \n> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  include/libcamera/geometry.h | 1 +\n>  src/libcamera/geometry.cpp   | 6 ++++++\n>  2 files changed, 7 insertions(+)\n> \n> diff --git a/include/libcamera/geometry.h b/include/libcamera/geometry.h\n> index 7d4b8bcfe3d8..44561d9cc5a4 100644\n> --- a/include/libcamera/geometry.h\n> +++ b/include/libcamera/geometry.h\n> @@ -18,6 +18,7 @@ struct Rectangle {\n>  \tunsigned int width;\n>  \tunsigned int height;\n>  \n> +\tbool isNull() const { return !width && !height; }\n>  \tconst std::string toString() const;\n>  };\n>  \n> diff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp\n> index 24c44fb43acf..af29ed1119fe 100644\n> --- a/src/libcamera/geometry.cpp\n> +++ b/src/libcamera/geometry.cpp\n> @@ -49,6 +49,12 @@ namespace libcamera {\n>   * \\brief The distance between the top and bottom sides\n>   */\n>  \n> +/**\n> + * \\fn bool Rectangle::isNull() const\n> + * \\brief Check if the rectangle 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 rectangle\n>   * \\return A string describing the Rectangle","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 E595CBD790\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 10 Jul 2020 12:13:19 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B3A2F613C9;\n\tFri, 10 Jul 2020 14:13:19 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9F7856118A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 10 Jul 2020 14:13:18 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 293992C0;\n\tFri, 10 Jul 2020 14:13:18 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"aRBlACLp\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1594383198;\n\tbh=Jqsqspx+zQn6hqWB19ieVh2+y8NSfgbgmzUb+Freu24=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=aRBlACLpDBpCBeBWlzw5PTfp8ur2Xx1Oh/WuVGNQCc4cTDcU2FQGYLSwHX6hlXfOw\n\tsDdqLwOa3+meWzhP5N89CQAtj87WxGSxNYj9XHFsFpetIMyEz4cG84r5zK8QV2Zasv\n\tTRstIkIZiYfXW1yR+9R8DNQzRwgHiEcD4qURJK1o=","Date":"Fri, 10 Jul 2020 15:13:11 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<20200710121311.GR5964@pendragon.ideasonboard.com>","References":"<20200709084128.5316-1-jacopo@jmondi.org>\n\t<20200709084128.5316-17-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200709084128.5316-17-jacopo@jmondi.org>","Subject":"Re: [libcamera-devel] [PATCH v2 16/20] libcamera: geometry: Add\n\tisNull() function to Rectangle 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>","Cc":"libcamera-devel@lists.libcamera.org","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>"}},{"id":11327,"web_url":"https://patchwork.libcamera.org/comment/11327/","msgid":"<20200710121359.GS5964@pendragon.ideasonboard.com>","date":"2020-07-10T12:13:59","subject":"Re: [libcamera-devel] [PATCH v2 16/20] libcamera: geometry: Add\n\tisNull() function to Rectangle class","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Fri, Jul 10, 2020 at 03:13:12PM +0300, Laurent Pinchart wrote:\n> Hi Jacopo,\n> \n> Thank you for the patch.\n> \n> On Thu, Jul 09, 2020 at 10:41:24AM +0200, Jacopo Mondi wrote:\n> > It's common for code to check if a rectangle is null. Add a helper function\n> > to do so.\n> > \n> > Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> \n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nI spoke a bit too fast, you should add a test case for this.\n\n> > ---\n> >  include/libcamera/geometry.h | 1 +\n> >  src/libcamera/geometry.cpp   | 6 ++++++\n> >  2 files changed, 7 insertions(+)\n> > \n> > diff --git a/include/libcamera/geometry.h b/include/libcamera/geometry.h\n> > index 7d4b8bcfe3d8..44561d9cc5a4 100644\n> > --- a/include/libcamera/geometry.h\n> > +++ b/include/libcamera/geometry.h\n> > @@ -18,6 +18,7 @@ struct Rectangle {\n> >  \tunsigned int width;\n> >  \tunsigned int height;\n> >  \n> > +\tbool isNull() const { return !width && !height; }\n> >  \tconst std::string toString() const;\n> >  };\n> >  \n> > diff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp\n> > index 24c44fb43acf..af29ed1119fe 100644\n> > --- a/src/libcamera/geometry.cpp\n> > +++ b/src/libcamera/geometry.cpp\n> > @@ -49,6 +49,12 @@ namespace libcamera {\n> >   * \\brief The distance between the top and bottom sides\n> >   */\n> >  \n> > +/**\n> > + * \\fn bool Rectangle::isNull() const\n> > + * \\brief Check if the rectangle 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 rectangle\n> >   * \\return A string describing the Rectangle","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 7A0BBBD790\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 10 Jul 2020 12:14:07 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 48F8D613C8;\n\tFri, 10 Jul 2020 14:14:07 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 09E866118A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 10 Jul 2020 14:14:06 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 91F062C0;\n\tFri, 10 Jul 2020 14:14:05 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"vO4Hz+b4\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1594383245;\n\tbh=fzNhfhXI5D8Y55fAe65Q5VMdnH5jjT6y6PDOU3Z9G2o=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=vO4Hz+b4MOBe3QFYcE6HlS9X++XnW0zhNt5Vcr/xyFVig9tdPgihv/9CuoT4Q3bbE\n\t32M7ILfTYqA6cQeM1t1Pzs6SUG+hQBVMnpwVVc1AZo9z1lERAF+ErKAiYJ6CjN2iz2\n\t9nkxyDHAD/p76cwx4AUPus10ySEdnpRZ2TZJndxk=","Date":"Fri, 10 Jul 2020 15:13:59 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<20200710121359.GS5964@pendragon.ideasonboard.com>","References":"<20200709084128.5316-1-jacopo@jmondi.org>\n\t<20200709084128.5316-17-jacopo@jmondi.org>\n\t<20200710121311.GR5964@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200710121311.GR5964@pendragon.ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v2 16/20] libcamera: geometry: Add\n\tisNull() function to Rectangle 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>","Cc":"libcamera-devel@lists.libcamera.org","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>"}}]