libcamera: Use Size::isNull()

Use the new Size::isNull() function through the code base to replace
manual checks. While the new code isn't equivalent, as isNull() checks
that both width and height are zero, it catches the same conditions in
practice.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <email@uajain.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
Laurent Pinchart 2020-06-26 05:12:28 +03:00
parent 61f4296ac7
commit b5f6a2ce2f
3 changed files with 4 additions and 4 deletions

View file

@ -185,7 +185,7 @@ void IPU3CameraConfiguration::adjustStream(StreamConfiguration &cfg, bool scale)
* Provide a suitable default that matches the sensor aspect
* ratio.
*/
if (!cfg.size.width || !cfg.size.height) {
if (cfg.size.isNull()) {
cfg.size.width = 1280;
cfg.size.height = 1280 * cio2Configuration_.size.height
/ cio2Configuration_.size.width;

View file

@ -506,7 +506,7 @@ CameraConfiguration::Status RkISP1CameraConfiguration::validate()
MEDIA_BUS_FMT_SGRBG8_1X8,
MEDIA_BUS_FMT_SRGGB8_1X8 },
cfg.size);
if (!sensorFormat_.size.width || !sensorFormat_.size.height)
if (sensorFormat_.size.isNull())
sensorFormat_.size = sensor->resolution();
/*
@ -517,7 +517,7 @@ CameraConfiguration::Status RkISP1CameraConfiguration::validate()
*/
const Size size = cfg.size;
if (!cfg.size.width || !cfg.size.height) {
if (cfg.size.isNull()) {
cfg.size.width = 1280;
cfg.size.height = 1280 * sensorFormat_.size.height
/ sensorFormat_.size.width;

View file

@ -67,7 +67,7 @@ int FormatHandlingTest::run()
return TestFail;
}
if (format.size.width == 0 || format.size.height == 0) {
if (format.size.isNull()) {
cerr << "Failed to update image format" << endl;
return TestFail;
}