diff options
| author | iwubcode <iwubcode@users.noreply.github.com> | 2017-10-24 00:44:14 -0500 |
|---|---|---|
| committer | iwubcode <iwubcode@users.noreply.github.com> | 2017-11-17 22:11:33 -0600 |
| commit | bf7db3f88835d3b69800c9ed5596e31c7ba96346 (patch) | |
| tree | 2d548b0b8326d0daa1d57a7a9760514db44b40a8 /Source/Core/VideoBackends/Software/SWTexture.cpp | |
| parent | 332af8aa491a320d00b4989e9e4f1a25b59588c3 (diff) | |
Software Backend: Remove reinterpret_cast which violates the strict aliasing rule
Diffstat (limited to 'Source/Core/VideoBackends/Software/SWTexture.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/Software/SWTexture.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Source/Core/VideoBackends/Software/SWTexture.cpp b/Source/Core/VideoBackends/Software/SWTexture.cpp index 2ca31343f4..aa279b520b 100644 --- a/Source/Core/VideoBackends/Software/SWTexture.cpp +++ b/Source/Core/VideoBackends/Software/SWTexture.cpp @@ -44,8 +44,15 @@ void SWTexture::CopyRectangleFromTexture(const AbstractTexture* source, } else { - CopyRegion(reinterpret_cast<const Pixel*>(software_source_texture->GetData()), srcrect, - reinterpret_cast<Pixel*>(GetData()), dstrect); + std::vector<Pixel> source_pixels; + source_pixels.resize(srcrect.GetHeight() * srcrect.GetWidth() * 4); + memcpy(source_pixels.data(), software_source_texture->GetData(), source_pixels.size()); + + std::vector<Pixel> destination_pixels; + destination_pixels.resize(dstrect.GetHeight() * dstrect.GetWidth() * 4); + + CopyRegion(source_pixels.data(), srcrect, destination_pixels.data(), dstrect); + memcpy(GetData(), destination_pixels.data(), destination_pixels.size()); } } |
