Export the free texture function
This commit is contained in:
parent
9078ca975e
commit
710d00674a
@ -90,6 +90,13 @@ static void
|
||||
update_viewport_size_impl(int w, int h) {
|
||||
glViewport(0, 0, w, h); check_gl();
|
||||
}
|
||||
|
||||
static void
|
||||
free_texture_impl(GLuint *tex_id) {
|
||||
glDeleteTextures(1, tex_id); check_gl();
|
||||
*tex_id = 0;
|
||||
}
|
||||
|
||||
// }}}
|
||||
|
||||
// Programs {{{
|
||||
|
||||
@ -44,9 +44,11 @@ free_load_data(LoadData *ld) {
|
||||
ld->mapped_file = NULL; ld->mapped_file_sz = 0;
|
||||
}
|
||||
|
||||
free_texture_func free_texture = NULL;
|
||||
|
||||
static inline void
|
||||
free_image(Image *img) {
|
||||
// TODO: free the texture if texture_id is not zero
|
||||
if (img->texture_id) free_texture(&img->texture_id);
|
||||
free_load_data(&(img->load_data));
|
||||
}
|
||||
|
||||
|
||||
@ -560,6 +560,7 @@ init_shaders(PyObject *module) {
|
||||
draw_borders = &draw_borders_impl;
|
||||
draw_cells = &draw_cells_impl;
|
||||
draw_cursor = &draw_cursor_impl;
|
||||
free_texture = &free_texture_impl;
|
||||
return true;
|
||||
}
|
||||
// }}}
|
||||
|
||||
@ -101,3 +101,4 @@ EXTERNAL_FUNC0(draw_borders, void);
|
||||
EXTERNAL_FUNC(draw_cells, void, ssize_t, float, float, float, float, Screen *, CursorRenderInfo *);
|
||||
EXTERNAL_FUNC(draw_cursor, void, CursorRenderInfo *);
|
||||
EXTERNAL_FUNC(update_viewport_size, void, int, int);
|
||||
EXTERNAL_FUNC(free_texture, void, uint32_t*);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user