<div dir="ltr">Thanks Barnabás,<div><br></div><div>Updated on gitlab: <a href="https://gitlab.freedesktop.org/chenghaoyang/libcamera/-/pipelines/1264782">https://gitlab.freedesktop.org/chenghaoyang/libcamera/-/pipelines/1264782</a><br>Will be included in v5.</div><div><br></div><div>BR,</div><div>Harvey</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Sep 4, 2024 at 7:26 PM Barnabás Pőcze <<a href="mailto:pobrn@protonmail.com">pobrn@protonmail.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>
<br>
2024. szeptember 3., kedd 13:39 keltezéssel, Harvey Yang <<a href="mailto:chenghaoyang@chromium.org" target="_blank">chenghaoyang@chromium.org</a>> írta:<br>
<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>
> 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>
> Reviewed-by: Jacopo Mondi <<a href="mailto:jacopo.mondi@ideasonboard.com" target="_blank">jacopo.mondi@ideasonboard.com</a>><br>
> ---<br>
>  include/libcamera/geometry.h |  2 ++<br>
>  src/libcamera/geometry.cpp   | 14 ++++++++++++++<br>
>  2 files changed, 16 insertions(+)<br>
> <br>
> diff --git a/include/libcamera/geometry.h b/include/libcamera/geometry.h<br>
> index 3e6f0f5d7..dc56f180f 100644<br>
> --- a/include/libcamera/geometry.h<br>
> +++ b/include/libcamera/geometry.h<br>
> @@ -262,6 +262,8 @@ public:<br>
>       {<br>
>       }<br>
> <br>
> +     constexpr Rectangle(const Point &topLeft, const Point &bottomRight);<br>
<br>
Don't make this `constexpr` because it is not useful since the definition is not available.<br>
<br>
<br>
Regards,<br>
Barnabás Pőcze<br>
<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..029b8dad2 100644<br>
> --- a/src/libcamera/geometry.cpp<br>
> +++ b/src/libcamera/geometry.cpp<br>
> @@ -629,6 +629,20 @@ 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>
> +constexpr Rectangle::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>
> +<br>
>  /**<br>
>   * \var Rectangle::x<br>
>   * \brief The horizontal coordinate of the rectangle's top-left corner<br>
> --<br>
> 2.46.0.469.g59c65b2a67-goog<br>
> <br>
> <br>
</blockquote></div>