From b1bdce7d77d372f6efbf1c5f789282dfe0ed6a3a Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 24 Oct 2014 08:25:53 -0400 Subject: [PATCH] TextureCache: Get rid of explicit deletes in SaveTexture --- Source/Core/VideoBackends/OGL/TextureCache.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Source/Core/VideoBackends/OGL/TextureCache.cpp b/Source/Core/VideoBackends/OGL/TextureCache.cpp index 1526294916..0915f24937 100644 --- a/Source/Core/VideoBackends/OGL/TextureCache.cpp +++ b/Source/Core/VideoBackends/OGL/TextureCache.cpp @@ -53,10 +53,10 @@ bool SaveTexture(const std::string& filename, u32 textarget, u32 tex, int virtua return false; int width = std::max(virtual_width >> level, 1); int height = std::max(virtual_height >> level, 1); - u8* data = new u8[width * height * 4]; + std::vector data(width * height * 4); glActiveTexture(GL_TEXTURE0+9); glBindTexture(textarget, tex); - glGetTexImage(textarget, level, GL_RGBA, GL_UNSIGNED_BYTE, data); + glGetTexImage(textarget, level, GL_RGBA, GL_UNSIGNED_BYTE, data.data()); glBindTexture(textarget, 0); TextureCache::SetStage(); @@ -64,12 +64,10 @@ bool SaveTexture(const std::string& filename, u32 textarget, u32 tex, int virtua if (GL_NO_ERROR != err) { PanicAlert("Can't save texture, GL Error: %d", err); - delete[] data; return false; } - bool success = TextureToPng(data, width * 4, filename, width, height, true); - delete[] data; - return success; + + return TextureToPng(data.data(), width * 4, filename, width, height, true); } TextureCache::TCacheEntry::~TCacheEntry()