mikroSDK Reference Manual
lv_draw_sdl_texture_cache.h
Go to the documentation of this file.
1
6#ifndef LV_DRAW_SDL_TEXTURE_CACHE_H
7#define LV_DRAW_SDL_TEXTURE_CACHE_H
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13/*********************
14 * INCLUDES
15 *********************/
16
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"
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
37typedef 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
45typedef 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_RECT_GRAD = 0x34,
54 LV_GPU_CACHE_KEY_MAGIC_FONT_GLYPH = 0x41,
55 LV_GPU_CACHE_KEY_MAGIC_MASK = 0x51,
56} lv_sdl_cache_key_magic_t;
57
58typedef enum {
59 LV_DRAW_SDL_CACHE_FLAG_NONE = 0,
60 LV_DRAW_SDL_CACHE_FLAG_MANAGED = 1,
61} lv_draw_sdl_cache_flag_t;
62
63typedef struct {
64 lv_sdl_cache_key_magic_t magic;
65 lv_img_src_t type;
66 int32_t frame_id;
67} lv_draw_sdl_cache_key_head_img_t;
68
69/**********************
70 * GLOBAL PROTOTYPES
71 **********************/
72
73void lv_draw_sdl_texture_cache_init(lv_draw_sdl_ctx_t * ctx);
74
75void lv_draw_sdl_texture_cache_deinit(lv_draw_sdl_ctx_t * ctx);
76
80SDL_Texture * lv_draw_sdl_texture_cache_get(lv_draw_sdl_ctx_t * ctx, const void * key, size_t key_length, bool * found);
81
82SDL_Texture * lv_draw_sdl_texture_cache_get_with_userdata(lv_draw_sdl_ctx_t * ctx, const void * key, size_t key_length,
83 bool * found, void ** userdata);
84
85void lv_draw_sdl_texture_cache_put(lv_draw_sdl_ctx_t * ctx, const void * key, size_t key_length, SDL_Texture * texture);
86
87void lv_draw_sdl_texture_cache_put_advanced(lv_draw_sdl_ctx_t * ctx, const void * key, size_t key_length,
88 SDL_Texture * texture, void * userdata, void userdata_free(void *),
89 lv_draw_sdl_cache_flag_t flags);
90
91lv_draw_sdl_cache_key_head_img_t * lv_draw_sdl_texture_img_key_create(const void * src, int32_t frame_id,
92 size_t * size);
93
94/**********************
95 * MACROS
96 **********************/
97#endif /*LV_USE_GPU_SDL*/
98
99#ifdef __cplusplus
100} /*extern "C"*/
101#endif
102
103#endif /*LV_DRAW_SDL_TEXTURE_CACHE_H*/