[MPlayer-cygwin] [PATCH] directx overlay centering when using -wip

Gianluigi Tiesi mplayer at netfarm.it
Wed Feb 9 04:51:50 CET 2005


Overlay is not centered when using -wip.
This patches solves it, please test it if there are some side effects.
Sasha no windows yet?
btw I've updated a bit avisynth demuxer patch,
new version at:
http://oss.netfarm.it/mplayer/patches/libmpdemux_avs.diff

Regards

-- 
Gianluigi Tiesi <sherpya at netfarm.it>
EDP Project Leader
Netfarm S.r.l. - http://www.netfarm.it/
Free Software: http://oss.netfarm.it/
-------------- next part --------------
diff -NubBr -xCVS -xhelp_mp.h -x'*.a' -x'*.exe' -x'*.o' -xconfigure.log -xconfig.mak -x.cvsignore -xconfig.h -xcodecs.conf.h -xversion.h -x.depend main/libvo/vo_directx.c sherpya/libvo/vo_directx.c
--- main/libvo/vo_directx.c	2005-01-08 11:06:38.212283200 +0100
+++ sherpya/libvo/vo_directx.c	2005-02-09 04:19:09.880352000 +0100
@@ -516,6 +516,7 @@
     DDOVERLAYFX     ovfx;
     DWORD           dwUpdateFlags=0;
     int width,height;
+    int cw, ch;
    
     if(vo_fs || vidmode){
       aspect(&width,&height,A_ZOOM);
@@ -540,8 +541,8 @@
       pt.y = 0;
       ClientToScreen(hWnd,&pt);  
       GetClientRect(hWnd, &rd);
-	  width=rd.right - rd.left;
-	  height=rd.bottom - rd.top;
+	  width=cw=rd.right - rd.left;
+	  height=ch=rd.bottom - rd.top;
       pt.x -= monitor_rect.left;    /* move coordinates from global to local monitor space */
       pt.y -= monitor_rect.top;
       rd.right -= monitor_rect.left;
@@ -567,6 +569,20 @@
     rd.right=rd.left+width;
     rd.bottom=rd.top+height;
 
+    /* Centering overlay image */
+    if(!vidmode && !vo_fs)
+    {
+        cw=(cw-width)/2;
+        cw+=cw%2;
+        ch=(ch-height)/2;
+        ch+=ch%2;
+    
+        rd.left+=cw;
+        rd.right+=cw;
+        rd.top+=ch;
+        rd.bottom+=ch;
+    }
+
 	/*ok, let's workaround some overlay limitations*/
 	if(!nooverlay)
 	{


More information about the MPlayer-cygwin mailing list