From fde87c40d25b0d27267924216de78b546bbc73ce Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sat, 7 Apr 2018 19:56:54 +0200 Subject: [PATCH] - fix crash when in software truecolor mode - the pitch is in pixels, not bytes --- src/gl/scene/gl_swscene.cpp | 2 +- src/v_video.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gl/scene/gl_swscene.cpp b/src/gl/scene/gl_swscene.cpp index 5114de3aed..248016c451 100644 --- a/src/gl/scene/gl_swscene.cpp +++ b/src/gl/scene/gl_swscene.cpp @@ -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"); diff --git a/src/v_video.h b/src/v_video.h index 7f745de20b..393ffb8919 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -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);