diff --git a/source/image.cpp b/source/image.cpp index f1492a4..7c741f1 100644 --- a/source/image.cpp +++ b/source/image.cpp @@ -11,9 +11,6 @@ namespace ImageViewer { void ClearTextures(void) { - for (unsigned int i = 0; i < data.textures.size(); i++) - Textures::Free(data.textures[i]); - data.textures.clear(); data.frame_count = 0; } @@ -94,14 +91,12 @@ namespace ImageViewer { if (key & HidNpadButton_L) { ImageViewer::ClearTextures(); - svcSleepThread(10000000); if (!ImageViewer::HandlePrev()) data.state = WINDOW_STATE_FILEBROWSER; } else if (key & HidNpadButton_R) { ImageViewer::ClearTextures(); - svcSleepThread(10000000); if (!ImageViewer::HandleNext()) data.state = WINDOW_STATE_FILEBROWSER; diff --git a/source/textures.cpp b/source/textures.cpp index 9dd1062..ca8a379 100644 --- a/source/textures.cpp +++ b/source/textures.cpp @@ -37,6 +37,7 @@ #include "imgui_impl_switch.hpp" #include "log.hpp" #include "textures.hpp" +#include "windows.hpp" #define BYTES_PER_PIXEL 4 #define MAX_IMAGE_BYTES (48 * 1024 * 1024) @@ -439,10 +440,6 @@ namespace Textures { void Free(Tex &texture) { glDeleteTextures(1, &texture.id); - glViewport(0, 0, static_cast(ImGui::GetIO().DisplaySize.x), static_cast(ImGui::GetIO().DisplaySize.y)); - glClearColor(0.00f, 0.00f, 0.00f, 1.00f); - glClear(GL_COLOR_BUFFER_BIT); - GUI::SwapBuffers(); } void Exit(void) { @@ -452,5 +449,8 @@ namespace Textures { Textures::Free(uncheck_icon); Textures::Free(check_icon); Textures::Free(folder_icon); + + for (unsigned int i = 0; i < data.textures.size(); i++) + Textures::Free(data.textures[i]); } }