remove buggy DoomBytesPerPixel == 3 code
This commit is contained in:
parent
4af51529cf
commit
c74de66798
2 changed files with 2 additions and 37 deletions
|
@ -23,10 +23,7 @@
|
|||
#include "dp_util.hpp"
|
||||
#include "doomlib.hpp"
|
||||
|
||||
#if DoomBytesPerPixel == 3
|
||||
// FIXME: don't use, it's buggy
|
||||
static const u32 DoomSdlTexturePixelFormat = SDL_PIXELFORMAT_RGB888;
|
||||
#elif DoomBytesPerPixel == 4
|
||||
#if DoomBytesPerPixel == 4
|
||||
static const u32 DoomSdlTexturePixelFormat = SDL_PIXELFORMAT_ARGB8888;
|
||||
#else
|
||||
#error Unhandled DoomBytesPerPixel value. Which SDL_PIXELFORMAT to use?
|
||||
|
@ -340,35 +337,8 @@ void do_networking(ControllerContext &ctx)
|
|||
#endif
|
||||
|
||||
|
||||
#if 0
|
||||
// FIXME: buggy. black screen with tiny bar on top
|
||||
//log_trace("Texture update for doom (pid=%d, texture=%p)", ds.id, ds.texture);
|
||||
|
||||
u8 *destPixels = nullptr;
|
||||
int texturePitch = 0;
|
||||
|
||||
if (SDL_LockTexture(ds.texture, nullptr, reinterpret_cast<void **>(&destPixels), &texturePitch))
|
||||
dp_sdl_fatal("SDL_LockTexture");
|
||||
|
||||
// When using 3 bytes per pixel (960 bytes per row), SDL yields
|
||||
// a pitch of 1280 on my machine. This is likely done to get
|
||||
// good alignment.
|
||||
assert(DoomFramePitch <= texturePitch);
|
||||
|
||||
for (size_t row=0; row<DoomScreenHeight; ++row)
|
||||
{
|
||||
u8 *destRow = destPixels + row + texturePitch;
|
||||
const u8 *sourceRow = sourcePixels + row * DoomFramePitch;
|
||||
std::memcpy(destRow, sourceRow, DoomFramePitch);
|
||||
}
|
||||
|
||||
SDL_UnlockTexture(ds.texture);
|
||||
#else
|
||||
// FIXME: buggy. sometimes crashes with DoomBytesPerPixel=3, hasn't crashed with DoomBytesPerPixel=4 yet.
|
||||
// In the latter case SDL texture pitch equals DoomFramePitch...
|
||||
if (SDL_UpdateTexture(ds.texture, nullptr, sourcePixels, DoomFramePitch))
|
||||
dp_sdl_fatal("SDL_UpdateTexture");
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -313,12 +313,7 @@ void IB_FinishUpdate (void)
|
|||
|
||||
void IB_GetColor(unsigned char *bytes, unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
#if DoomBytesPerPixel == 3
|
||||
// FIXME: this is buggy
|
||||
bytes[0] = red;
|
||||
bytes[1] = green;
|
||||
bytes[2] = blue;
|
||||
#elif DoomBytesPerPixel == 4
|
||||
#if DoomBytesPerPixel == 4
|
||||
bytes[0] = blue;
|
||||
bytes[1] = green;
|
||||
bytes[2] = red;
|
||||
|
|
Loading…
Reference in a new issue