Core: Remove ImageWrite and get rid of -Wmissing-declarations warnings

This commit is contained in:
Léo Lam
2020-12-16 15:34:50 +01:00
parent eafe005672
commit 0ad2f3da45
10 changed files with 57 additions and 103 deletions

View File

@ -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));
}
}