<div dir="ltr"><div dir="ltr">Thanks Jacopo,</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Aug 28, 2024 at 2:10 PM Jacopo Mondi <<a href="mailto:jacopo.mondi@ideasonboard.com" target="_blank">jacopo.mondi@ideasonboard.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi<br>
<br>
On Fri, Aug 23, 2024 at 02:29:08PM GMT, Harvey Yang wrote:<br>
> From: Yudhistira Erlandinata <<a href="mailto:yerlandinata@chromium.org" target="_blank">yerlandinata@chromium.org</a>><br>
><br>
> Add a Rectangle constructor that accepts two points:<br>
> topLeft and bottomRight.<br>
><br>
> BUG=b:308714092<br>
> TEST=emerge-geralt libcamera-mtkisp7<br>
<br>
Please drop them, not related to libcamera<br></blockquote><div>Removed.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
><br>
> Signed-off-by: Yudhistira Erlandinata <<a href="mailto:yerlandinata@chromium.org" target="_blank">yerlandinata@chromium.org</a>><br>
> Co-developed-by: Harvey Yang <<a href="mailto:chenghaoyang@chromium.org" target="_blank">chenghaoyang@chromium.org</a>><br>
> ---<br>
> include/libcamera/geometry.h | 10 ++++++++++<br>
> src/libcamera/geometry.cpp | 11 +++++++++--<br>
> 2 files changed, 19 insertions(+), 2 deletions(-)<br>
><br>
> diff --git a/include/libcamera/geometry.h b/include/libcamera/geometry.h<br>
> index 3e6f0f5d7..978322a22 100644<br>
> --- a/include/libcamera/geometry.h<br>
> +++ b/include/libcamera/geometry.h<br>
> @@ -8,7 +8,9 @@<br>
> #pragma once<br>
><br>
> #include <algorithm><br>
> +#include <assert.h><br>
> #include <ostream><br>
> +#include <stdlib.h><br>
<br>
What is this for ?<br></blockquote><div>Removed. </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> #include <string><br>
><br>
> #include <libcamera/base/compiler.h><br>
> @@ -262,6 +264,14 @@ public:<br>
> {<br>
> }<br>
><br>
> + constexpr Rectangle(const Point &topLeft, const Point &bottomRight)<br>
> + : x(topLeft.x), y(topLeft.y),<br>
> + width(bottomRight.x - x),<br>
> + height(bottomRight.y - y)<br>
> + {<br>
> + assert(bottomRight.x >= x && bottomRight.y >= y);<br>
<br>
assert() is fine, however we have our own ASSERT() defined in log.h<br>
which can be conditionally disabled. The rest of the codebase uses<br>
that.<br></blockquote><div>Right, thanks! Done. </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> + }<br>
> +<br>
> int x;<br>
> int y;<br>
> unsigned int width;<br>
> diff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp<br>
> index 000151364..86385ad35 100644<br>
> --- a/src/libcamera/geometry.cpp<br>
> +++ b/src/libcamera/geometry.cpp<br>
> @@ -5,13 +5,13 @@<br>
> * Geometry-related structures<br>
> */<br>
><br>
> -#include <libcamera/geometry.h><br>
> -<br>
> #include <sstream><br>
> #include <stdint.h><br>
><br>
> #include <libcamera/base/log.h><br>
><br>
> +#include <libcamera/geometry.h><br>
> +<br>
<br>
why ?<br></blockquote><div>My linter went crazy... Reverted.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> /**<br>
> * \file geometry.h<br>
> * \brief Data structures related to geometric objects<br>
> @@ -629,6 +629,13 @@ std::ostream &operator<<(std::ostream &out, const SizeRange &sr)<br>
> * \param[in] size The desired Rectangle size<br>
> */<br>
><br>
> +/**<br>
> + * \fn Rectangle::Rectangle(const Point &topLeft, const Point &bottomRight)<br>
> + * \brief Construct a Rectangle with the two given points<br>
> + * \param[in] topLeft The top-left corner<br>
> + * \param[in] bottomRight The bottom-right corner<br>
> + */<br>
> +<br>
<br>
the rest looks good<br>
<br>
> /**<br>
> * \var Rectangle::x<br>
> * \brief The horizontal coordinate of the rectangle's top-left corner<br>
> --<br>
> 2.46.0.295.g3b9ea8a38a-goog<br>
><br>
</blockquote></div></div>