reorder copy vid_buffer to texture.

This commit is contained in:
Denis Pauk 2018-07-29 15:29:00 +03:00
parent ea27c460f2
commit 27cbd0d4e7

View file

@ -2078,19 +2078,38 @@ RE_SDLPaletteConvert (void)
static void
RE_CopyFrame (Uint32 * pixels, int pitch)
{
int y,x, buffer_pos;
RE_SDLPaletteConvert();
buffer_pos = 0;
for (y=0; y < vid.height; y++)
// no gaps between images rows
if (pitch == vid.width)
{
for (x=0; x < vid.width; x ++)
int y,x, buffer_pos;
buffer_pos = 0;
for (y=0; y < vid.height; y++)
{
pixels[x] = sw_state.palette_colors[vid_buffer[buffer_pos + x]];
for (x=0; x < vid.width; x ++)
{
pixels[x] = sw_state.palette_colors[vid_buffer[buffer_pos + x]];
}
pixels += pitch;
buffer_pos += vid.width;
}
}
else
{
const Uint32 *max_pixels;
Uint32 *pixels_pos;
pixel_t *buffer_pos;
max_pixels = pixels + vid.height * vid.width;
buffer_pos = vid_buffer;
for (pixels_pos = pixels; pixels_pos < max_pixels; pixels_pos++)
{
*pixels_pos = sw_state.palette_colors[*buffer_pos];
buffer_pos++;
}
pixels += pitch;
buffer_pos += vid.width;
}
}