summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/D3D/Render.cpp
diff options
context:
space:
mode:
authorFog <christhecoolist@gmail.com>2015-01-17 13:47:07 -0500
committerFog <christhecoolist@gmail.com>2015-01-21 19:47:45 -0500
commit6cad635bd887634b1908c61ef6039420890b2ba2 (patch)
tree270a4732080bb71e846b98931bccbf6815d97ca2 /Source/Core/VideoBackends/D3D/Render.cpp
parente7f2a04699c0e7e622028b4feba07fb6f46142bf (diff)
Use ffmpeg for Windows Video Dumping instead of VFW
Diffstat (limited to 'Source/Core/VideoBackends/D3D/Render.cpp')
-rw-r--r--Source/Core/VideoBackends/D3D/Render.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/Source/Core/VideoBackends/D3D/Render.cpp b/Source/Core/VideoBackends/D3D/Render.cpp
index 268a408022..9d7b661af5 100644
--- a/Source/Core/VideoBackends/D3D/Render.cpp
+++ b/Source/Core/VideoBackends/D3D/Render.cpp
@@ -800,7 +800,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co
{
s_recordWidth = GetTargetRectangle().GetWidth();
s_recordHeight = GetTargetRectangle().GetHeight();
- bAVIDumping = AVIDump::Start(D3D::hWnd, s_recordWidth, s_recordHeight);
+ bAVIDumping = AVIDump::Start(s_recordWidth, s_recordHeight);
if (!bAVIDumping)
{
PanicAlert("Error dumping frames to AVI.");
@@ -825,6 +825,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co
h = s_recordHeight;
}
formatBufferDump((u8*)map.pData, &frame_data[0], s_recordWidth, s_recordHeight, map.RowPitch);
+ FlipImageData(&frame_data[0], w, h);
AVIDump::AddFrame(&frame_data[0], GetTargetRectangle().GetWidth(), GetTargetRectangle().GetHeight());
D3D::context->Unmap(s_screenshot_texture, 0);
}
@@ -1275,4 +1276,16 @@ void Renderer::BlitScreen(TargetRectangle src, TargetRectangle dst, D3DTexture2D
}
}
+void Renderer::FlipImageData(u8 *data, int w, int h, int pixel_width)
+{
+ for (int y = 0; y < h / 2; ++y)
+ {
+ for (int x = 0; x < w; ++x)
+ {
+ for (int delta = 0; delta < pixel_width; ++delta)
+ std::swap(data[(y * w + x) * pixel_width + delta], data[((h - 1 - y) * w + x) * pixel_width + delta]);
+ }
+ }
+}
+
} // namespace DX11