DVUI

reset

Destroys all unused and trashed textures since the last call to reset

allocator is only used for the returned slice and can be different from the one used for calls to add

Parameters

#
self:*Cache
*Cache
backend:dvui.Backend
dvui.Backend

Source

Implementation

#
pub fn reset(self: *Cache, backend: dvui.Backend) void {
        var it = self.cache.iterator();
        while (it.next_resetting()) |kv| {
            backend.textureDestroy(kv.value);
        }
        for (self.trash.items) |tex| {
            backend.textureDestroy(tex);
        }
        self.trash.clearRetainingCapacity();

        for (self.trash_target.items) |tex| {
            backend.textureDestroyTarget(tex);
        }
        self.trash_target.clearRetainingCapacity();
    }