mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-02-17 01:21:12 +00:00
soft: scale small video
in case if aspect ratio is same as window
This commit is contained in:
parent
fa3ec83253
commit
2b24ee9b53
1 changed files with 36 additions and 3 deletions
|
@ -2225,9 +2225,14 @@ RE_Draw_StretchDirectRaw(int x, int y, int w, int h, int cols, int rows, const b
|
||||||
int pitch;
|
int pitch;
|
||||||
Uint32 *pixels;
|
Uint32 *pixels;
|
||||||
|
|
||||||
|
if (!cols || !rows || !data)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (bits != 32 || x || y ||
|
if (bits != 32 || x || y ||
|
||||||
w != vid_buffer_width || h != vid_buffer_height ||
|
w != vid_buffer_width || h != vid_buffer_height ||
|
||||||
cols != vid_buffer_width || rows != vid_buffer_height)
|
cols > vid_buffer_width || rows > vid_buffer_height)
|
||||||
{
|
{
|
||||||
/* Not full screen update */
|
/* Not full screen update */
|
||||||
RE_Draw_StretchRaw(x, y, w, h, cols, rows, data, bits);
|
RE_Draw_StretchRaw(x, y, w, h, cols, rows, data, bits);
|
||||||
|
@ -2257,11 +2262,39 @@ RE_Draw_StretchDirectRaw(int x, int y, int w, int h, int cols, int rows, const b
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(pixels, data, vid_buffer_width * vid_buffer_height * sizeof(Uint32));
|
if (cols == vid_buffer_width && rows == vid_buffer_height)
|
||||||
|
{
|
||||||
|
memcpy(pixels, data, vid_buffer_width * vid_buffer_height * sizeof(Uint32));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < rows; i++)
|
||||||
|
{
|
||||||
|
memcpy(pixels + i * vid_buffer_width,
|
||||||
|
data + i * cols * sizeof(Uint32),
|
||||||
|
cols * sizeof(Uint32)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SDL_UnlockTexture(texture);
|
SDL_UnlockTexture(texture);
|
||||||
|
|
||||||
SDL_RenderCopy(renderer, texture, NULL, NULL);
|
if (cols == vid_buffer_width && rows == vid_buffer_height)
|
||||||
|
{
|
||||||
|
SDL_RenderCopy(renderer, texture, NULL, NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SDL_Rect srcrect;
|
||||||
|
srcrect.x = 0;
|
||||||
|
srcrect.y = 0;
|
||||||
|
srcrect.w = cols;
|
||||||
|
srcrect.h = rows;
|
||||||
|
SDL_RenderCopy(renderer, texture, &srcrect, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
SDL_RenderPresent(renderer);
|
SDL_RenderPresent(renderer);
|
||||||
|
|
||||||
is_render_flushed = true;
|
is_render_flushed = true;
|
||||||
|
|
Loading…
Reference in a new issue