mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-13 00:58:29 +02:00
Software Backend: Fix xfb output and add vertical scaling support
This commit is contained in:
@ -4,8 +4,13 @@
|
||||
|
||||
#include "VideoBackends/Software/SWTexture.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "VideoBackends/Software/CopyRegion.h"
|
||||
|
||||
namespace SW
|
||||
{
|
||||
|
||||
SWTexture::SWTexture(const TextureConfig& tex_config) : AbstractTexture(tex_config)
|
||||
{
|
||||
}
|
||||
@ -18,11 +23,38 @@ void SWTexture::CopyRectangleFromTexture(const AbstractTexture* source,
|
||||
const MathUtil::Rectangle<int>& srcrect,
|
||||
const MathUtil::Rectangle<int>& dstrect)
|
||||
{
|
||||
const SWTexture * software_source_texture = static_cast<const SWTexture*>(source);
|
||||
|
||||
if (srcrect.GetWidth() == dstrect.GetWidth() && srcrect.GetHeight() == dstrect.GetHeight())
|
||||
{
|
||||
m_data.assign(software_source_texture->GetData(), software_source_texture->GetData() + m_data.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
copy_region(software_source_texture->GetData(), srcrect, GetData(), dstrect);
|
||||
}
|
||||
}
|
||||
|
||||
void SWTexture::Load(u32 level, u32 width, u32 height, u32 row_length, const u8* buffer,
|
||||
size_t buffer_size)
|
||||
{
|
||||
m_data.assign(buffer, buffer + buffer_size);
|
||||
}
|
||||
|
||||
const u8* SWTexture::GetData() const
|
||||
{
|
||||
return m_data.data();
|
||||
}
|
||||
|
||||
u8* SWTexture::GetData()
|
||||
{
|
||||
return m_data.data();
|
||||
}
|
||||
|
||||
std::optional<AbstractTexture::RawTextureInfo> SWTexture::MapFullImpl()
|
||||
{
|
||||
return AbstractTexture::RawTextureInfo{ GetData(),
|
||||
m_config.width * 4, m_config.width, m_config.height };
|
||||
}
|
||||
|
||||
} // namespace SW
|
||||
|
Reference in New Issue
Block a user