feat(drawing) hardware accelerated rendering by SDL2 (#2484)

* Hardware accelerated SDL render WIP

* Rect drawing code cleanup

* Fixed arc drawing angle
Fixed compact rect drawing

* Refactoring
Fixed cache deinit order

* Image recolor
Drawing left and right border

* Math problems

* Improving draw cache

* Improving line drawing logic

* Improving arc drawing quality

* Added round function

* Attempts to render properly on Pi

* Updated lruc function names

* Updated symbol names

* Saved ram by reusing part of background rect

* Added outline drawing
Removed arc texture caching

* rect drawing cache rendering

* high efficiency rect shadow texture caching

* fixed simple borders drawing

* fixed generic borders drawing

* Simplified text atlas caching logic
Supports chroma keyed image

* Color palette WIP

* Improved draw cache

* Updated defines for better build

* renaming files for better consistency

* fix includes

* Updated lv_conf_internal with generator

* Fixing build issues

* fixed img rotation pivot

* better font atlas caching WIP

* fix includes

* full font atlas support
improved gpu caching for rect

* update conf header

* fix palette creation

* Fixed font atlas key matching

* fixed chroma key image background

* added 3bpp mask palette (WIP)

* fixed caching key initialization

* disabled gpu arc drawing for now
updated naming convention

* updated naming convention

* fix makefile and include path

* improved rect drawing when having masks

* improved rect drawing when having masks

* reduced texture allocation while drawing with mask

* accurate clipping for rects and texts

* fixed build error

* fixed build error

* line drawing WIP

* updated imports

* fixed freezes if LRU has smaller new item

* fixed clipping rect color

* fixed build error

* using built-in free function for LRU key

* Added custom background drawing function

* fixing imports

* fixed shadow bitmap on old SDL libs

* improved draw_img compatibility

* fixing font baking

* fixed font rendering

* fixed lv_draw_line check

* configurable SDL include path

* disabled SDL line drawing implementation

* supports screen resize

* sdl: Remove duplicated object

Observed issue:

  /usr/bin/ld: lv_gpu_sdl_texture_cache.o: \
  in function `_lv_gpu_sdl_texture_cache_init':
  lv_gpu_sdl_texture_cache.c:(.text+0x30): \
  multiple definition of `_lv_gpu_sdl_texture_cache_init'; \
  lv_gpu_sdl_texture_cache.o:lv_gpu_sdl_texture_cache.c:(.text+0x30): \
  first defined here

Forwarded: https://github.com/mariotaku/lvgl/pull/1
Relate-to: https://github.com/lvgl/lvgl/pull/2484
Signed-off-by: Philippe Coval <philippe.coval@huawei.com>

* Reduced opening of image

* Closes image resource properly

* improved draw image logic

* Moved driver related code to lv_drivers

* fixed lv_deinit implicit sdl code invocation

* improved shadow clipping

* fixed outline area invalidation

* updated comments

* formatted code using astyle

* Updated README

* formatted code

* fixed typo

* fixed static declaration

Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
Co-authored-by: Philippe Coval <philippe.coval@huawei.com>
This commit is contained in:
Mariotaku
2021-09-17 01:20:32 +09:00
committed by GitHub
parent 71e6f65d51
commit efc5bb40d9
34 changed files with 3445 additions and 13 deletions

View File

@@ -28,6 +28,7 @@
/**********************
* STATIC PROTOTYPES
**********************/
#if LV_USE_EXTERNAL_RENDERER == 0
LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_area_t * clip_area,
const lv_draw_rect_dsc_t * dsc);
LV_ATTRIBUTE_FAST_MEM static void draw_bg_img(const lv_area_t * coords, const lv_area_t * clip,
@@ -54,6 +55,7 @@ static void draw_border_simple(const lv_area_t * clip, const lv_area_t * outer_a
#if LV_DRAW_COMPLEX
LV_ATTRIBUTE_FAST_MEM static inline lv_color_t grad_get(const lv_draw_rect_dsc_t * dsc, lv_coord_t s, lv_coord_t i);
#endif
#endif
/**********************
* STATIC VARIABLES
@@ -89,6 +91,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_rect_dsc_init(lv_draw_rect_dsc_t * dsc)
dsc->border_side = LV_BORDER_SIDE_FULL;
}
#if LV_USE_EXTERNAL_RENDERER == 0
/**
* Draw a rectangle
* @param coords the coordinates of the rectangle
@@ -1331,3 +1334,5 @@ static void draw_border_simple(const lv_area_t * clip, const lv_area_t * outer_a
}
}
#endif