mirror of
https://github.com/joel16/NX-Shell.git
synced 2024-11-23 11:49:46 +00:00
textures: Free all textures on exit
This commit is contained in:
parent
11c72a3625
commit
c5e4ddb4ac
@ -11,9 +11,6 @@
|
|||||||
|
|
||||||
namespace ImageViewer {
|
namespace ImageViewer {
|
||||||
void ClearTextures(void) {
|
void ClearTextures(void) {
|
||||||
for (unsigned int i = 0; i < data.textures.size(); i++)
|
|
||||||
Textures::Free(data.textures[i]);
|
|
||||||
|
|
||||||
data.textures.clear();
|
data.textures.clear();
|
||||||
data.frame_count = 0;
|
data.frame_count = 0;
|
||||||
}
|
}
|
||||||
@ -94,14 +91,12 @@ namespace ImageViewer {
|
|||||||
|
|
||||||
if (key & HidNpadButton_L) {
|
if (key & HidNpadButton_L) {
|
||||||
ImageViewer::ClearTextures();
|
ImageViewer::ClearTextures();
|
||||||
svcSleepThread(10000000);
|
|
||||||
|
|
||||||
if (!ImageViewer::HandlePrev())
|
if (!ImageViewer::HandlePrev())
|
||||||
data.state = WINDOW_STATE_FILEBROWSER;
|
data.state = WINDOW_STATE_FILEBROWSER;
|
||||||
}
|
}
|
||||||
else if (key & HidNpadButton_R) {
|
else if (key & HidNpadButton_R) {
|
||||||
ImageViewer::ClearTextures();
|
ImageViewer::ClearTextures();
|
||||||
svcSleepThread(10000000);
|
|
||||||
|
|
||||||
if (!ImageViewer::HandleNext())
|
if (!ImageViewer::HandleNext())
|
||||||
data.state = WINDOW_STATE_FILEBROWSER;
|
data.state = WINDOW_STATE_FILEBROWSER;
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "imgui_impl_switch.hpp"
|
#include "imgui_impl_switch.hpp"
|
||||||
#include "log.hpp"
|
#include "log.hpp"
|
||||||
#include "textures.hpp"
|
#include "textures.hpp"
|
||||||
|
#include "windows.hpp"
|
||||||
|
|
||||||
#define BYTES_PER_PIXEL 4
|
#define BYTES_PER_PIXEL 4
|
||||||
#define MAX_IMAGE_BYTES (48 * 1024 * 1024)
|
#define MAX_IMAGE_BYTES (48 * 1024 * 1024)
|
||||||
@ -439,10 +440,6 @@ namespace Textures {
|
|||||||
|
|
||||||
void Free(Tex &texture) {
|
void Free(Tex &texture) {
|
||||||
glDeleteTextures(1, &texture.id);
|
glDeleteTextures(1, &texture.id);
|
||||||
glViewport(0, 0, static_cast<int>(ImGui::GetIO().DisplaySize.x), static_cast<int>(ImGui::GetIO().DisplaySize.y));
|
|
||||||
glClearColor(0.00f, 0.00f, 0.00f, 1.00f);
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
|
||||||
GUI::SwapBuffers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Exit(void) {
|
void Exit(void) {
|
||||||
@ -452,5 +449,8 @@ namespace Textures {
|
|||||||
Textures::Free(uncheck_icon);
|
Textures::Free(uncheck_icon);
|
||||||
Textures::Free(check_icon);
|
Textures::Free(check_icon);
|
||||||
Textures::Free(folder_icon);
|
Textures::Free(folder_icon);
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < data.textures.size(); i++)
|
||||||
|
Textures::Free(data.textures[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user