mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 17:19:44 -06:00
Use IOFile for TextureToPng to support non-ascii
Changed save texture/screenshot uses to std::string Removed unneeded new/delete calls when dealing with temp data.
This commit is contained in:
@ -694,15 +694,7 @@ bool Renderer::SaveScreenshot(const std::string &filename, const TargetRectangle
|
||||
D3D11_MAPPED_SUBRESOURCE map;
|
||||
D3D::context->Map(s_screenshot_texture, 0, D3D11_MAP_READ_WRITE, 0, &map);
|
||||
|
||||
bool saved_png = false;
|
||||
if (map.pData)
|
||||
{
|
||||
u8* data = new u8[map.RowPitch * rc.GetHeight()];
|
||||
memcpy(data, map.pData, map.RowPitch * rc.GetHeight());
|
||||
|
||||
saved_png = TextureToPng(data, map.RowPitch, filename.c_str(), rc.GetWidth(), rc.GetHeight(), false);
|
||||
delete[] data;
|
||||
}
|
||||
bool saved_png = TextureToPng((u8*)map.pData, map.RowPitch, filename, rc.GetWidth(), rc.GetHeight(), false);
|
||||
|
||||
D3D::context->Unmap(s_screenshot_texture, 0);
|
||||
|
||||
|
@ -33,7 +33,7 @@ void TextureCache::TCacheEntry::Bind(unsigned int stage)
|
||||
D3D::context->PSSetShaderResources(stage, 1, &texture->GetSRV());
|
||||
}
|
||||
|
||||
bool TextureCache::TCacheEntry::Save(const char filename[], unsigned int level)
|
||||
bool TextureCache::TCacheEntry::Save(const std::string filename, unsigned int level)
|
||||
{
|
||||
// TODO: Somehow implement this (D3DX11 doesn't support dumping individual LODs)
|
||||
static bool warn_once = true;
|
||||
@ -65,14 +65,7 @@ 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))
|
||||
{
|
||||
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);
|
||||
delete[] data;
|
||||
}
|
||||
saved_png = TextureToPng((u8*)map.pData, map.RowPitch, filename, desc.Width, desc.Height);
|
||||
D3D::context->Unmap(pNewTexture, 0);
|
||||
}
|
||||
SAFE_RELEASE(pNewTexture);
|
||||
|
@ -36,7 +36,7 @@ private:
|
||||
const float *colmat);
|
||||
|
||||
void Bind(unsigned int stage);
|
||||
bool Save(const char filename[], unsigned int level);
|
||||
bool Save(const std::string filename, unsigned int level);
|
||||
};
|
||||
|
||||
TCacheEntryBase* CreateTexture(unsigned int width, unsigned int height,
|
||||
|
Reference in New Issue
Block a user