| 851 | } |
| 852 | |
| 853 | void sth_delete(struct sth_stash* stash) |
| 854 | { |
| 855 | struct sth_texture* tex = NULL; |
| 856 | struct sth_texture* curtex = NULL; |
| 857 | struct sth_font* fnt = NULL; |
| 858 | struct sth_font* curfnt = NULL; |
| 859 | |
| 860 | if (!stash) return; |
| 861 | |
| 862 | tex = stash->textures; |
| 863 | while (tex != NULL) |
| 864 | { |
| 865 | curtex = tex; |
| 866 | free(tex->m_texels); |
| 867 | tex->m_texels = 0; |
| 868 | tex = tex->next; |
| 869 | stash->m_renderCallbacks->updateTexture(curtex, 0, 0, 0); |
| 870 | free(curtex); |
| 871 | } |
| 872 | |
| 873 | fnt = stash->fonts; |
| 874 | while (fnt != NULL) |
| 875 | { |
| 876 | curfnt = fnt; |
| 877 | fnt = fnt->next; |
| 878 | if (curfnt->glyphs) |
| 879 | { |
| 880 | free(curfnt->glyphs); |
| 881 | } |
| 882 | if (curfnt->type == TTFONT_FILE && curfnt->data) |
| 883 | { |
| 884 | free(curfnt->data); |
| 885 | } |
| 886 | free(curfnt); |
| 887 | } |
| 888 | free(stash); |
| 889 | } |
no test coverage detected