summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/video_out/video_out_vidix.c32
-rw-r--r--src/video_out/video_out_xshm.c5
-rw-r--r--src/video_out/video_out_xv.c13
-rw-r--r--src/video_out/x11osd.c108
4 files changed, 72 insertions, 86 deletions
diff --git a/src/video_out/video_out_vidix.c b/src/video_out/video_out_vidix.c
index 88f5d055f..1f7fffae8 100644
--- a/src/video_out/video_out_vidix.c
+++ b/src/video_out/video_out_vidix.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: video_out_vidix.c,v 1.61 2004/04/26 17:50:11 mroi Exp $
+ * $Id: video_out_vidix.c,v 1.62 2004/05/06 03:09:32 miguelfreitas Exp $
*
* video_out_vidix.c
*
@@ -263,17 +263,26 @@ static void vidix_clean_output_area(vidix_driver_t *this) {
if(this->visual_type == XINE_VISUAL_TYPE_X11) {
#ifdef HAVE_X11
+ int i;
+
XLockDisplay(this->display);
XSetForeground(this->display, this->gc, BlackPixel(this->display, this->screen));
- XFillRectangle(this->display, this->drawable, this->gc, this->sc.border[0].x, this->sc.border[0].y, this->sc.border[0].w, this->sc.border[0].h);
- XFillRectangle(this->display, this->drawable, this->gc, this->sc.border[1].x, this->sc.border[1].y, this->sc.border[1].w, this->sc.border[1].h);
- XFillRectangle(this->display, this->drawable, this->gc, this->sc.border[2].x, this->sc.border[2].y, this->sc.border[2].w, this->sc.border[2].h);
- XFillRectangle(this->display, this->drawable, this->gc, this->sc.border[3].x, this->sc.border[3].y, this->sc.border[3].w, this->sc.border[3].h);
-
+
+ for( i = 0; i < 4; i++ ) {
+ if( this->sc.border[i].w && this->sc.border[i].h ) {
+ XFillRectangle(this->display, this->drawable, this->gc,
+ this->sc.border[i].x, this->sc.border[i].y,
+ this->sc.border[i].w, this->sc.border[i].h);
+ }
+ }
+
XSetForeground(this->display, this->gc, this->colourkey);
XFillRectangle(this->display, this->drawable, this->gc, this->sc.output_xoffset, this->sc.output_yoffset, this->sc.output_width, this->sc.output_height);
+ if (this->xoverlay)
+ x11osd_resize (this->xoverlay, this->sc.gui_width, this->sc.gui_height);
+
XFlush(this->display);
XUnlockDisplay(this->display);
@@ -1127,8 +1136,15 @@ static vo_driver_t *vidix_open_plugin (video_driver_class_t *class_gen, const vo
query_fourccs(this);
XLockDisplay (this->display);
- this->xoverlay = x11osd_create (this->xine, this->display, this->screen,
- this->drawable, X11OSD_SHAPED);
+ if(this->colourkey) {
+ this->xoverlay = x11osd_create (this->xine, this->display, this->screen,
+ this->drawable, X11OSD_COLORKEY);
+ if(this->xoverlay)
+ x11osd_colorkey(this->xoverlay, this->colourkey, &this->sc);
+ } else {
+ this->xoverlay = x11osd_create (this->xine, this->display, this->screen,
+ this->drawable, X11OSD_SHAPED);
+ }
XUnlockDisplay (this->display);
if( this->xoverlay )
diff --git a/src/video_out/video_out_xshm.c b/src/video_out/video_out_xshm.c
index 51df7dfa2..62dc26032 100644
--- a/src/video_out/video_out_xshm.c
+++ b/src/video_out/video_out_xshm.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: video_out_xshm.c,v 1.130 2004/04/26 17:50:11 mroi Exp $
+ * $Id: video_out_xshm.c,v 1.131 2004/05/06 03:09:32 miguelfreitas Exp $
*
* video_out_xshm.c, X11 shared memory extension interface for xine
*
@@ -683,6 +683,9 @@ static void clean_output_area (xshm_driver_t *this, xshm_frame_t *frame) {
this->sc.border[i].x, this->sc.border[i].y,
this->sc.border[i].w, this->sc.border[i].h);
}
+ if (this->xoverlay)
+ x11osd_resize (this->xoverlay, this->sc.gui_width, this->sc.gui_height);
+
XUnlockDisplay (this->display);
}
diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c
index 69343972b..c12c1e01e 100644
--- a/src/video_out/video_out_xv.c
+++ b/src/video_out/video_out_xv.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: video_out_xv.c,v 1.197 2004/04/26 17:50:11 mroi Exp $
+ * $Id: video_out_xv.c,v 1.198 2004/05/06 03:09:32 miguelfreitas Exp $
*
* video_out_xv.c, X11 video extension interface for xine
*
@@ -586,6 +586,10 @@ static void xv_clean_output_area (xv_driver_t *this) {
this->sc.output_xoffset, this->sc.output_yoffset,
this->sc.output_width, this->sc.output_height);
}
+
+ if (this->xoverlay)
+ x11osd_resize (this->xoverlay, this->sc.gui_width, this->sc.gui_height);
+
XUnlockDisplay (this->display);
}
@@ -1077,7 +1081,12 @@ static void xv_check_capability (xv_driver_t *this,
xprintf(this->xine, XINE_VERBOSITY_DEBUG,
"video_out_xv: port attribute %s (%d) value is %d\n", str_prop, property, int_default);
-
+
+ /* disable autopaint colorkey by default */
+ /* might be overridden using config entry */
+ if(strcmp(str_prop, "XV_AUTOPAINT_COLORKEY") == 0)
+ int_default = 0;
+
if (config_name) {
/* is this a boolean property ? */
if ((attr.min_value == 0) && (attr.max_value == 1)) {
diff --git a/src/video_out/x11osd.c b/src/video_out/x11osd.c
index 1385b1a36..7524a4c1a 100644
--- a/src/video_out/x11osd.c
+++ b/src/video_out/x11osd.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: x11osd.c,v 1.8 2004/04/10 15:31:10 miguelfreitas Exp $
+ * $Id: x11osd.c,v 1.9 2004/05/06 03:09:32 miguelfreitas Exp $
*
* x11osd.c, use X11 Nonrectangular Window Shape Extension to draw xine OSD
*
@@ -66,9 +66,7 @@ struct x11osd
} shaped;
struct {
uint32_t colorkey;
- vo_scale_t *scaling;
- int bordercount;
- XRectangle borders[4];
+ vo_scale_t *sc;
} colorkey;
} u;
Window window;
@@ -87,55 +85,6 @@ struct x11osd
xine_t *xine;
};
-static void x11osd_colorkey_compute_borders(x11osd *osd)
-{
- assert (osd);
- assert (osd->mode==X11OSD_COLORKEY);
-
- if(osd->u.colorkey.scaling) {
- XRectangle *r=osd->u.colorkey.borders;
- vo_scale_t *scaling=osd->u.colorkey.scaling;
- int tmp, count=0;
-
- if(scaling->output_yoffset>0) {
- r->x=r->y=0;
- r->width=osd->width;
- r->height=scaling->output_yoffset;
- r++;
- count++;
- }
- tmp=osd->height-scaling->output_yoffset-scaling->output_height;
- if(tmp>0) {
- r->x=0;
- r->width=osd->width;
- r->y=osd->height-tmp;
- r->height=tmp;
- r++;
- count++;
- }
- if(scaling->output_xoffset>0) {
- r->x=0;
- r->y=scaling->output_yoffset;
- r->width=scaling->output_xoffset;
- r->height=scaling->output_height;
- r++;
- count++;
- }
- tmp=osd->width-scaling->output_xoffset-scaling->output_width;
- if(tmp>0) {
- r->x=osd->width-tmp;
- r->y=scaling->output_yoffset;
- r->width=tmp;
- r->height=scaling->output_height;
- r++;
- count++;
- }
- osd->u.colorkey.bordercount=count;
- }
- else
- osd->u.colorkey.bordercount=0;
-}
-
void
x11osd_expose (x11osd * osd)
@@ -186,8 +135,6 @@ x11osd_resize (x11osd * osd, int width, int height)
osd->u.shaped.mask_bitmap =
XCreatePixmap (osd->display, osd->u.shaped.window, osd->width, osd->height,
1);
- XFillRectangle (osd->display, osd->u.shaped.mask_bitmap, osd->u.shaped.mask_gc_back,
- 0, 0, osd->width, osd->height);
osd->bitmap =
XCreatePixmap (osd->display, osd->u.shaped.window,
osd->width, osd->height, osd->depth);
@@ -198,12 +145,14 @@ x11osd_resize (x11osd * osd, int width, int height)
osd->width, osd->height, osd->depth);
break;
}
+ x11osd_clear(osd);
}
void
x11osd_drawable_changed (x11osd * osd, Window window)
{
XSetWindowAttributes attr;
+ XWindowAttributes getattr;
assert (osd);
@@ -223,6 +172,10 @@ x11osd_drawable_changed (x11osd * osd, Window window)
osd->window = window;
+ XGetWindowAttributes (osd->display, osd->window, &getattr);
+ osd->width = getattr.width;
+ osd->height = getattr.height;
+
switch(osd->mode) {
case X11OSD_SHAPED:
XFreePixmap (osd->display, osd->u.shaped.mask_bitmap);
@@ -240,8 +193,6 @@ x11osd_drawable_changed (x11osd * osd, Window window)
osd->u.shaped.mask_bitmap = XCreatePixmap (osd->display, osd->u.shaped.window,
osd->width, osd->height, 1);
- XFillRectangle (osd->display, osd->u.shaped.mask_bitmap, osd->u.shaped.mask_gc_back,
- 0, 0, osd->width, osd->height);
osd->bitmap = XCreatePixmap (osd->display, osd->u.shaped.window, osd->width,
osd->height, osd->depth);
@@ -252,7 +203,6 @@ x11osd_drawable_changed (x11osd * osd, Window window)
case X11OSD_COLORKEY:
osd->bitmap = XCreatePixmap (osd->display, osd->window, osd->width,
osd->height, osd->depth);
- /*x11osd_colorkey_compute_borders(osd);*/
osd->cmap = XCreateColormap(osd->display, osd->window,
osd->visual, AllocNone);
@@ -260,6 +210,7 @@ x11osd_drawable_changed (x11osd * osd, Window window)
}
osd->clean = UNDEFINED;
+ x11osd_clear(osd);
x11osd_expose(osd);
}
@@ -278,6 +229,7 @@ x11osd_create (xine_t *xine, Display *display, int screen, Window window, enum x
int event_basep, error_basep;
XErrorHandler old_handler = NULL;
XSetWindowAttributes attr;
+ XWindowAttributes getattr;
osd = xine_xmalloc (sizeof (x11osd));
if (!osd)
@@ -294,8 +246,10 @@ x11osd_create (xine_t *xine, Display *display, int screen, Window window, enum x
osd->visual = DefaultVisual (osd->display, osd->screen);
osd->depth = DefaultDepth (osd->display, osd->screen);
- osd->width = XDisplayWidth (osd->display, osd->screen);
- osd->height = XDisplayHeight (osd->display, osd->screen);
+
+ XGetWindowAttributes (osd->display, osd->window, &getattr);
+ osd->width = getattr.width;
+ osd->height = getattr.height;
switch (mode) {
case X11OSD_SHAPED:
@@ -350,7 +304,6 @@ x11osd_create (xine_t *xine, Display *display, int screen, Window window, enum x
case X11OSD_COLORKEY:
osd->bitmap = XCreatePixmap (osd->display, osd->window, osd->width,
osd->height, osd->depth);
- /*x11osd_colorkey_compute_borders(osd); done in x11osd_colorkey */
osd->gc = XCreateGC (osd->display, osd->window, 0, NULL);
osd->cmap = XCreateColormap(osd->display, osd->window,
osd->visual, AllocNone);
@@ -400,16 +353,15 @@ error2:
return NULL;
}
-void x11osd_colorkey(x11osd * osd, uint32_t colorkey, vo_scale_t *scaling)
+void x11osd_colorkey(x11osd * osd, uint32_t colorkey, vo_scale_t *sc)
{
assert (osd);
assert (osd->mode==X11OSD_COLORKEY);
osd->u.colorkey.colorkey=colorkey;
- osd->u.colorkey.scaling=scaling;
- /*x11osd_colorkey_compute_borders(osd);
- x11osd_clear(osd); Workaround: we clear on the first blend instead.
- x11osd_expose(osd);*/
+ osd->u.colorkey.sc=sc;
+ x11osd_clear(osd);
+ x11osd_expose(osd);
}
void
@@ -433,6 +385,8 @@ x11osd_destroy (x11osd * osd)
void x11osd_clear(x11osd *osd)
{
+ int i;
+
if( osd->clean!=WIPED )
switch (osd->mode) {
case X11OSD_SHAPED:
@@ -441,16 +395,20 @@ void x11osd_clear(x11osd *osd)
break;
case X11OSD_COLORKEY:
XSetForeground(osd->display, osd->gc, osd->u.colorkey.colorkey);
- if(osd->u.colorkey.scaling) {
- x11osd_colorkey_compute_borders(osd);
+ if(osd->u.colorkey.sc) {
XFillRectangle (osd->display, osd->bitmap, osd->gc,
- osd->u.colorkey.scaling->output_xoffset,
- osd->u.colorkey.scaling->output_yoffset,
- osd->u.colorkey.scaling->output_width,
- osd->u.colorkey.scaling->output_height);
+ osd->u.colorkey.sc->output_xoffset,
+ osd->u.colorkey.sc->output_yoffset,
+ osd->u.colorkey.sc->output_width,
+ osd->u.colorkey.sc->output_height);
XSetForeground(osd->display, osd->gc, BlackPixel(osd->display, osd->screen));
- XFillRectangles (osd->display, osd->bitmap, osd->gc,
- osd->u.colorkey.borders, osd->u.colorkey.bordercount);
+ for( i = 0; i < 4; i++ ) {
+ if( osd->u.colorkey.sc->border[i].w && osd->u.colorkey.sc->border[i].h ) {
+ XFillRectangle(osd->display, osd->bitmap, osd->gc,
+ osd->u.colorkey.sc->border[i].x, osd->u.colorkey.sc->border[i].y,
+ osd->u.colorkey.sc->border[i].w, osd->u.colorkey.sc->border[i].h);
+ }
+ }
} else
XFillRectangle (osd->display, osd->bitmap, osd->gc, 0, 0, osd->width, osd->height);
break;
@@ -465,7 +423,7 @@ void x11osd_clear(x11osd *osd)
void x11osd_blend(x11osd *osd, vo_overlay_t *overlay)
{
if (osd->clean==UNDEFINED)
- x11osd_clear(osd); /* Workaround. Colorkey mode needs scaling data before the clear. */
+ x11osd_clear(osd); /* Workaround. Colorkey mode needs sc data before the clear. */
if (overlay->rle) {
int i, x, y, len, width;
int use_clip_palette, max_palette_colour[2];