- fix crash when in software truecolor mode - the pitch is in pixels, not bytes

This commit is contained in:
Magnus Norddahl 2018-04-07 19:56:54 +02:00
parent 1fc1fac2c2
commit fde87c40d2
2 changed files with 2 additions and 1 deletions

View file

@ -115,7 +115,7 @@ void SWSceneDrawer::RenderView(player_t *player)
}
auto buf = FBTexture->hwtex->MapBuffer();
if (!buf) I_FatalError("Unable to map buffer for software rendering");
buffer.SetBuffer(screen->GetWidth(), screen->GetHeight(), screen->GetWidth() * (swtruecolor ? 4 : 1), buf);
buffer.SetBuffer(screen->GetWidth(), screen->GetHeight(), screen->GetWidth(), buf);
SWRenderer->RenderView(player, &buffer);
FBTexture->hwtex->CreateTexture(nullptr, screen->GetWidth(), screen->GetHeight(), 0, false, 0, "swbuffer");

View file

@ -224,6 +224,7 @@ public:
inline int GetPitch () const { return Pitch; }
inline bool IsBgra() const { return Bgra; }
// Note: pitch here is in pixels, not bytes.
bool SetBuffer(int width, int height, int pitch, uint8_t *buffer)
{
assert(buffer);