acid-drop- Hacking the planet from a LilyGo T-Deck using custom firmware |
git clone git://git.acid.vegas/acid-drop.git |
Log | Files | Refs | Archive | README | LICENSE |
lv_draw_sdl_texture_cache.h (2896B)
1 /** 2 * @file lv_draw_sdl_texture_cache.h 3 * 4 */ 5 6 #ifndef LV_DRAW_SDL_TEXTURE_CACHE_H 7 #define LV_DRAW_SDL_TEXTURE_CACHE_H 8 9 #ifdef __cplusplus 10 extern "C" { 11 #endif 12 13 /********************* 14 * INCLUDES 15 *********************/ 16 17 #include "../../lv_conf_internal.h" 18 19 #if LV_USE_GPU_SDL 20 21 #include LV_GPU_SDL_INCLUDE_PATH 22 #include "lv_draw_sdl.h" 23 #include "lv_draw_sdl_priv.h" 24 #include "../../draw/lv_img_decoder.h" 25 #include "../../misc/lv_area.h" 26 27 /********************* 28 * DEFINES 29 *********************/ 30 31 #define LV_DRAW_SDL_DEC_DSC_TEXTURE_HEAD "@LVSDLTex" 32 33 /********************** 34 * TYPEDEFS 35 **********************/ 36 37 typedef struct { 38 char head[8]; 39 SDL_Texture * texture; 40 SDL_Rect rect; 41 bool texture_managed; 42 bool texture_referenced; 43 } lv_draw_sdl_dec_dsc_userdata_t; 44 45 typedef enum { 46 LV_GPU_CACHE_KEY_MAGIC_ARC = 0x01, 47 LV_GPU_CACHE_KEY_MAGIC_IMG = 0x11, 48 LV_GPU_CACHE_KEY_MAGIC_IMG_ROUNDED_CORNERS = 0x12, 49 LV_GPU_CACHE_KEY_MAGIC_LINE = 0x21, 50 LV_GPU_CACHE_KEY_MAGIC_RECT_BG = 0x31, 51 LV_GPU_CACHE_KEY_MAGIC_RECT_SHADOW = 0x32, 52 LV_GPU_CACHE_KEY_MAGIC_RECT_BORDER = 0x33, 53 LV_GPU_CACHE_KEY_MAGIC_FONT_GLYPH = 0x41, 54 LV_GPU_CACHE_KEY_MAGIC_MASK = 0x51, 55 } lv_sdl_cache_key_magic_t; 56 57 typedef enum { 58 LV_DRAW_SDL_CACHE_FLAG_NONE = 0, 59 LV_DRAW_SDL_CACHE_FLAG_MANAGED = 1, 60 } lv_draw_sdl_cache_flag_t; 61 62 typedef struct { 63 lv_sdl_cache_key_magic_t magic; 64 lv_img_src_t type; 65 int32_t frame_id; 66 } lv_draw_sdl_cache_key_head_img_t; 67 68 /********************** 69 * GLOBAL PROTOTYPES 70 **********************/ 71 72 void lv_draw_sdl_texture_cache_init(lv_draw_sdl_ctx_t * ctx); 73 74 void lv_draw_sdl_texture_cache_deinit(lv_draw_sdl_ctx_t * ctx); 75 76 /** 77 * Find cached texture by key. The texture can be destroyed during usage. 78 */ 79 SDL_Texture * lv_draw_sdl_texture_cache_get(lv_draw_sdl_ctx_t * ctx, const void * key, size_t key_length, bool * found); 80 81 SDL_Texture * lv_draw_sdl_texture_cache_get_with_userdata(lv_draw_sdl_ctx_t * ctx, const void * key, size_t key_length, 82 bool * found, void ** userdata); 83 84 void lv_draw_sdl_texture_cache_put(lv_draw_sdl_ctx_t * ctx, const void * key, size_t key_length, SDL_Texture * texture); 85 86 void lv_draw_sdl_texture_cache_put_advanced(lv_draw_sdl_ctx_t * ctx, const void * key, size_t key_length, 87 SDL_Texture * texture, void * userdata, void userdata_free(void *), 88 lv_draw_sdl_cache_flag_t flags); 89 90 lv_draw_sdl_cache_key_head_img_t * lv_draw_sdl_texture_img_key_create(const void * src, int32_t frame_id, 91 size_t * size); 92 93 /********************** 94 * MACROS 95 **********************/ 96 #endif /*LV_USE_GPU_SDL*/ 97 98 #ifdef __cplusplus 99 } /*extern "C"*/ 100 #endif 101 102 #endif /*LV_DRAW_SDL_TEXTURE_CACHE_H*/