[{"id":11399,"web_url":"https://patchwork.libcamera.org/comment/11399/","msgid":"<20200715062140.GE3051471@oden.dyn.berto.se>","date":"2020-07-15T06:21:40","subject":"Re: [libcamera-devel] [PATCH 2/5] libcamera: geometry: Define\n\tRectangle after Size","submitter":{"id":5,"url":"https://patchwork.libcamera.org/api/people/5/","name":"Niklas Söderlund","email":"niklas.soderlund@ragnatech.se"},"content":"Hi Laurent,\n\nThanks for your work.\n\nOn 2020-07-15 02:40:06 +0300, Laurent Pinchart wrote:\n> A subsequent change to the Rectangle will require the definition of the\n> Size to be available. Define Rectangle after Size to ease review of that\n> change. No code change is included.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nI like moving code around in their own commits :-)\n\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n\n> ---\n>  include/libcamera/geometry.h |  30 ++++-----\n>  src/libcamera/geometry.cpp   | 122 +++++++++++++++++------------------\n>  2 files changed, 76 insertions(+), 76 deletions(-)\n> \n> diff --git a/include/libcamera/geometry.h b/include/libcamera/geometry.h\n> index d217cfd50c86..f3088d33fa2c 100644\n> --- a/include/libcamera/geometry.h\n> +++ b/include/libcamera/geometry.h\n> @@ -13,21 +13,6 @@\n>  \n>  namespace libcamera {\n>  \n> -struct Rectangle {\n> -\tint x;\n> -\tint y;\n> -\tunsigned int width;\n> -\tunsigned int height;\n> -\n> -\tconst std::string toString() const;\n> -};\n> -\n> -bool operator==(const Rectangle &lhs, const Rectangle &rhs);\n> -static inline bool operator!=(const Rectangle &lhs, const Rectangle &rhs)\n> -{\n> -\treturn !(lhs == rhs);\n> -}\n> -\n>  struct Size {\n>  \tSize()\n>  \t\t: Size(0, 0)\n> @@ -141,6 +126,21 @@ static inline bool operator!=(const SizeRange &lhs, const SizeRange &rhs)\n>  \treturn !(lhs == rhs);\n>  }\n>  \n> +struct Rectangle {\n> +\tint x;\n> +\tint y;\n> +\tunsigned int width;\n> +\tunsigned int height;\n> +\n> +\tconst std::string toString() const;\n> +};\n> +\n> +bool operator==(const Rectangle &lhs, const Rectangle &rhs);\n> +static inline bool operator!=(const Rectangle &lhs, const Rectangle &rhs)\n> +{\n> +\treturn !(lhs == rhs);\n> +}\n> +\n>  } /* namespace libcamera */\n>  \n>  #endif /* __LIBCAMERA_GEOMETRY_H__ */\n> diff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp\n> index 4594f9ff435f..5a0bcf7c1e12 100644\n> --- a/src/libcamera/geometry.cpp\n> +++ b/src/libcamera/geometry.cpp\n> @@ -17,67 +17,6 @@\n>  \n>  namespace libcamera {\n>  \n> -/**\n> - * \\struct Rectangle\n> - * \\brief Describe a rectangle's position and dimensions\n> - *\n> - * Rectangles are used to identify an area of an image. They are specified by\n> - * the coordinates of top-left corner and their horizontal and vertical size.\n> - *\n> - * The measure unit of the rectangle coordinates and size, as well as the\n> - * reference point from which the Rectangle::x and Rectangle::y displacements\n> - * refers to, are defined by the context were rectangle is used.\n> - */\n> -\n> -/**\n> - * \\var Rectangle::x\n> - * \\brief The horizontal coordinate of the rectangle's top-left corner\n> - */\n> -\n> -/**\n> - * \\var Rectangle::y\n> - * \\brief The vertical coordinate of the rectangle's top-left corner\n> - */\n> -\n> -/**\n> - * \\var Rectangle::width\n> - * \\brief The distance between the left and right sides\n> - */\n> -\n> -/**\n> - * \\var Rectangle::height\n> - * \\brief The distance between the top and bottom sides\n> - */\n> -\n> -/**\n> - * \\brief Assemble and return a string describing the rectangle\n> - * \\return A string describing the Rectangle\n> - */\n> -const std::string Rectangle::toString() const\n> -{\n> -\tstd::stringstream ss;\n> -\n> -\tss << \"(\" << x << \"x\" << y << \")/\" << width << \"x\" << height;\n> -\n> -\treturn ss.str();\n> -}\n> -\n> -/**\n> - * \\brief Compare rectangles for equality\n> - * \\return True if the two rectangles are equal, false otherwise\n> - */\n> -bool operator==(const Rectangle &lhs, const Rectangle &rhs)\n> -{\n> -\treturn lhs.x == rhs.x && lhs.y == rhs.y &&\n> -\t       lhs.width == rhs.width && lhs.height == rhs.height;\n> -}\n> -\n> -/**\n> - * \\fn bool operator!=(const Rectangle &lhs, const Rectangle &rhs)\n> - * \\brief Compare rectangles for inequality\n> - * \\return True if the two rectangles are not equal, false otherwise\n> - */\n> -\n>  /**\n>   * \\struct Size\n>   * \\brief Describe a two-dimensional size\n> @@ -346,4 +285,65 @@ bool operator==(const SizeRange &lhs, const SizeRange &rhs)\n>   * \\return True if the two size ranges are not equal, false otherwise\n>   */\n>  \n> +/**\n> + * \\struct Rectangle\n> + * \\brief Describe a rectangle's position and dimensions\n> + *\n> + * Rectangles are used to identify an area of an image. They are specified by\n> + * the coordinates of top-left corner and their horizontal and vertical size.\n> + *\n> + * The measure unit of the rectangle coordinates and size, as well as the\n> + * reference point from which the Rectangle::x and Rectangle::y displacements\n> + * refers to, are defined by the context were rectangle is used.\n> + */\n> +\n> +/**\n> + * \\var Rectangle::x\n> + * \\brief The horizontal coordinate of the rectangle's top-left corner\n> + */\n> +\n> +/**\n> + * \\var Rectangle::y\n> + * \\brief The vertical coordinate of the rectangle's top-left corner\n> + */\n> +\n> +/**\n> + * \\var Rectangle::width\n> + * \\brief The distance between the left and right sides\n> + */\n> +\n> +/**\n> + * \\var Rectangle::height\n> + * \\brief The distance between the top and bottom sides\n> + */\n> +\n> +/**\n> + * \\brief Assemble and return a string describing the rectangle\n> + * \\return A string describing the Rectangle\n> + */\n> +const std::string Rectangle::toString() const\n> +{\n> +\tstd::stringstream ss;\n> +\n> +\tss << \"(\" << x << \"x\" << y << \")/\" << width << \"x\" << height;\n> +\n> +\treturn ss.str();\n> +}\n> +\n> +/**\n> + * \\brief Compare rectangles for equality\n> + * \\return True if the two rectangles are equal, false otherwise\n> + */\n> +bool operator==(const Rectangle &lhs, const Rectangle &rhs)\n> +{\n> +\treturn lhs.x == rhs.x && lhs.y == rhs.y &&\n> +\t       lhs.width == rhs.width && lhs.height == rhs.height;\n> +}\n> +\n> +/**\n> + * \\fn bool operator!=(const Rectangle &lhs, const Rectangle &rhs)\n> + * \\brief Compare rectangles for inequality\n> + * \\return True if the two rectangles are not equal, false otherwise\n> + */\n> +\n>  } /* namespace libcamera */\n> -- \n> Regards,\n> \n> Laurent Pinchart\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","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 402E0BD790\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 15 Jul 2020 06:21:43 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0C6CC60930;\n\tWed, 15 Jul 2020 08:21:43 +0200 (CEST)","from mail-lj1-x242.google.com (mail-lj1-x242.google.com\n\t[IPv6:2a00:1450:4864:20::242])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B542360929\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 15 Jul 2020 08:21:41 +0200 (CEST)","by mail-lj1-x242.google.com with SMTP id e4so1278622ljn.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Jul 2020 23:21:41 -0700 (PDT)","from localhost (h-209-203.A463.priv.bahnhof.se. [155.4.209.203])\n\tby smtp.gmail.com with ESMTPSA id m9sm282985lfb.5.2020.07.14.23.21.40\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 14 Jul 2020 23:21:40 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=ragnatech-se.20150623.gappssmtp.com\n\theader.i=@ragnatech-se.20150623.gappssmtp.com\n\theader.b=\"J+qpkFgO\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ragnatech-se.20150623.gappssmtp.com; s=20150623;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:content-transfer-encoding:in-reply-to;\n\tbh=qMkDCrWQmHQD5UHAgb/Foq8ms3wgdNG6++zHlb1OzfU=;\n\tb=J+qpkFgOeMoXPSbTyQuwBJsDVunon7cVtJgZ4YzklyAe13ySBsceofEgP8C5TTog2P\n\tOhsb6GAKZ5/NURXybwIa8+GceTc+fg2kbzgIbrGahG6B163EXm0rYqFZnca7r9ipc9md\n\tv0FqttqKNo7KwVEqQiCzSnnNy8NMFzLZahGHii/gEOBM69kOcZuZMc58cFGAS90UI1/D\n\tDh8ajEMlJglia3uyZjTgIgv9u9ZINzpS2ZB0ixgjfqlTFnKhY0B2vW1EeXVCF+gxfxV/\n\t8V0krToZUeABcilELP6la+xKT3Lv0H29Fczc0hsd3OMPX3wj5fu6TR4D2gDN8o5z9ZrQ\n\tJWCw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:content-transfer-encoding\n\t:in-reply-to;\n\tbh=qMkDCrWQmHQD5UHAgb/Foq8ms3wgdNG6++zHlb1OzfU=;\n\tb=jyY/RG+37oWP8X5SW5haSk6SMgWR37f1U9MhTKOB3zOYvSpMK31hGVf2H6sswdfksR\n\tdb/wcsZ/zL+UHY0JUhifEwuyf1QMbjdkM3jLYYcolAUWDg49vpwnwPfsoYua6pc0GRqv\n\tuHSxMdVJ48cM+BfzS5f2o8dcu/k+sR4ln7Wl78PVap1zHH/MDhf8RzZ/dhJ+wjpT1AjR\n\twHXEr6qaFNWfBqQssZahWv2kVaA0GjJ2qRl7MlfjE6QzebHwuyCouesLxgt2yvYug/FD\n\tFum95HnwQJQtsZlKMj2W8JRl1AgDriM3XQobc1UY2RoHXItInJ/nJMGagBGXFjXpNaFL\n\t4aJg==","X-Gm-Message-State":"AOAM533k3Dunt03+oBO0D+yGXqHuTbEY/GKbDi5LvwLV2dhnmGL69+Dj\n\twyDEdIddKCwQzG4hjjqm74a4gbSTQxk=","X-Google-Smtp-Source":"ABdhPJzrFB9iQVpci10Is+Mw9RtqMhB2rQ66xUBDV+R6weBe1ihVx6ZUPbPWgMMY/fxLpgt+Hy0eJA==","X-Received":"by 2002:a2e:860d:: with SMTP id\n\ta13mr4111165lji.128.1594794101133; \n\tTue, 14 Jul 2020 23:21:41 -0700 (PDT)","Date":"Wed, 15 Jul 2020 08:21:40 +0200","From":"Niklas =?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Message-ID":"<20200715062140.GE3051471@oden.dyn.berto.se>","References":"<20200714234009.16596-1-laurent.pinchart@ideasonboard.com>\n\t<20200714234009.16596-3-laurent.pinchart@ideasonboard.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200714234009.16596-3-laurent.pinchart@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH 2/5] libcamera: geometry: Define\n\tRectangle after Size","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=\"iso-8859-1\"","Content-Transfer-Encoding":"quoted-printable","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]