Laurent Pinchart
37958dfd71
libcamera: Replace toString with operator<<() for geometry classes
...
Now that geometry classes implement the stream formatting operator<<(),
use it instead of the toString() function.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com >
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com >
2022-05-04 14:11:25 +03:00
Laurent Pinchart
e229b35edf
libcamera: geometry: Add Size members to grown or shrink by a margin
...
Add four new member functions to the Size class (two in-place and two
const) to grow and shrink a Size by given margins.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com >
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org >
2021-10-15 05:05:17 +03:00
David Plowman and Laurent Pinchart
44b5292ae3
test: geometry: Add unit tests for new geometry helper functions
...
Signed-off-by: David Plowman <david.plowman@raspberrypi.com >
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com >
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com >
2020-10-27 14:06:51 +02:00
Jacopo Mondi
dd0793ed1b
libcamera: geometry: Add isNull() function to Rectangle class
...
It's common for code to check if a rectangle is null. Add a helper function
to do so and test the function in test/geometry.cpp
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com >
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se >
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org >
2020-08-03 11:16:16 +02:00
Laurent Pinchart
d5446e9f32
libcamera: geometry: Provide in-place versions of the Size helpers
...
Add alignDownTo(), alignUpTo(), boundTo() and expandTo() helper
functions to the Size class. These are in-place versions of the existing
alignedDownTo(), alignedUpTo(), boundedTo() and expandedTo() functions.
The new helpers return a reference to the size, to allow chaining the
functions. One can thus write
size.alignDownTo(16, 16).alignUpTo(32, 32)
.boundTo({ 40, 80 }).expandTo({ 16, 80 });
instead of
size.alignDownTo(16, 16);
size.alignUpTo(32, 32);
size.boundTo({ 40, 80 });
size.expandTo({ 16, 80 });
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com >
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org >
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com >
2020-07-15 17:33:54 +03:00
Laurent Pinchart
6c0afb8b33
libcamera: geometry: Add helper functions to the Size class
...
Pipeline handlers commonly have to calculate the minimum or maximum of
multiple sizes, or align a size's width and height. Add helper functions
to the Size class to perform those tasks.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com >
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org >
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com >
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se >
2020-07-15 00:27:26 +03:00
Laurent Pinchart and Niklas Söderlund
7fc65e9680
libcamera: geometry: Add isNull() function to Size class
...
It's common for code to check if a size is null. Add a helper function
to do so.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com >
Reviewed-by: Umang Jain <email@uajain.com >
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org >
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se >
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se >
2020-06-29 16:17:34 +02:00
Laurent Pinchart
2059b857e1
test: geometry: Add tests for Size class comparison operators
...
Add a test that exercises all the comparison operators for the Size
class.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com >
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se >
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org >
2019-04-18 18:13:10 +03:00