Software Backend: allow screenshots/video to be taken with valid data

This commit is contained in:
iwubcode 2017-10-02 00:21:10 -05:00
parent 7248dd47d5
commit 0f7f4ccaf9
1 changed files with 15 additions and 1 deletions

View File

@ -10,8 +10,21 @@
namespace SW namespace SW
{ {
namespace
{
#pragma pack(push, 1)
struct Pixel
{
u8 r;
u8 g;
u8 b;
u8 a;
};
#pragma pack(pop)
}
SWTexture::SWTexture(const TextureConfig& tex_config) : AbstractTexture(tex_config) SWTexture::SWTexture(const TextureConfig& tex_config) : AbstractTexture(tex_config)
{ {
m_data.resize(tex_config.width * tex_config.height * 4);
} }
void SWTexture::Bind(unsigned int stage) void SWTexture::Bind(unsigned int stage)
@ -31,7 +44,8 @@ void SWTexture::CopyRectangleFromTexture(const AbstractTexture* source,
} }
else else
{ {
copy_region(software_source_texture->GetData(), srcrect, GetData(), dstrect); copy_region(reinterpret_cast<const Pixel*>(software_source_texture->GetData()), srcrect,
reinterpret_cast<Pixel*>(GetData()), dstrect);
} }
} }