summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authoralbeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-06-26 13:21:59 +0000
committeralbeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-06-26 13:21:59 +0000
commit329c07dcb261322bd4db041d1ef2765e56c458de (patch)
tree6d7692ceabcd89e8a2cb56fb56c4a6ad784e40cb /drivers
parent17d2c8e424d4c8246fade893220506ead46e375b (diff)
downloadmpv-329c07dcb261322bd4db041d1ef2765e56c458de.tar.bz2
mpv-329c07dcb261322bd4db041d1ef2765e56c458de.tar.xz
Allow negative x,y for the overlay.
Fix the window size git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10340 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'drivers')
-rw-r--r--drivers/tdfx_vid.c36
1 files changed, 29 insertions, 7 deletions
diff --git a/drivers/tdfx_vid.c b/drivers/tdfx_vid.c
index 27bee9afc7..793b2272d9 100644
--- a/drivers/tdfx_vid.c
+++ b/drivers/tdfx_vid.c
@@ -529,9 +529,31 @@ static int tdfx_vid_set_overlay(unsigned long arg) {
return(-EFAULT);
}
- if(ov.dst_x < 0 || ov.dst_y < 0) {
- printk(KERN_DEBUG "tdfx_vid: Negative x/y not yet supported\n");
- return(-EFAULT);
+ if(ov.dst_y < 0) {
+ int shift;
+ if(-ov.dst_y >= ov.src_height) {
+ printk(KERN_DEBUG "tdfx_vid: Overlay outside of the screen ????\n");
+ return(-EFAULT);
+ }
+ shift = (-ov.dst_y)/(double)ov.dst_height*ov.src_height;
+ ov.src[0] += shift*ov.src_stride;
+ ov.src_height -= shift;
+ ov.dst_height += ov.dst_y;
+ ov.dst_y = 0;
+ }
+
+ if(ov.dst_x < 0) {
+ int shift;
+ if(-ov.dst_x >= ov.src_width) {
+ printk(KERN_DEBUG "tdfx_vid: Overlay outside of the screen ????\n");
+ return(-EFAULT);
+ }
+ shift = (-ov.dst_x)/(double)ov.dst_width*ov.src_width;
+ shift = ((shift+3)/2)*2;
+ ov.src[0] += shift*2;
+ ov.src_width -= shift;
+ ov.dst_width += ov.dst_x;
+ ov.dst_x = 0;
}
vidcfg = tdfx_inl(VIDPROCCFG);
@@ -574,9 +596,9 @@ static int tdfx_vid_set_overlay(unsigned long arg) {
screen_w = tdfx_inl(VIDSCREENSIZE);
screen_h = (screen_w >> 12) & 0xFFF;
screen_w &= 0xFFF;
- disp_w = ov.dst_x + ov.dst_width > screen_w ?
+ disp_w = ov.dst_x + ov.dst_width >= screen_w ?
screen_w - ov.dst_x : ov.dst_width;
- disp_h = ov.dst_y + ov.dst_height > screen_h ?
+ disp_h = ov.dst_y + ov.dst_height >= screen_h ?
screen_h - ov.dst_y : ov.dst_height;
if(ov.dst_x >= screen_w || ov.dst_y >= screen_h ||
@@ -621,8 +643,8 @@ static int tdfx_vid_set_overlay(unsigned long arg) {
//printk(KERN_DEBUG "tdfx_vid: start %dx%d\n",ov.dst_x & 0xFFF,ov.dst_y & 0xFFF);
tdfx_outl(VIDOVRSTARTCRD,(ov.dst_x & 0xFFF)|((ov.dst_y & 0xFFF)<<12));
// End coord
- tdfx_outl(VIDOVRENDCRD, ((ov.dst_x + disp_w) & 0xFFF)|
- (((ov.dst_y + disp_h) & 0xFFF)<<12));
+ tdfx_outl(VIDOVRENDCRD, ((ov.dst_x + disp_w-1) & 0xFFF)|
+ (((ov.dst_y + disp_h-1) & 0xFFF)<<12));
// H Scaling
tdfx_outl(VIDOVRDUDX,( ((u32)ov.src_width) << 20) / ov.dst_width);
// Src offset and width (in bytes)