changeset 28065:aec8703ff07f

Avoid one more duplicated logic.
author reimar
date Fri, 05 Dec 2008 20:56:49 +0000
parents 4d76c7e31760
children ccffc23bf229
files libvo/vo_gl.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_gl.c	Fri Dec 05 20:50:43 2008 +0000
+++ b/libvo/vo_gl.c	Fri Dec 05 20:56:49 2008 +0000
@@ -681,6 +681,7 @@
 }
 
 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 @@
     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);
   }