math: remove lv_bezier3

Should use lv_cubic_bezier from now on. A macro lv_bezier3 is proviced for backward compatibility but u0, u3 is limited to 0, 1024.

Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
This commit is contained in:
Xu Xingliang
2023-06-20 00:37:59 +08:00
committed by Gabor Kiss-Vamosi
parent 043c48761f
commit 42606eb9f1
2 changed files with 32 additions and 57 deletions

View File

@@ -22,8 +22,19 @@ extern "C" {
#define LV_TRIGO_SIN_MAX 32767
#define LV_TRIGO_SHIFT 15 /**< >> LV_TRIGO_SHIFT to normalize*/
#define LV_BEZIER_VAL_MAX 1024 /**< Max time in Bezier functions (not [0..1] to use integers)*/
#define LV_BEZIER_VAL_SHIFT 10 /**< log2(LV_BEZIER_VAL_MAX): used to normalize up scaled values*/
#define LV_BEZIER_VAL_MAX (1L << LV_BEZIER_VAL_SHIFT) /**< Max time in Bezier functions (not [0..1] to use integers)*/
/**
* Calculate a value of a Cubic Bezier function.
* @param t time in range of [0..LV_BEZIER_VAL_MAX]
* @param u0 must be 0
* @param u1 control value 1 values in range of [0..LV_BEZIER_VAL_MAX]
* @param u2 control value 2 in range of [0..LV_BEZIER_VAL_MAX]
* @param u3 must be LV_BEZIER_VAL_MAX
* @return the value calculated from the given parameters in range of [0..LV_BEZIER_VAL_MAX]
*/
#define lv_bezier3(t, u0, u1, u2, u3) lv_cubic_bezier(t, 341, u1, 683, u2)
/**********************
* TYPEDEFS
@@ -53,24 +64,13 @@ static inline LV_ATTRIBUTE_FAST_MEM int32_t lv_trigo_cos(int16_t angle)
//! @endcond
/**
* Calculate a value of a Cubic Bezier function.
* @param t time in range of [0..LV_BEZIER_VAL_MAX]
* @param u0 start values in range of [0..LV_BEZIER_VAL_MAX]
* @param u1 control value 1 values in range of [0..LV_BEZIER_VAL_MAX]
* @param u2 control value 2 in range of [0..LV_BEZIER_VAL_MAX]
* @param u3 end values in range of [0..LV_BEZIER_VAL_MAX]
* @return the value calculated from the given parameters in range of [0..LV_BEZIER_VAL_MAX]
*/
uint32_t lv_bezier3(uint32_t t, uint32_t u0, uint32_t u1, uint32_t u2, uint32_t u3);
/**
* Calculate the y value of cubic-bezier(x1, y1, x2, y2) function as specified x.
* @param x time in range of [0..1024]
* @param x1 x of control point 1 in range of [0..1024]
* @param y1 y of control point 1 in range of [0..1024]
* @param x2 x of control point 2 in range of [0..1024]
* @param y2 y of control point 2 in range of [0..1024]
* @param x time in range of [0..LV_BEZIER_VAL_MAX]
* @param x1 x of control point 1 in range of [0..LV_BEZIER_VAL_MAX]
* @param y1 y of control point 1 in range of [0..LV_BEZIER_VAL_MAX]
* @param x2 x of control point 2 in range of [0..LV_BEZIER_VAL_MAX]
* @param y2 y of control point 2 in range of [0..LV_BEZIER_VAL_MAX]
* @return the value calculated
*/
int32_t lv_cubic_bezier(int32_t x, int32_t x1, int32_t y1, int32_t x2, int32_t y2);