summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Software/DebugUtil.cpp
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2020-12-16 15:34:50 +0100
committerLéo Lam <leo@leolam.fr>2020-12-16 16:04:19 +0100
commit0ad2f3da454feca1fc9ba9c3f8592e104028b936 (patch)
treecd52ccbc1db6a5718f2986a3d4f9ef3cec5a51f6 /Source/Core/VideoBackends/Software/DebugUtil.cpp
parenteafe0056721d828636be540cddf3c1226f88f334 (diff)
Core: Remove ImageWrite and get rid of -Wmissing-declarations warnings
Diffstat (limited to 'Source/Core/VideoBackends/Software/DebugUtil.cpp')
-rw-r--r--Source/Core/VideoBackends/Software/DebugUtil.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/Source/Core/VideoBackends/Software/DebugUtil.cpp b/Source/Core/VideoBackends/Software/DebugUtil.cpp
index c427160fc7..4c20c08d1a 100644
--- a/Source/Core/VideoBackends/Software/DebugUtil.cpp
+++ b/Source/Core/VideoBackends/Software/DebugUtil.cpp
@@ -5,18 +5,18 @@
#include "VideoBackends/Software/DebugUtil.h"
#include <cstring>
+#include <memory>
#include "Common/CommonTypes.h"
#include "Common/FileUtil.h"
+#include "Common/Image.h"
#include "Common/StringUtil.h"
#include "Common/Swap.h"
#include "VideoBackends/Software/EfbInterface.h"
-#include "VideoBackends/Software/SWRenderer.h"
#include "VideoBackends/Software/TextureSampler.h"
#include "VideoCommon/BPMemory.h"
-#include "VideoCommon/ImageWrite.h"
#include "VideoCommon/Statistics.h"
#include "VideoCommon/VideoCommon.h"
#include "VideoCommon/VideoConfig.h"
@@ -61,12 +61,10 @@ static void SaveTexture(const std::string& filename, u32 texmap, s32 mip)
u32 width = ti0.width + 1;
u32 height = ti0.height + 1;
- u8* data = new u8[width * height * 4];
+ auto data = std::make_unique<u8[]>(width * height * 4);
- GetTextureRGBA(data, texmap, mip, width, height);
-
- TextureToPng(data, width * 4, filename, width, height, true);
- delete[] data;
+ GetTextureRGBA(data.get(), texmap, mip, width, height);
+ Common::SavePNG(filename, data.get(), Common::ImageByteFormat::RGBA, width, height, width * 4);
}
void GetTextureRGBA(u8* dst, u32 texmap, s32 mip, u32 width, u32 height)
@@ -133,8 +131,8 @@ void DumpActiveTextures()
static void DumpEfb(const std::string& filename)
{
- u8* data = new u8[EFB_WIDTH * EFB_HEIGHT * 4];
- u8* writePtr = data;
+ auto data = std::make_unique<u8[]>(EFB_WIDTH * EFB_HEIGHT * 4);
+ u8* writePtr = data.get();
for (u32 y = 0; y < EFB_HEIGHT; y++)
{
@@ -148,8 +146,8 @@ static void DumpEfb(const std::string& filename)
}
}
- TextureToPng(data, EFB_WIDTH * 4, filename, EFB_WIDTH, EFB_HEIGHT, true);
- delete[] data;
+ Common::SavePNG(filename, data.get(), Common::ImageByteFormat::RGBA, EFB_WIDTH, EFB_HEIGHT,
+ EFB_WIDTH * 4);
}
void DrawObjectBuffer(s16 x, s16 y, const u8* color, int bufferBase, int subBuffer,
@@ -219,7 +217,8 @@ void OnObjectEnd()
"%sobject%i_%s(%i).png", File::GetUserPath(D_DUMPOBJECTS_IDX).c_str(),
g_stats.this_frame.num_drawn_objects, ObjectBufferName[i], i - BufferBase[i]);
- TextureToPng((u8*)ObjectBuffer[i], EFB_WIDTH * 4, filename, EFB_WIDTH, EFB_HEIGHT, true);
+ Common::SavePNG(filename, reinterpret_cast<u8*>(ObjectBuffer[i]),
+ Common::ImageByteFormat::RGBA, EFB_WIDTH, EFB_HEIGHT, EFB_WIDTH * 4);
memset(ObjectBuffer[i], 0, EFB_WIDTH * EFB_HEIGHT * sizeof(u32));
}
}