[{"id":1215,"web_url":"https://patchwork.libcamera.org/comment/1215/","msgid":"<20190402163819.GK4805@pendragon.ideasonboard.com>","date":"2019-04-02T16:38:19","subject":"Re: [libcamera-devel] [PATCH v6 02/12] libcamera: geometry: Add\n\tSize structure","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 Tue, Apr 02, 2019 at 06:21:24PM +0200, Jacopo Mondi wrote:\n> Add a simple Size structure that contains an image width and height.\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/libcamera/geometry.cpp       | 29 +++++++++++++++++++++++++++++\n>  src/libcamera/include/geometry.h | 15 +++++++++++++++\n>  2 files changed, 44 insertions(+)\n> \n> diff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp\n> index f76001d94562..30531d0c678a 100644\n> --- a/src/libcamera/geometry.cpp\n> +++ b/src/libcamera/geometry.cpp\n> @@ -105,4 +105,33 @@ const std::string Rectangle::toString() const\n>   * \\brief The maximum image height\n>   */\n>  \n> +/**\n> + * \\struct Size\n> + * \\brief Describe an image size\n> + *\n> + * Size describes the vertical and horizontal sizes of an image.\n\nHow about \"The Size structure defines a two-dimensional size with integer precision\" ?\n\n> + */\n> +\n> +/**\n> + * \\fn Size::Size()\n> + * \\brief Construct a size initialized to 0\n\nConstruct a Size with width and height set to 0\n\n> + */\n> +\n> +/**\n> + * \\fn Size::Size(unsigned int w, unsigned int h)\n\nI'd name the arguments width and height, at least in the documentation.\n\n> + * \\brief Construct an initialized size\n\nConstruct a Size with the given \\a width and \\a height\n\n> + * \\param w The image width\n> + * \\param h The image height\n\nThis could represent the size of something else than an image, I\nwouldn't mention image. Same for the two doxygen comments below.\n\n> + */\n> +\n> +/**\n> + * \\var Size::width\n> + * \\brief The image width\n> + */\n> +\n> +/**\n> + * \\var Size::height\n> + * \\brief The image height\n> + */\n> +\n>  } /* namespace libcamera */\n> diff --git a/src/libcamera/include/geometry.h b/src/libcamera/include/geometry.h\n> index 567a54299b24..24be5e2f6f78 100644\n> --- a/src/libcamera/include/geometry.h\n> +++ b/src/libcamera/include/geometry.h\n> @@ -40,6 +40,21 @@ struct SizeRange {\n>  \tunsigned int maxHeight;\n>  };\n>  \n> +struct Size {\n> +\tSize(void)\n\nNo need for void.\n\n> +\t\t: Size(0, 0)\n> +\t{\n> +\t}\n> +\n> +\tSize(unsigned int w, unsigned int h)\n> +\t\t: width(w), height(h)\n> +\t{\n> +\t}\n> +\n> +\tunsigned int width;\n> +\tunsigned int height;\n\nDo we want to support negative dimensions that would denote an invalid\nor uninitialized size ? The default constructor could set width and\nheight to -1, and we could provide an isValid() function to test for\nthat. Maybe something for later, or is it simple enough that we should\ndo it now ?\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> +};\n> +\n>  } /* namespace libcamera */\n>  \n>  #endif /* __LIBCAMERA_GEOMETRY_H__ */","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 62283610B6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Apr 2019 18:38:30 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C59BA2F9;\n\tTue,  2 Apr 2019 18:38:29 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1554223109;\n\tbh=XewPN2yPBEvfVr9FmZF52sqxreBD1zYXL3UQX/ZU458=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=nDZ4c63rXFYVYOEy20NaLlNbe0kHTqmnDIi5rNak+WUVI8liFnrY8toWR6i2nugtc\n\tE7RGmoLacKB1J4zNfqIdVWcBAgQBNS9Ky/CMyps/JfV/5cRaBnIKxV+O4RtFI2CHd3\n\tsGVgxUU9oAOOyXTt4NIeaaEFnYgo5l0N7DISQb3E=","Date":"Tue, 2 Apr 2019 19:38:19 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"libcamera-devel@lists.libcamera.org","Message-ID":"<20190402163819.GK4805@pendragon.ideasonboard.com>","References":"<20190402162134.3894-1-jacopo@jmondi.org>\n\t<20190402162134.3894-3-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190402162134.3894-3-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v6 02/12] libcamera: geometry: Add\n\tSize structure","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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>","X-List-Received-Date":"Tue, 02 Apr 2019 16:38:30 -0000"}}]