VideoCommon: Add custom stride for framedumping.

This commit is contained in:
degasus 2016-10-08 15:28:12 +02:00
parent 1ef5ba0c53
commit 0864ef4352
8 changed files with 19 additions and 27 deletions

View file

@ -555,30 +555,20 @@ bool Renderer::IsFrameDumping()
return false;
}
void Renderer::DumpFrameData(const u8* data, int w, int h, AVIDump::DumpFormat format,
void Renderer::DumpFrameData(const u8* data, int w, int h, int stride, AVIDump::DumpFormat format,
bool swap_upside_down)
{
#if defined(HAVE_LIBAV) || defined(_WIN32)
if (w == 0 || h == 0)
return;
size_t image_size;
switch (format)
{
case AVIDump::DumpFormat::FORMAT_BGR:
image_size = 3 * w * h;
break;
case AVIDump::DumpFormat::FORMAT_RGBA:
image_size = 4 * w * h;
break;
}
m_last_framedump_width = w;
m_last_framedump_height = h;
m_last_framedump_format = format;
m_last_framedump_stride = stride;
// TODO: Refactor this. Right now it's needed for the implace flipping of the image.
m_frame_data.assign(data, data + image_size);
m_frame_data.assign(data, data + stride * h);
if (!m_last_frame_dumped)
{
@ -598,7 +588,7 @@ void Renderer::DumpFrameData(const u8* data, int w, int h, AVIDump::DumpFormat f
{
if (swap_upside_down)
FlipImageData(m_frame_data.data(), w, h, 4);
AVIDump::AddFrame(m_frame_data.data(), w, h);
AVIDump::AddFrame(m_frame_data.data(), w, h, stride);
}
m_last_frame_dumped = true;