[MPlayer-dev-eng] [PATCH] avoid flickering while resize

Attila Kinali kinali at gmx.net
Mon Aug 25 20:41:40 CEST 2003


On Fri, 22 Aug 2003 13:41:57 +0300
Tomas Simonaitis <haden at homelan.lt> wrote:

> Patch applies for vo_xv only.

That's bad ;)
 
> I've tested in many situations, however cosmetic problems due non-clearing 
> behavior may appear (thought I haven't found such situation) otoh they should 
> be easy to fix.

> 
> [patch_x11c.diff  text/x-diff (770 bytes)]
> --- x11_common.orig	2003-08-12 23:54:12.000000000 +0300
> +++ x11_common.c	2003-08-22 12:37:00.000000000 +0300
> @@ -781,6 +781,18 @@
>   }
>   return WIN_LAYER_NORMAL;
>  }
> +//
> +void vo_x11_clearwindow( Display *mDisplay, Window vo_window )
> +{
> +   GC f_gc;
> +   f_gc = XCreateGC(mDisplay, vo_window, 0, 0);
> +   XSetForeground (mDisplay, f_gc, 0 );
> +   XFillRectangle(mDisplay, vo_window, f_gc, 0, 0, vo_screenwidth, vo_screenheight);
> +   XFreeGC(mDisplay, f_gc);

Allocating and freeing a GC al the time when an Exposure event is caught isn't
a good idea. Please allocate it on init (wasnt' there one already ?) and free it on uninit.

> +   //
> +   XClearWindow(mDisplay, vo_window);
> +   XFlush(mDisplay); 
> +}
>  
>  void vo_x11_setlayer( Display * mDisplay,Window vo_window,int layer )
>  {
> 
> 
> [patch_xv.diff  text/x-diff (3863 bytes)]
> --- vo_xv.orig	2003-07-02 00:37:20.000000000 +0300
> +++ vo_xv.c	2003-08-22 13:28:17.000000000 +0300
> @@ -81,6 +81,8 @@
>  static uint32_t image_format;
>  static int flip_flag;
>  
> +static int int_pause;
> +
>  static Window                 mRoot;
>  static uint32_t               drwX,drwY,drwBorderWidth,drwDepth;
>  static uint32_t               dwidth,dheight;
> @@ -148,6 +150,8 @@
>   
>   vo_mouse_autohide=1;
>  
> + int_pause=0;
> +
>   vo_dx=( vo_screenwidth - d_width ) / 2; vo_dy=( vo_screenheight - d_height ) / 2;
>   geometry(&vo_dx, &vo_dy, &d_width, &d_height, vo_screenwidth, vo_screenheight);
>   vo_dwidth=d_width; vo_dheight=d_height;
> @@ -218,9 +222,12 @@
>     if (depth != 15 && depth != 16 && depth != 24 && depth != 32) depth = 24;
>     XMatchVisualInfo(mDisplay, mScreen, depth, TrueColor, &vinfo);
>  
> +   xswa.backing_store = Always;
>     xswa.background_pixel = 0;
> -   xswa.border_pixel     = 0;
> -   xswamask = CWBackPixel | CWBorderPixel;
> +   xswa.border_pixel = 0;
> +   xswa.bit_gravity = StaticGravity;

Just curious, what for do you need gravitiy here?

> +   xswamask = CWBackingStore | CWBorderPixel;
> +
[...]
> @@ -424,9 +438,9 @@
>       mp_msg(MSGT_VO,MSGL_V, "[xv-fs] dx: %d dy: %d dw: %d dh: %d\n",drwX,drwY,vo_dwidth,vo_dheight );
>      }
>    }
> - if ( e & VO_EVENT_EXPOSE )
> + if ( e & VO_EVENT_EXPOSE && int_pause)
>    {
> -#ifdef HAVE_SHM
> +/*#ifdef HAVE_SHM

Oops.. this will break compile on systems that do not have shared
memory.


Otherwise i'd say the patch is ok (although i had only a quick look at it)

			Attila Kinali

-- 
Chu beyond the blackest chu, Deeper then the deepest pika, King of pikachu who 
shines like gold on the sea of electric. I call upon thee, swear myself to thee,
Let the fools who stand before me be destroyed by the power you and I possess...
PIKASLAVE!!!               -- http://bash.org/?23393



More information about the MPlayer-dev-eng mailing list