From bd2b002d1458510bdc07446b6e49591fa2258e99 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Thu, 19 Sep 2024 19:42:02 +0800 Subject: [PATCH] Display: always print inches in integer --- src/modules/display/display.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/display/display.c b/src/modules/display/display.c index 4e3f67eb3..ff1c93528 100644 --- a/src/modules/display/display.c +++ b/src/modules/display/display.c @@ -100,7 +100,7 @@ void ffPrintDisplay(FFDisplayOptions* options) } FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreate(); - double inch = sqrt(result->physicalWidth * result->physicalWidth + result->physicalHeight * result->physicalHeight) / 25.4; + uint32_t inch = (uint32_t) (sqrt(result->physicalWidth * result->physicalWidth + result->physicalHeight * result->physicalHeight) / 25.4 + 0.5); if(options->moduleArgs.outputFormat.length == 0) { @@ -121,8 +121,8 @@ void ffPrintDisplay(FFDisplayOptions* options) result->scaledHeight > 0 && result->scaledHeight != result->height) ffStrbufAppendF(&buffer, " (as %ix%i)", result->scaledWidth, result->scaledHeight); - if (inch > 0) - ffStrbufAppendF(&buffer, " in %i″", (uint32_t) (inch + 0.5)); + if (inch > 1) + ffStrbufAppendF(&buffer, " in %i″", inch); if(result->type != FF_DISPLAY_TYPE_UNKNOWN) ffStrbufAppendS(&buffer, result->type == FF_DISPLAY_TYPE_BUILTIN ? " [Built-in]" : " [External]");