mirror of https://github.com/PCSX2/pcsx2.git
gsdx: Allow screenshot compression level to be changed
At higher resolutions it takes too much time to save a screenshot at the maximum compression level. So let's allow the user to set the compression level. This re-uses the png_compression_level setting. The default compression level is 1 for speed, but if the user wishes to increase the compression level (without using an external tool) and doesn't mind if the screenshot takes more time to save then they can increase the compression level up to a maximum of 9 (which can take quite a while). Fixes #1527.
This commit is contained in:
parent
d6b834e8af
commit
2b2042e1c2
|
@ -489,7 +489,7 @@ void GSRenderer::VSync(int field)
|
|||
|
||||
if(GSTexture* t = m_dev->GetCurrent())
|
||||
{
|
||||
t->Save(m_snapshot + ".bmp", true);
|
||||
t->Save(m_snapshot + ".bmp");
|
||||
}
|
||||
|
||||
m_snapshot.clear();
|
||||
|
|
|
@ -551,13 +551,13 @@ void GSRendererHW::Draw()
|
|||
(int)context->CLAMP.MINU, (int)context->CLAMP.MAXU,
|
||||
(int)context->CLAMP.MINV, (int)context->CLAMP.MAXV);
|
||||
|
||||
tex->m_texture->Save(m_dump_root+s, false, true);
|
||||
tex->m_texture->Save(m_dump_root+s, true);
|
||||
|
||||
if(tex->m_palette)
|
||||
{
|
||||
s = format("%05d_f%lld_tpx_%05x_%d.dds", s_n, frame, context->TEX0.CBP, context->TEX0.CPSM);
|
||||
|
||||
tex->m_palette->Save(m_dump_root+s, false, true);
|
||||
tex->m_palette->Save(m_dump_root+s, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
virtual bool Update(const GSVector4i& r, const void* data, int pitch) = 0;
|
||||
virtual bool Map(GSMap& m, const GSVector4i* r = NULL) = 0;
|
||||
virtual void Unmap() = 0;
|
||||
virtual bool Save(const string& fn, bool user_image = false, bool dds = false) = 0;
|
||||
virtual bool Save(const string& fn, bool dds = false) = 0;
|
||||
virtual uint32 GetID() { return 0; }
|
||||
|
||||
GSVector2 GetScale() const {return m_scale;}
|
||||
|
|
|
@ -93,7 +93,7 @@ void GSTexture11::Unmap()
|
|||
}
|
||||
}
|
||||
|
||||
bool GSTexture11::Save(const string& fn, bool user_image, bool dds)
|
||||
bool GSTexture11::Save(const string& fn, bool dds)
|
||||
{
|
||||
CComPtr<ID3D11Texture2D> res;
|
||||
D3D11_TEXTURE2D_DESC desc;
|
||||
|
@ -179,7 +179,7 @@ bool GSTexture11::Save(const string& fn, bool user_image, bool dds)
|
|||
return false;
|
||||
}
|
||||
|
||||
int compression = user_image ? Z_BEST_COMPRESSION : theApp.GetConfigI("png_compression_level");
|
||||
int compression = theApp.GetConfigI("png_compression_level");
|
||||
bool success = GSPng::Save(format, fn, static_cast<uint8*>(sm.pData), desc.Width, desc.Height, sm.RowPitch, compression);
|
||||
|
||||
m_ctx->Unmap(res, 0);
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
bool Update(const GSVector4i& r, const void* data, int pitch);
|
||||
bool Map(GSMap& m, const GSVector4i* r);
|
||||
void Unmap();
|
||||
bool Save(const string& fn, bool user_image = false, bool dds = false);
|
||||
bool Save(const string& fn, bool dds = false);
|
||||
|
||||
operator ID3D11Texture2D*();
|
||||
operator ID3D11ShaderResourceView*();
|
||||
|
|
|
@ -142,7 +142,7 @@ void GSTexture9::Unmap()
|
|||
}
|
||||
}
|
||||
|
||||
bool GSTexture9::Save(const string& fn, bool user_image, bool dds)
|
||||
bool GSTexture9::Save(const string& fn, bool dds)
|
||||
{
|
||||
bool rb_swapped = true;
|
||||
CComPtr<IDirect3DSurface9> surface;
|
||||
|
@ -201,7 +201,7 @@ bool GSTexture9::Save(const string& fn, bool user_image, bool dds)
|
|||
return false;
|
||||
}
|
||||
|
||||
int compression = user_image ? Z_BEST_COMPRESSION : theApp.GetConfigI("png_compression_level");
|
||||
int compression = theApp.GetConfigI("png_compression_level");
|
||||
bool success = GSPng::Save(format, fn, static_cast<uint8*>(slr.pBits), desc.Width, desc.Height, slr.Pitch, compression, rb_swapped);
|
||||
|
||||
surface->UnlockRect();
|
||||
|
|
|
@ -38,7 +38,7 @@ public:
|
|||
bool Update(const GSVector4i& r, const void* data, int pitch);
|
||||
bool Map(GSMap& m, const GSVector4i* r);
|
||||
void Unmap();
|
||||
bool Save(const string& fn, bool user_image = false, bool dds = false);
|
||||
bool Save(const string& fn, bool dds = false);
|
||||
|
||||
operator IDirect3DSurface9*();
|
||||
operator IDirect3DTexture9*();
|
||||
|
|
|
@ -37,5 +37,5 @@ public:
|
|||
bool Update(const GSVector4i& r, const void* data, int pitch) {return true;}
|
||||
bool Map(GSMap& m, const GSVector4i* r) {return false;}
|
||||
void Unmap() {}
|
||||
bool Save(const string& fn, bool user_image = false, bool dds = false) { return false; }
|
||||
bool Save(const string& fn, bool dds = false) {return false;}
|
||||
};
|
||||
|
|
|
@ -443,7 +443,7 @@ void GSTextureOGL::Unmap()
|
|||
}
|
||||
}
|
||||
|
||||
bool GSTextureOGL::Save(const string& fn, bool user_image, bool dds)
|
||||
bool GSTextureOGL::Save(const string& fn, bool dds)
|
||||
{
|
||||
// Collect the texture data
|
||||
uint32 pitch = 4 * m_size.x;
|
||||
|
@ -492,7 +492,7 @@ bool GSTextureOGL::Save(const string& fn, bool user_image, bool dds)
|
|||
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
||||
}
|
||||
|
||||
int compression = user_image ? Z_BEST_COMPRESSION : theApp.GetConfigI("png_compression_level");
|
||||
int compression = theApp.GetConfigI("png_compression_level");
|
||||
return GSPng::Save(fmt, fn, image.get(), m_size.x, m_size.y, pitch, compression);
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ class GSTextureOGL final : public GSTexture
|
|||
bool Update(const GSVector4i& r, const void* data, int pitch) final;
|
||||
bool Map(GSMap& m, const GSVector4i* r = NULL) final;
|
||||
void Unmap() final;
|
||||
bool Save(const string& fn, bool user_image = false, bool dds = false) final;
|
||||
bool Save(const string& fn, bool dds = false) final;
|
||||
|
||||
bool IsBackbuffer() { return (m_type == GSTexture::Backbuffer); }
|
||||
bool IsDss() { return (m_type == GSTexture::DepthStencil); }
|
||||
|
|
|
@ -85,7 +85,7 @@ void GSTextureSW::Unmap()
|
|||
m_mapped.clear(std::memory_order_release);
|
||||
}
|
||||
|
||||
bool GSTextureSW::Save(const string& fn, bool user_image, bool dds)
|
||||
bool GSTextureSW::Save(const string& fn, bool dds)
|
||||
{
|
||||
if(dds) return false; // not implemented
|
||||
|
||||
|
@ -94,6 +94,6 @@ bool GSTextureSW::Save(const string& fn, bool user_image, bool dds)
|
|||
#else
|
||||
GSPng::Format fmt = GSPng::RGB_PNG;
|
||||
#endif
|
||||
int compression = user_image ? Z_BEST_COMPRESSION : theApp.GetConfigI("png_compression_level");
|
||||
int compression = theApp.GetConfigI("png_compression_level");
|
||||
return GSPng::Save(fmt, fn, static_cast<uint8*>(m_data), m_size.x, m_size.y, m_pitch, compression);
|
||||
}
|
||||
|
|
|
@ -38,5 +38,5 @@ public:
|
|||
bool Update(const GSVector4i& r, const void* data, int pitch);
|
||||
bool Map(GSMap& m, const GSVector4i* r);
|
||||
void Unmap();
|
||||
bool Save(const string& fn, bool user_image = false, bool dds = false);
|
||||
bool Save(const string& fn, bool dds = false);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue