Add function to delete current texture

PR #6662 <https://github.com/Genymobile/scrcpy/pull/6662>
This commit is contained in:
Romain Vimont 2026-02-01 15:56:18 +01:00
parent 362daa5bad
commit ac1a8b6ef2
2 changed files with 11 additions and 0 deletions

View file

@ -225,3 +225,11 @@ sc_texture_set_from_surface(struct sc_texture *tex, SDL_Surface *surface) {
return true;
}
void
sc_texture_reset(struct sc_texture *tex) {
if (tex->texture) {
SDL_DestroyTexture(tex->texture);
tex->texture = NULL;
}
}

View file

@ -41,4 +41,7 @@ sc_texture_set_from_frame(struct sc_texture *tex, const AVFrame *frame);
bool
sc_texture_set_from_surface(struct sc_texture *tex, SDL_Surface *surface);
void
sc_texture_reset(struct sc_texture *tex);
#endif