This time I have something constructive :)
A patch that does what I mentioned before:
- Adds a function SetPixelFormat
- Adds two new fields to DFBWindowDescriptionFlags:
- DWDESC_SURFACE_CAPS (dsc.scaps)
- DWDESC_PIXELFORMAT (dsc.format)
These are passed on to surface_create
I've tested the pixelformat stuff.
haven't tested SURFACE_CAPS but it should work.
Modify/apply it as you please.
On a side note:
Might be a good idea to add:
"(sleep 5;raw16toraw24 < /dev/fb | rawtoppm 800 600 | pnmtopng > screenshot.png) &
df_window"
as an EASY way to make a screenshot ;)
I've sortof abondoned my Xine provider again... going for the mplayer
provider again (!;) I've gotten it to work once again, problem is to
play several videos at once. If anyone is interested in the code mail
me :)
Also if anyone is interested in the Xine provider mail me. it's pretty
much works as it should but has some (nasty) hacks to make it work with the Xine
API, and it's not very clean. I guess maybe it could go into DirectFB-extra
(the xine video out driver could go there too) since it works and plays formats
that can't be played with DirectFB today... it's up to you guys.
Regards Hallvar Helleseth
Index: include/directfb.h
===================================================================
RCS file: /cvs/directfb/DirectFB/include/directfb.h,v
retrieving revision 1.66
diff -c -u -r1.66 directfb.h
--- include/directfb.h 2 Jan 2002 00:38:35 -0000 1.66
+++ include/directfb.h 8 Jan 2002 20:54:33 -0000
@@ -497,7 +497,9 @@
DWDESC_WIDTH = 0x00000002, /* width field is valid */
DWDESC_HEIGHT = 0x00000004, /* height field is valid */
DWDESC_POSX = 0x00000008, /* posx field is valid */
- DWDESC_POSY = 0x00000010 /* posy field is valid */
+ DWDESC_POSY = 0x00000010, /* posy field is valid */
+ DWDESC_PIXELFORMAT = 0x00000020, /* pixelformat field is valid */
+ DWDESC_SURFACE_CAPS = 0x00000040 /* surface_caps field is valid */
} DFBWindowDescriptionFlags;
/*
@@ -506,7 +508,7 @@
typedef enum {
DWCAPS_ALPHACHANNEL = 0x00000001, /* The window has an alphachannel
for pixel-per-pixel blending. */
- DWCAPS_DOUBLEBUFFER = 0x00000002 /* The window's surface is double
+ DWCAPS_DOUBLEBUFFER = 0x00000002, /* The window's surface is double
buffered. This is very useful
to avoid visibility of content
that is still in preparation.
@@ -647,6 +649,10 @@
layer border */
int posy; /* distance from upper
layer border */
+ DFBSurfaceCapabilities scaps; /* surface
+
+ capabilities */
+ DFBSurfacePixelFormat format; /*
+surface
+
+ pixelformat */
} DFBWindowDescription;
/*
@@ -1434,6 +1440,14 @@
/** Drawing/blitting control **/
+
+ /*
+ * Set the pixel format used on the surface
+ */
+ DFBResult (*SetPixelFormat) (
+ IDirectFBSurface *thiz,
+ DFBSurfacePixelFormat format
+ );
/*
* Set the clipping rectangle used to limitate the area
Index: src/idirectfb.c
===================================================================
RCS file: /cvs/directfb/DirectFB/src/idirectfb.c,v
retrieving revision 1.41
diff -c -u -r1.41 idirectfb.c
--- src/idirectfb.c 7 Jan 2002 17:31:19 -0000 1.41
+++ src/idirectfb.c 8 Jan 2002 20:54:34 -0000
@@ -327,7 +327,7 @@
x, y,
data->primary.width,
data->primary.height,
- DWCAPS_ALPHACHANNEL |
DWCAPS_DOUBLEBUFFER );
+ DWCAPS_ALPHACHANNEL |
+DWCAPS_DOUBLEBUFFER, caps, format );
}
else
window = window_create( layers->shared->windowstack,
@@ -335,7 +335,7 @@
data->primary.width,
data->primary.height,
(caps & DSCAPS_FLIPPING) ?
- DWCAPS_DOUBLEBUFFER : 0 );
+ DWCAPS_DOUBLEBUFFER : 0, caps,
+format );
window_init( window );
Index: src/interface.c
===================================================================
RCS file: /cvs/directfb/DirectFB/src/interface.c,v
retrieving revision 1.11
diff -c -u -r1.11 interface.c
--- src/interface.c 26 Nov 2001 12:13:56 -0000 1.11
+++ src/interface.c 8 Jan 2002 20:54:34 -0000
@@ -114,7 +114,7 @@
continue;
}
- handle = dlopen( buf, RTLD_LAZY );
+ handle = dlopen( buf, RTLD_LAZY | RTLD_GLOBAL);
if (handle) {
char *(*get)() = NULL;
Index: src/core/layers.c
===================================================================
RCS file: /cvs/directfb/DirectFB/src/core/layers.c,v
retrieving revision 1.13
diff -c -u -r1.13 layers.c
--- src/core/layers.c 7 Jan 2002 17:31:20 -0000 1.13
+++ src/core/layers.c 8 Jan 2002 20:54:35 -0000
@@ -455,7 +455,7 @@
/* create a super-top-most_event-and-focus-less window */
cursor = window_create( layer->shared->windowstack,
layer->shared->windowstack->cx,
layer->shared->windowstack->cy, width, height,
- DWHC_GHOST | DWCAPS_ALPHACHANNEL );
+ DWHC_GHOST | DWCAPS_ALPHACHANNEL, 0, DSPF_ARGB );
if (!cursor) {
ERRORMSG( "DirectFB/core/layers: "
"failed creating a window for software cursor!\n" );
Index: src/core/windows.c
===================================================================
RCS file: /cvs/directfb/DirectFB/src/core/windows.c,v
retrieving revision 1.39
diff -c -u -r1.39 windows.c
--- src/core/windows.c 17 Dec 2001 10:57:38 -0000 1.39
+++ src/core/windows.c 8 Jan 2002 20:54:35 -0000
@@ -258,7 +258,8 @@
CoreWindow* window_create( CoreWindowStack *stack, int x, int y,
unsigned int width, unsigned int height,
- unsigned int caps )
+ unsigned int caps, unsigned int scaps,
+ DFBSurfacePixelFormat format )
{
DFBResult ret;
int surface_policy;
@@ -279,18 +280,28 @@
window->stack = stack;
if (caps & DWCAPS_ALPHACHANNEL) {
+ if((format == DSPF_ARGB) || (!format))
+ {
surface_policy = stack->wsp_alpha;
surface_format = DSPF_ARGB;
- }
- else {
+ /* As long as ARGB is the only pixelformat having an alphachannel */
+ } else {
+ BUG("can't have an alphachannel with this pixelformat");
+ }
+ } else if (format) {
+ surface_policy = stack->wsp_opaque;
+ surface_format = format;
+ } else {
surface_policy = stack->wsp_opaque;
surface_format = stack->layer->surface->format;
}
if (caps & DWCAPS_DOUBLEBUFFER)
- surface_caps = DSCAPS_FLIPPING;
- else
- surface_caps = DSCAPS_NONE;
+ surface_caps = DSCAPS_FLIPPING | scaps;
+ else if (scaps)
+ surface_caps = scaps;
+ else
+ surface_caps = DSCAPS_NONE;
ret = surface_create( width, height, surface_format, surface_policy,
surface_caps, &window->surface );
Index: src/core/windows.h
===================================================================
RCS file: /cvs/directfb/DirectFB/src/core/windows.h,v
retrieving revision 1.11
diff -c -u -r1.11 windows.h
--- src/core/windows.h 20 Nov 2001 12:59:37 -0000 1.11
+++ src/core/windows.h 8 Jan 2002 20:54:36 -0000
@@ -125,7 +125,8 @@
*/
CoreWindow* window_create( CoreWindowStack *stack, int x, int y,
unsigned int width, unsigned int height,
- unsigned int caps );
+ unsigned int caps, unsigned int scaps,
+ DFBSurfacePixelFormat format);
/*
* must be called after window_create
Index: src/display/idirectfbdisplaylayer.c
===================================================================
RCS file: /cvs/directfb/DirectFB/src/display/idirectfbdisplaylayer.c,v
retrieving revision 1.19
diff -c -u -r1.19 idirectfbdisplaylayer.c
--- src/display/idirectfbdisplaylayer.c 20 Nov 2001 12:59:37 -0000 1.19
+++ src/display/idirectfbdisplaylayer.c 8 Jan 2002 20:54:36 -0000
@@ -337,6 +337,8 @@
int posx = 0;
int posy = 0;
DFBWindowCapabilities caps = 0;
+ DFBSurfaceCapabilities scaps = 0;
+ DFBSurfacePixelFormat format = 0;
INTERFACE_GET_DATA(IDirectFBDisplayLayer)
@@ -351,12 +353,16 @@
posy = desc->posy;
if (desc->flags & DWDESC_CAPS)
caps = desc->caps;
+ if (desc->flags & DWDESC_SURFACE_CAPS)
+ scaps = desc->scaps;
+ if (desc->flags & DWDESC_PIXELFORMAT)
+ format = desc->format;
if (!width || width > 4096 || !height || height > 4096)
return DFB_INVARG;
w = window_create( data->layer->shared->windowstack,
- posx, posy, width, height, caps );
+ posx, posy, width, height, caps, scaps, format );
if (!w)
return DFB_FAILURE;
Index: src/display/idirectfbsurface.c
===================================================================
RCS file: /cvs/directfb/DirectFB/src/display/idirectfbsurface.c,v
retrieving revision 1.32
diff -c -u -r1.32 idirectfbsurface.c
--- src/display/idirectfbsurface.c 6 Dec 2001 16:07:49 -0000 1.32
+++ src/display/idirectfbsurface.c 8 Jan 2002 20:54:37 -0000
@@ -121,6 +121,23 @@
return DFB_OK;
}
+DFBResult IDirectFBSurface_SetPixelFormat( IDirectFBSurface *thiz,
+
+DFBSurfacePixelFormat format )
+{
+ INTERFACE_GET_DATA(IDirectFBSurface)
+
+ if (!data->surface)
+ return DFB_DESTROYED;
+
+ if (!format)
+ return DFB_INVARG;
+
+ surface_reformat( data->surface, data->surface->width,
+ data->surface->height, format );
+
+ return DFB_OK;
+}
+
DFBResult IDirectFBSurface_GetAccelerationMask( IDirectFBSurface *thiz,
IDirectFBSurface *source,
DFBAccelerationMask *mask )
@@ -1092,6 +1109,7 @@
thiz->Unlock = IDirectFBSurface_Unlock;
thiz->Flip = IDirectFBSurface_Flip;
+ thiz->SetPixelFormat = IDirectFBSurface_SetPixelFormat;
thiz->SetClip = IDirectFBSurface_SetClip;
thiz->SetColor = IDirectFBSurface_SetColor;
thiz->SetSrcBlendFunction = IDirectFBSurface_SetSrcBlendFunction;