mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Reworked Screenshot saving.
Now OGL doesn't rely on WX for PNG saving. FlipImageData supports (pixel data len > 3) now. TextureToPng is now in ImageWrite.cpp/h Video Common depends on zlib and png. D3D no longer depends on zlib and png.
This commit is contained in:
@ -14,6 +14,7 @@
|
||||
#include "PSTextureEncoder.h"
|
||||
#include "HW/Memmap.h"
|
||||
#include "VideoConfig.h"
|
||||
#include "ImageWrite.h"
|
||||
|
||||
namespace DX11
|
||||
{
|
||||
@ -54,6 +55,8 @@ bool TextureCache::TCacheEntry::Save(const char filename[], unsigned int level)
|
||||
|
||||
HRESULT hr = D3D::device->CreateTexture2D(&desc, NULL, &pNewTexture);
|
||||
|
||||
bool saved_png = false;
|
||||
|
||||
if (SUCCEEDED(hr) && pNewTexture)
|
||||
{
|
||||
D3D::context->CopyResource(pNewTexture, pSurface);
|
||||
@ -62,13 +65,19 @@ bool TextureCache::TCacheEntry::Save(const char filename[], unsigned int level)
|
||||
HRESULT hr = D3D::context->Map(pNewTexture, 0, D3D11_MAP_READ_WRITE, 0, &map);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hr = D3D::TextureToPng(map, filename, desc.Width, desc.Height);
|
||||
if (map.pData)
|
||||
{
|
||||
u8* data = new u8[map.RowPitch * desc.Height];
|
||||
memcpy(data, map.pData, map.RowPitch * desc.Height);
|
||||
|
||||
saved_png = TextureToPng(data, map.RowPitch, filename, desc.Width, desc.Height);
|
||||
}
|
||||
D3D::context->Unmap(pNewTexture, 0);
|
||||
}
|
||||
SAFE_RELEASE(pNewTexture);
|
||||
}
|
||||
|
||||
return SUCCEEDED(hr);
|
||||
return saved_png;
|
||||
}
|
||||
|
||||
void TextureCache::TCacheEntry::Load(unsigned int width, unsigned int height,
|
||||
|
Reference in New Issue
Block a user