Skip to content

Commit f3e48a0

Browse files
committed
Display (Android): fix MiUI
560 is density dpi, not physical dpi
1 parent 9559db5 commit f3e48a0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/detection/displayserver/displayserver_android.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,25 +82,25 @@ static bool detectWithGetprop(FFDisplayServerResult* ds)
8282
if (ffSettingsGetAndroidProperty("persist.sys.miui_resolution", &buffer) &&
8383
ffStrbufContainC(&buffer, ','))
8484
{
85-
// 1440,3200,560 => width,height,ppi
85+
// 1440,3200,560 => width,height,densityDpi
8686
uint32_t width = (uint32_t) ffStrbufToUInt(&buffer, 0);
8787
ffStrbufSubstrAfterFirstC(&buffer, ',');
8888
uint32_t height = (uint32_t) ffStrbufToUInt(&buffer, 0);
8989
ffStrbufSubstrAfterFirstC(&buffer, ',');
90-
uint32_t ppi = (uint32_t) ffStrbufToUInt(&buffer, 0);
90+
double scaleFactor = (double) ffStrbufToUInt(&buffer, 0) / 160.;
9191
return ffdsAppendDisplay(ds,
9292
width,
9393
height,
9494
0,
95-
0,
96-
0,
95+
(uint32_t) (width / scaleFactor + .5),
96+
(uint32_t) (height / scaleFactor + .5),
9797
0,
9898
0,
9999
FF_DISPLAY_TYPE_BUILTIN,
100100
false,
101101
0,
102-
(uint32_t) (width / ppi * 25.4),
103-
(uint32_t) (height / ppi * 25.4)
102+
0,
103+
0
104104
);
105105
}
106106

0 commit comments

Comments
 (0)