Skip to content

Commit 21b15ee

Browse files
committed
Display: rearranges default format; removes scaled resolution
1 parent 8e0a651 commit 21b15ee

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

src/modules/display/display.c

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -101,30 +101,36 @@ bool ffPrintDisplay(FFDisplayOptions* options)
101101

102102
FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreate();
103103
double inch = sqrt(result->physicalWidth * result->physicalWidth + result->physicalHeight * result->physicalHeight) / 25.4;
104+
double scaleFactor = (double) result->height / (double) result->scaledHeight;
104105

105106
if(options->moduleArgs.outputFormat.length == 0)
106107
{
107108
ffPrintLogoAndKey(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY);
108109

109110
ffStrbufAppendF(&buffer, "%ix%i", result->width, result->height);
110111

111-
if(result->refreshRate > 0)
112-
{
113-
const char* space = instance.config.display.freqSpaceBeforeUnit == FF_SPACE_BEFORE_UNIT_NEVER ? "" : " ";
114-
if(options->preciseRefreshRate)
115-
ffStrbufAppendF(&buffer, " @ %g%sHz", ((int) (result->refreshRate * 1000 + 0.5)) / 1000.0, space);
116-
else
117-
ffStrbufAppendF(&buffer, " @ %i%sHz", (uint32_t) (result->refreshRate + 0.5), space);
118-
}
119-
120112
if(
121113
result->scaledWidth > 0 && result->scaledWidth != result->width &&
122114
result->scaledHeight > 0 && result->scaledHeight != result->height)
123-
ffStrbufAppendF(&buffer, " (as %ix%i)", result->scaledWidth, result->scaledHeight);
115+
{
116+
ffStrbufAppendS(&buffer, " @ ");
117+
ffStrbufAppendDouble(&buffer, scaleFactor, instance.config.display.fractionNdigits, instance.config.display.fractionTrailingZeros == FF_FRACTION_TRAILING_ZEROS_TYPE_SHOW);
118+
ffStrbufAppendC(&buffer, 'x');
119+
}
124120

125121
if (inch > 1)
126122
ffStrbufAppendF(&buffer, " in %i\"", (uint32_t) (inch + 0.5));
127123

124+
if(result->refreshRate > 0)
125+
{
126+
ffStrbufAppendS(&buffer, ", ");
127+
if(options->preciseRefreshRate)
128+
ffStrbufAppendDouble(&buffer, result->refreshRate, 3, false);
129+
else
130+
ffStrbufAppendSInt(&buffer, (int) (result->refreshRate + 0.5));
131+
ffStrbufAppendS(&buffer, instance.config.display.freqSpaceBeforeUnit == FF_SPACE_BEFORE_UNIT_NEVER ? "Hz" : " Hz");
132+
}
133+
128134
bool flag = false;
129135
if (result->type != FF_DISPLAY_TYPE_UNKNOWN)
130136
{
@@ -185,8 +191,6 @@ bool ffPrintDisplay(FFDisplayOptions* options)
185191
else
186192
buf[0] = '\0';
187193

188-
double scaleFactor = (double) result->height / (double) result->scaledHeight;
189-
190194
FF_PRINT_FORMAT_CHECKED(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, ((FFformatarg[]) {
191195
FF_FORMAT_ARG(result->width, "width"),
192196
FF_FORMAT_ARG(result->height, "height"),

0 commit comments

Comments
 (0)