improve device_pixel_ratio_to_str

This commit is contained in:
lixianjing 2024-11-03 12:50:14 +08:00
parent 8cd53e9979
commit 4d1869dad3
2 changed files with 6 additions and 3 deletions

View File

@ -2,6 +2,7 @@
2024/11/03
* 针对 awtk-android/awtk-ios/awtk-harmonyos-next 完善。
* 完善 device_pixel_ratio_to_str
2024/11/01
* preview_ui添加是否启用标准字体大小的参数(感谢培煌提供补丁)

View File

@ -171,11 +171,13 @@ static ret_t build_asset_filename_default(char* path, uint32_t size, const char*
static const char* device_pixel_ratio_to_str(float_t dpr) {
const char* ratio = "x1";
if (dpr >= 4) {
int32_t idpr = tk_roundi(dpr);
if (idpr >= 4) {
ratio = "x4";
} else if (dpr >= 3) {
} else if (idpr >= 3) {
ratio = "x3";
} else if (dpr >= 2) {
} else if (idpr >= 2) {
ratio = "x2";
}