[libcamera-devel] [PATCH 4/5] libcamera: geometry: Turn Size and Rectangle into classes

Niklas Söderlund niklas.soderlund at ragnatech.se
Wed Jul 15 08:35:17 CEST 2020


Hi Laurent,

Thanks for your work.

On 2020-07-15 02:40:08 +0300, Laurent Pinchart wrote:
> SizeRange is defined as a class while Size and Rectangle are defined as
> struct. This is confusing for users in forward declarations. Simplify it
> by turning both structures into classes.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

Ahh, maybe I shall finish my morning coffee before I start my review 
round :-)

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

> ---
>  include/libcamera/geometry.h              | 10 +++++++---
>  src/libcamera/pipeline/ipu3/cio2.h        |  2 +-
>  src/libcamera/pipeline/ipu3/imgu.h        |  2 +-
>  src/libcamera/pipeline/simple/converter.h |  2 +-
>  4 files changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/include/libcamera/geometry.h b/include/libcamera/geometry.h
> index 380248ac9a50..16c94a4861d6 100644
> --- a/include/libcamera/geometry.h
> +++ b/include/libcamera/geometry.h
> @@ -2,7 +2,7 @@
>  /*
>   * Copyright (C) 2019, Google Inc.
>   *
> - * geometry.h - Geometry-related structure
> + * geometry.h - Geometry-related classes
>   */
>  
>  #ifndef __LIBCAMERA_GEOMETRY_H__
> @@ -13,7 +13,9 @@
>  
>  namespace libcamera {
>  
> -struct Size {
> +class Size
> +{
> +public:
>  	Size()
>  		: Size(0, 0)
>  	{
> @@ -126,7 +128,9 @@ static inline bool operator!=(const SizeRange &lhs, const SizeRange &rhs)
>  	return !(lhs == rhs);
>  }
>  
> -struct Rectangle {
> +class Rectangle
> +{
> +public:
>  	Rectangle()
>  		: Rectangle(0, 0, 0, 0)
>  	{
> diff --git a/src/libcamera/pipeline/ipu3/cio2.h b/src/libcamera/pipeline/ipu3/cio2.h
> index 4fd949f8e513..956355a0aa58 100644
> --- a/src/libcamera/pipeline/ipu3/cio2.h
> +++ b/src/libcamera/pipeline/ipu3/cio2.h
> @@ -21,8 +21,8 @@ class CameraSensor;
>  class FrameBuffer;
>  class MediaDevice;
>  class Request;
> +class Size;
>  class V4L2Subdevice;
> -struct Size;
>  struct StreamConfiguration;
>  
>  class CIO2Device
> diff --git a/src/libcamera/pipeline/ipu3/imgu.h b/src/libcamera/pipeline/ipu3/imgu.h
> index 5c124af2e9fe..23ec1ca1c6ae 100644
> --- a/src/libcamera/pipeline/ipu3/imgu.h
> +++ b/src/libcamera/pipeline/ipu3/imgu.h
> @@ -17,7 +17,7 @@ namespace libcamera {
>  
>  class FrameBuffer;
>  class MediaDevice;
> -struct Size;
> +class Size;
>  struct StreamConfiguration;
>  
>  class ImgUDevice
> diff --git a/src/libcamera/pipeline/simple/converter.h b/src/libcamera/pipeline/simple/converter.h
> index 8ca88912b4be..78296680aa14 100644
> --- a/src/libcamera/pipeline/simple/converter.h
> +++ b/src/libcamera/pipeline/simple/converter.h
> @@ -20,7 +20,7 @@ namespace libcamera {
>  
>  class FrameBuffer;
>  class MediaDevice;
> -struct Size;
> +class Size;
>  class SizeRange;
>  struct StreamConfiguration;
>  class V4L2M2MDevice;
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

-- 
Regards,
Niklas Söderlund


More information about the libcamera-devel mailing list