[libcamera-devel,v7,01/13] libcamera: geometry: Add 0-initialized SizeRange constructor

Message ID 20190402171309.6447-2-jacopo@jmondi.org
State Superseded
Headers show
Series
  • libcamera: ipu3: Add ImgU support
Related show

Commit Message

Jacopo Mondi April 2, 2019, 5:12 p.m. UTC
Add constructor to SizeRange which initialize all the size range fields
to 0.

While at there make the in-line constructor declarations respect the
coding style by moving braces to a new line.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/libcamera/geometry.cpp       | 11 ++++++++++-
 src/libcamera/include/geometry.h |  9 ++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

Comments

Laurent Pinchart April 2, 2019, 5:41 p.m. UTC | #1
Hi Jacopo,

Thank you for the patch.

On Tue, Apr 02, 2019 at 07:12:57PM +0200, Jacopo Mondi wrote:
> Add constructor to SizeRange which initialize all the size range fields
> to 0.
> 
> While at there make the in-line constructor declarations respect the
> coding style by moving braces to a new line.
> 
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> ---
>  src/libcamera/geometry.cpp       | 11 ++++++++++-
>  src/libcamera/include/geometry.h |  9 ++++++++-
>  2 files changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp
> index 6dc8e74d2801..f76001d94562 100644
> --- a/src/libcamera/geometry.cpp
> +++ b/src/libcamera/geometry.cpp
> @@ -73,7 +73,16 @@ const std::string Rectangle::toString() const
>  
>  /**
>   * \fn SizeRange::SizeRange()
> - * \brief Construct a size range
> + * \brief Construct a size range initialized to 0
> + */
> +
> +/**
> + * \fn SizeRange::SizeRange(unsigned int minW, unsigned int minH, unsigned int maxW, unsigned int maxH)
> + * \brief Construct an initialized size range
> + * \param minW The minimum width
> + * \param minH The minimum height
> + * \param maxW The maximum width
> + * \param maxH The maximum height
>   */
>  
>  /**
> diff --git a/src/libcamera/include/geometry.h b/src/libcamera/include/geometry.h
> index b14f9732f3db..567a54299b24 100644
> --- a/src/libcamera/include/geometry.h
> +++ b/src/libcamera/include/geometry.h
> @@ -22,10 +22,17 @@ struct Rectangle {
>  };
>  
>  struct SizeRange {
> +	SizeRange(void)

s/void//

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> +		: SizeRange(0, 0, 0, 0)
> +	{
> +	}
> +
>  	SizeRange(unsigned int minW, unsigned int minH,
>  		  unsigned int maxW, unsigned int maxH)
>  		: minWidth(minW), minHeight(minH), maxWidth(maxW),
> -		  maxHeight(maxH) {}
> +		  maxHeight(maxH)
> +	{
> +	}
>  
>  	unsigned int minWidth;
>  	unsigned int minHeight;
Niklas Söderlund April 2, 2019, 6:01 p.m. UTC | #2
Hi Jacopo,

Thanks for your work.

On 2019-04-02 19:12:57 +0200, Jacopo Mondi wrote:
> Add constructor to SizeRange which initialize all the size range fields
> to 0.
> 
> While at there make the in-line constructor declarations respect the
> coding style by moving braces to a new line.
> 
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

> ---
>  src/libcamera/geometry.cpp       | 11 ++++++++++-
>  src/libcamera/include/geometry.h |  9 ++++++++-
>  2 files changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp
> index 6dc8e74d2801..f76001d94562 100644
> --- a/src/libcamera/geometry.cpp
> +++ b/src/libcamera/geometry.cpp
> @@ -73,7 +73,16 @@ const std::string Rectangle::toString() const
>  
>  /**
>   * \fn SizeRange::SizeRange()
> - * \brief Construct a size range
> + * \brief Construct a size range initialized to 0
> + */
> +
> +/**
> + * \fn SizeRange::SizeRange(unsigned int minW, unsigned int minH, unsigned int maxW, unsigned int maxH)
> + * \brief Construct an initialized size range
> + * \param minW The minimum width
> + * \param minH The minimum height
> + * \param maxW The maximum width
> + * \param maxH The maximum height
>   */
>  
>  /**
> diff --git a/src/libcamera/include/geometry.h b/src/libcamera/include/geometry.h
> index b14f9732f3db..567a54299b24 100644
> --- a/src/libcamera/include/geometry.h
> +++ b/src/libcamera/include/geometry.h
> @@ -22,10 +22,17 @@ struct Rectangle {
>  };
>  
>  struct SizeRange {
> +	SizeRange(void)
> +		: SizeRange(0, 0, 0, 0)
> +	{
> +	}
> +
>  	SizeRange(unsigned int minW, unsigned int minH,
>  		  unsigned int maxW, unsigned int maxH)
>  		: minWidth(minW), minHeight(minH), maxWidth(maxW),
> -		  maxHeight(maxH) {}
> +		  maxHeight(maxH)
> +	{
> +	}
>  
>  	unsigned int minWidth;
>  	unsigned int minHeight;
> -- 
> 2.21.0
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch

diff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp
index 6dc8e74d2801..f76001d94562 100644
--- a/src/libcamera/geometry.cpp
+++ b/src/libcamera/geometry.cpp
@@ -73,7 +73,16 @@  const std::string Rectangle::toString() const
 
 /**
  * \fn SizeRange::SizeRange()
- * \brief Construct a size range
+ * \brief Construct a size range initialized to 0
+ */
+
+/**
+ * \fn SizeRange::SizeRange(unsigned int minW, unsigned int minH, unsigned int maxW, unsigned int maxH)
+ * \brief Construct an initialized size range
+ * \param minW The minimum width
+ * \param minH The minimum height
+ * \param maxW The maximum width
+ * \param maxH The maximum height
  */
 
 /**
diff --git a/src/libcamera/include/geometry.h b/src/libcamera/include/geometry.h
index b14f9732f3db..567a54299b24 100644
--- a/src/libcamera/include/geometry.h
+++ b/src/libcamera/include/geometry.h
@@ -22,10 +22,17 @@  struct Rectangle {
 };
 
 struct SizeRange {
+	SizeRange(void)
+		: SizeRange(0, 0, 0, 0)
+	{
+	}
+
 	SizeRange(unsigned int minW, unsigned int minH,
 		  unsigned int maxW, unsigned int maxH)
 		: minWidth(minW), minHeight(minH), maxWidth(maxW),
-		  maxHeight(maxH) {}
+		  maxHeight(maxH)
+	{
+	}
 
 	unsigned int minWidth;
 	unsigned int minHeight;