mirror of
https://github.com/lvgl/lvgl.git
synced 2026-06-02 01:18:04 +08:00
fix build error
This commit is contained in:
@@ -211,15 +211,6 @@ static inline void lv_scr_load(lv_obj_t * scr)
|
|||||||
#define LV_VER_RES lv_disp_get_ver_res(lv_disp_get_default())
|
#define LV_VER_RES lv_disp_get_ver_res(lv_disp_get_default())
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* Same as Android's DIP. (Different name is chosen to avoid mistype between LV_DPI and LV_DIP)
|
|
||||||
* 1 dip is 1 px on a 160 DPI screen
|
|
||||||
* 1 dip is 2 px on a 320 DPI screen
|
|
||||||
* https://stackoverflow.com/questions/2025282/what-is-the-difference-between-px-dip-dp-and-sp
|
|
||||||
*/
|
|
||||||
#define _LV_DPX_CALC(dpi, n) ((n) == 0 ? 0 :LV_MAX((( (dpi) * (n) + 80) / 160), 1)) /*+80 for rounding*/
|
|
||||||
#define LV_DPX(n) _LV_DPX_CALC(lv_disp_get_dpi(NULL), n)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scale the given number of pixels (a distance or size) relative to a 160 DPI display
|
* Scale the given number of pixels (a distance or size) relative to a 160 DPI display
|
||||||
* considering the DPI of the default display.
|
* considering the DPI of the default display.
|
||||||
@@ -247,20 +238,6 @@ static inline lv_coord_t lv_disp_dpx(const lv_disp_t * disp, lv_coord_t n)
|
|||||||
return _LV_DPX_CALC(lv_disp_get_dpi(disp), n);
|
return _LV_DPX_CALC(lv_disp_get_dpi(disp), n);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Scale the given number of pixels (a distance or size) relative to a 160 DPI display
|
|
||||||
* considering the DPI of the `obj`'s display.
|
|
||||||
* It ensures that e.g. `lv_dpx(100)` will have the same physical size regardless to the
|
|
||||||
* DPI of the display.
|
|
||||||
* @param obj an object whose display's dpi should be considered
|
|
||||||
* @param n the number of pixels to scale
|
|
||||||
* @return `n x current_dpi/160`
|
|
||||||
*/
|
|
||||||
static inline lv_coord_t lv_dpx_obj(const lv_obj_t * obj, lv_coord_t n)
|
|
||||||
{
|
|
||||||
return _LV_DPX_CALC(lv_disp_get_dpi(lv_obj_get_disp(obj)), n);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /*extern "C"*/
|
} /*extern "C"*/
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -20,6 +20,14 @@ extern "C" {
|
|||||||
/*********************
|
/*********************
|
||||||
* DEFINES
|
* DEFINES
|
||||||
*********************/
|
*********************/
|
||||||
|
/**
|
||||||
|
* Same as Android's DIP. (Different name is chosen to avoid mistype between LV_DPI and LV_DIP)
|
||||||
|
* 1 dip is 1 px on a 160 DPI screen
|
||||||
|
* 1 dip is 2 px on a 320 DPI screen
|
||||||
|
* https://stackoverflow.com/questions/2025282/what-is-the-difference-between-px-dip-dp-and-sp
|
||||||
|
*/
|
||||||
|
#define _LV_DPX_CALC(dpi, n) ((n) == 0 ? 0 :LV_MAX((( (dpi) * (n) + 80) / 160), 1)) /*+80 for rounding*/
|
||||||
|
#define LV_DPX(n) _LV_DPX_CALC(lv_disp_get_dpi(NULL), n)
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* TYPEDEFS
|
* TYPEDEFS
|
||||||
|
|||||||
Reference in New Issue
Block a user