mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +00:00
Merge pull request #11561 from Rinnegatamante/switches
Don't realloc video buffer when unnecessary.
This commit is contained in:
commit
4d961b0970
@ -738,6 +738,12 @@ static bool gl1_gfx_frame(void *data, const void *frame,
|
|||||||
video_width, video_height, false, true);
|
video_width, video_height, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !frame || frame == RETRO_HW_FRAME_BUFFER_VALID || (
|
||||||
|
frame_width == 4 &&
|
||||||
|
frame_height == 4 &&
|
||||||
|
(frame_width < width && frame_height < height))
|
||||||
|
)
|
||||||
|
draw = false;
|
||||||
|
|
||||||
|
|
||||||
if ( gl1->video_width != frame_width ||
|
if ( gl1->video_width != frame_width ||
|
||||||
@ -753,12 +759,15 @@ static bool gl1_gfx_frame(void *data, const void *frame,
|
|||||||
pot_width = get_pot(frame_width);
|
pot_width = get_pot(frame_width);
|
||||||
pot_height = get_pot(frame_height);
|
pot_height = get_pot(frame_height);
|
||||||
|
|
||||||
|
if (draw)
|
||||||
|
{
|
||||||
if (gl1->video_buf)
|
if (gl1->video_buf)
|
||||||
free(gl1->video_buf);
|
free(gl1->video_buf);
|
||||||
|
|
||||||
gl1->video_buf = (unsigned char*)malloc(pot_width * pot_height * 4);
|
gl1->video_buf = (unsigned char*)malloc(pot_width * pot_height * 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
width = gl1->video_width;
|
width = gl1->video_width;
|
||||||
height = gl1->video_height;
|
height = gl1->video_height;
|
||||||
@ -767,13 +776,6 @@ static bool gl1_gfx_frame(void *data, const void *frame,
|
|||||||
pot_width = get_pot(width);
|
pot_width = get_pot(width);
|
||||||
pot_height = get_pot(height);
|
pot_height = get_pot(height);
|
||||||
|
|
||||||
if ( !frame || frame == RETRO_HW_FRAME_BUFFER_VALID || (
|
|
||||||
frame_width == 4 &&
|
|
||||||
frame_height == 4 &&
|
|
||||||
(frame_width < width && frame_height < height))
|
|
||||||
)
|
|
||||||
draw = false;
|
|
||||||
|
|
||||||
if (draw && gl1->video_buf)
|
if (draw && gl1->video_buf)
|
||||||
{
|
{
|
||||||
if (bits == 32)
|
if (bits == 32)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user