diff libvo/vo_x11.c @ 4718:c70b0c4b85f5

avoid allocating a dummy scaler as debug/info messages will only be printed for the first allocated scaler unless -v -v is used
author michael
date Fri, 15 Feb 2002 22:31:10 +0000
parents b4f72d6b2365
children 9ff121145b20
line wrap: on
line diff
--- a/libvo/vo_x11.c	Fri Feb 15 16:48:25 2002 +0000
+++ b/libvo/vo_x11.c	Fri Feb 15 22:31:10 2002 +0000
@@ -107,6 +107,8 @@
 static uint32_t image_height;
 static uint32_t in_format;
 static uint32_t out_format=0;
+static int srcW=-1;
+static int srcH=-1;
 static int aspect; // 1<<16 based fixed point aspect, so that the aspect stays correct during resizing
 
 static void check_events(){
@@ -261,6 +263,8 @@
 #endif
 
  in_format=format;
+ srcW= width;
+ srcH= height;
  
  if( flags&0x03 ) fullscreen = 1;
  if( flags&0x02 ) vm = 1;
@@ -401,8 +405,9 @@
    	default:  draw_alpha_fnc=draw_alpha_null;
   }
 
-  /* no scaling here, it will be changed during draw_slice if -zoom is on so we dont dupplicate the code */
-  swsContext= getSwsContextFromCmdLine(width, height, in_format, width, height, out_format );
+  /* we avoid unnecessary allocating the swsContext here as it is allocated during draw_slice if zoom is on */
+  if(!zoomFlag)
+	swsContext= getSwsContextFromCmdLine(width, height, in_format, width, height, out_format );
 
 //  printf( "X11 color mask:  R:%lX  G:%lX  B:%lX\n",myximage->red_mask,myximage->green_mask,myximage->blue_mask );
 
@@ -494,7 +499,7 @@
 
     if(sws_flags==0) newW&= (~31); // not needed but, if the user wants the FAST_BILINEAR SCALER, then its needed
 
-    swsContext= getSwsContextFromCmdLine(oldContext->srcW, oldContext->srcH, in_format, 
+    swsContext= getSwsContextFromCmdLine(srcW, srcH, in_format, 
     					 newW, newH, out_format);
     if(swsContext)
     {