Skip to content

Commit

Permalink
chore(draw_sw): optimize lv_draw_sw_rotate judgment logic (lvgl#6148)
Browse files Browse the repository at this point in the history
Signed-off-by: pengyiqiang <[email protected]>
Co-authored-by: pengyiqiang <[email protected]>
  • Loading branch information
FASTSHIFT and pengyiqiang authored May 3, 2024
1 parent 2d2ea02 commit 10e012e
Showing 1 changed file with 54 additions and 14 deletions.
68 changes: 54 additions & 14 deletions src/draw/sw/lv_draw_sw.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,21 +219,61 @@ void lv_draw_sw_rgb565_swap(void * buf, uint32_t buf_size_px)
void lv_draw_sw_rotate(const void * src, void * dest, int32_t src_width, int32_t src_height, int32_t src_sride,
int32_t dest_stride, lv_display_rotation_t rotation, lv_color_format_t color_format)
{
uint32_t px_bpp = lv_color_format_get_bpp(color_format);
if(rotation == LV_DISPLAY_ROTATION_90) {
if(px_bpp == 16) rotate90_rgb565(src, dest, src_width, src_height, src_sride, dest_stride);
if(px_bpp == 24) rotate90_rgb888(src, dest, src_width, src_height, src_sride, dest_stride);
if(px_bpp == 32) rotate90_argb8888(src, dest, src_width, src_height, src_sride, dest_stride);
}
else if(rotation == LV_DISPLAY_ROTATION_180) {
if(px_bpp == 16) rotate180_rgb565(src, dest, src_width, src_height, src_sride, dest_stride);
if(px_bpp == 24) rotate180_rgb888(src, dest, src_width, src_height, src_sride, dest_stride);
if(px_bpp == 32) rotate180_argb8888(src, dest, src_width, src_height, src_sride, dest_stride);
}
else if(rotation == LV_DISPLAY_ROTATION_270) {
if(px_bpp == 16) rotate270_rgb565(src, dest, src_width, src_height, src_sride, dest_stride);
if(px_bpp == 24) rotate270_rgb888(src, dest, src_width, src_height, src_sride, dest_stride);
if(px_bpp == 32) rotate270_argb8888(src, dest, src_width, src_height, src_sride, dest_stride);
switch(color_format) {
case LV_COLOR_FORMAT_RGB565:
rotate90_rgb565(src, dest, src_width, src_height, src_sride, dest_stride);
break;
case LV_COLOR_FORMAT_RGB888:
rotate90_rgb888(src, dest, src_width, src_height, src_sride, dest_stride);
break;
case LV_COLOR_FORMAT_XRGB8888:
case LV_COLOR_FORMAT_ARGB8888:
rotate90_argb8888(src, dest, src_width, src_height, src_sride, dest_stride);
break;
default:
break;
}

return;
}

if(rotation == LV_DISPLAY_ROTATION_180) {
switch(color_format) {
case LV_COLOR_FORMAT_RGB565:
rotate180_rgb565(src, dest, src_width, src_height, src_sride, dest_stride);
break;
case LV_COLOR_FORMAT_RGB888:
rotate180_rgb888(src, dest, src_width, src_height, src_sride, dest_stride);
break;
case LV_COLOR_FORMAT_XRGB8888:
case LV_COLOR_FORMAT_ARGB8888:
rotate180_argb8888(src, dest, src_width, src_height, src_sride, dest_stride);
break;
default:
break;
}

return;
}

if(rotation == LV_DISPLAY_ROTATION_270) {
switch(color_format) {
case LV_COLOR_FORMAT_RGB565:
rotate270_rgb565(src, dest, src_width, src_height, src_sride, dest_stride);
break;
case LV_COLOR_FORMAT_RGB888:
rotate270_rgb888(src, dest, src_width, src_height, src_sride, dest_stride);
break;
case LV_COLOR_FORMAT_XRGB8888:
case LV_COLOR_FORMAT_ARGB8888:
rotate270_argb8888(src, dest, src_width, src_height, src_sride, dest_stride);
break;
default:
break;
}

return;
}
}

Expand Down

0 comments on commit 10e012e

Please sign in to comment.