mirror of
https://github.com/mpv-player/mpv
synced 2024-12-18 04:45:33 +00:00
Avoid one more duplicated logic.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28099 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
e7d53f6d86
commit
7fd346bc71
@ -681,6 +681,7 @@ static int draw_slice(uint8_t *src[], int stride[], int w,int h,int x,int y)
|
||||
}
|
||||
|
||||
static uint32_t get_image(mp_image_t *mpi) {
|
||||
int needed_size;
|
||||
if (!GenBuffers || !BindBuffer || !BufferData || !MapBuffer) {
|
||||
if (!err_shown)
|
||||
mp_msg(MSGT_VO, MSGL_ERR, "[gl] extensions missing for dr\n"
|
||||
@ -697,8 +698,9 @@ static uint32_t get_image(mp_image_t *mpi) {
|
||||
GenBuffers(1, &gl_buffer);
|
||||
BindBuffer(GL_PIXEL_UNPACK_BUFFER, gl_buffer);
|
||||
mpi->stride[0] = mpi->width * mpi->bpp / 8;
|
||||
if (mpi->stride[0] * mpi->height > gl_buffersize) {
|
||||
gl_buffersize = mpi->stride[0] * mpi->height;
|
||||
needed_size = mpi->stride[0] * mpi->height;
|
||||
if (needed_size > gl_buffersize) {
|
||||
gl_buffersize = needed_size;
|
||||
BufferData(GL_PIXEL_UNPACK_BUFFER, gl_buffersize,
|
||||
NULL, GL_DYNAMIC_DRAW);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user