Skip to content

Commit 925c347

Browse files
committed
Display: add scale factor in custom format
1 parent 7948e62 commit 925c347

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/modules/display/display.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#include <math.h>
88

9-
#define FF_DISPLAY_NUM_FORMAT_ARGS 20
9+
#define FF_DISPLAY_NUM_FORMAT_ARGS 21
1010

1111
static int sortByNameAsc(FFDisplayResult* a, FFDisplayResult* b)
1212
{
@@ -173,6 +173,8 @@ void ffPrintDisplay(FFDisplayOptions* options)
173173
else
174174
buf[0] = '\0';
175175

176+
double scaleFactor = (double) result->width / (double) result->scaledWidth;
177+
176178
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_DISPLAY_NUM_FORMAT_ARGS, ((FFformatarg[]) {
177179
FF_FORMAT_ARG(result->width, "width"),
178180
FF_FORMAT_ARG(result->height, "height"),
@@ -194,6 +196,7 @@ void ffPrintDisplay(FFDisplayOptions* options)
194196
FF_FORMAT_ARG(buf, "serial"),
195197
FF_FORMAT_ARG(result->platformApi, "platform-api"),
196198
FF_FORMAT_ARG(hdrCompatible, "hdr-compatible"),
199+
FF_FORMAT_ARG(scaleFactor, "scale-factor"),
197200
}));
198201
}
199202
}
@@ -441,6 +444,7 @@ void ffPrintDisplayHelpFormat(void)
441444
"Serial number - serial",
442445
"The platform API used when detecting the display - platform-api",
443446
"True if the display is HDR compatible - hdr-compatible",
447+
"HiDPI scale factor - scale-factor",
444448
}));
445449
}
446450

0 commit comments

Comments
 (0)