diff --git a/src/core/lv_disp.h b/src/core/lv_disp.h index d6a00e03b0..fdad3b7b7b 100644 --- a/src/core/lv_disp.h +++ b/src/core/lv_disp.h @@ -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()) #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 * 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); } -/** - * 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 } /*extern "C"*/ #endif diff --git a/src/hal/lv_hal.h b/src/hal/lv_hal.h index cb63f3e736..167da1f4bd 100644 --- a/src/hal/lv_hal.h +++ b/src/hal/lv_hal.h @@ -20,6 +20,14 @@ extern "C" { /********************* * 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