mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
chore(color): use lv_color_fomat_get_bpp instead of get_size (#4668)
Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
This commit is contained in:
parent
505eeeaeb5
commit
c8987aa4d8
@ -146,7 +146,8 @@ static void * buf_align(void * buf, lv_color_format_t color_format)
|
||||
static uint32_t width_to_stride(uint32_t w, lv_color_format_t color_format)
|
||||
{
|
||||
uint32_t width_byte;
|
||||
width_byte = w * lv_color_format_get_size(color_format);
|
||||
width_byte = w * lv_color_format_get_bpp(color_format);
|
||||
width_byte = (width_byte + 7) >> 3; /*Round up*/
|
||||
return (width_byte + LV_DRAW_BUF_STRIDE_ALIGN - 1) & ~(LV_DRAW_BUF_STRIDE_ALIGN - 1);
|
||||
}
|
||||
|
||||
|
@ -41,31 +41,6 @@ const lv_color_filter_dsc_t lv_color_filter_shade = {.filter_cb = lv_color_filte
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
uint8_t lv_color_format_get_size(lv_color_format_t cf)
|
||||
{
|
||||
switch(cf) {
|
||||
case LV_COLOR_FORMAT_NATIVE_REVERSED:
|
||||
return LV_COLOR_DEPTH / 8;
|
||||
case LV_COLOR_FORMAT_L8:
|
||||
case LV_COLOR_FORMAT_A8:
|
||||
case LV_COLOR_FORMAT_I8:
|
||||
return 1;
|
||||
case LV_COLOR_FORMAT_RGB565:
|
||||
return 2;
|
||||
|
||||
case LV_COLOR_FORMAT_RGB565A8:
|
||||
case LV_COLOR_FORMAT_RGB888:
|
||||
return 3;
|
||||
case LV_COLOR_FORMAT_ARGB8888:
|
||||
case LV_COLOR_FORMAT_XRGB8888:
|
||||
return 4;
|
||||
|
||||
case LV_COLOR_FORMAT_UNKNOWN:
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t lv_color_format_get_bpp(lv_color_format_t cf)
|
||||
{
|
||||
switch(cf) {
|
||||
|
@ -165,13 +165,6 @@ typedef uint8_t lv_color_format_t;
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Get the pixel size of a color format in bytes
|
||||
* @param src_cf a color format (`LV_COLOR_FORMAT_...`)
|
||||
* @return the pixel size in bytes
|
||||
*/
|
||||
uint8_t lv_color_format_get_size(lv_color_format_t src_cf);
|
||||
|
||||
/**
|
||||
* Get the pixel size of a color format in bits, bpp
|
||||
* @param src_cf a color format (`LV_COLOR_FORMAT_...`)
|
||||
@ -179,6 +172,16 @@ uint8_t lv_color_format_get_size(lv_color_format_t src_cf);
|
||||
*/
|
||||
uint8_t lv_color_format_get_bpp(lv_color_format_t cf);
|
||||
|
||||
/**
|
||||
* Get the pixel size of a color format in bytes
|
||||
* @param src_cf a color format (`LV_COLOR_FORMAT_...`)
|
||||
* @return the pixel size in bytes
|
||||
*/
|
||||
static inline uint8_t lv_color_format_get_size(lv_color_format_t cf)
|
||||
{
|
||||
return (lv_color_format_get_bpp(cf) + 7) >> 3;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a color format has alpha channel or not
|
||||
* @param src_cf a color format (`LV_IMAGE_CF_...`)
|
||||
|
Loading…
x
Reference in New Issue
Block a user