00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef MMSFBLAYER_H_
00034 #define MMSFBLAYER_H_
00035
00036 #include "mmstools/mmslogger.h"
00037 #include "mmsgui/fb/mmsfbbase.h"
00038 #include "mmsgui/fb/mmsfbsurface.h"
00039 #include "mmsgui/fb/mmsfbwindow.h"
00040
00041 #ifdef __HAVE_XLIB__
00042 #include <X11/extensions/Xrender.h>
00043 #include <X11/extensions/Xcomposite.h>
00044
00045 typedef struct {
00046 Display *x_display;
00047 Window x_window;
00048 GC x_gc;
00049 int xv_port;
00050 #ifdef __HAVE_XV__
00051 XvImage *xv_image1;
00052 XvImage *xv_image2;
00053 #endif
00054 int w;
00055 int h;
00056 int x_screen;
00057 } X11_IMPL;
00058 #endif
00059
00060
00061 typedef struct {
00062
00063 bool avail;
00064
00065 int id;
00066
00067 MMSFBBackend backend;
00068
00069 MMSFBOutputType outputtype;
00070
00071 int w;
00072
00073 int h;
00074
00075 MMSFBSurfacePixelFormat pixelformat;
00076
00077 string buffermode;
00078
00079 string options;
00080
00081 MMSFBSurfacePixelFormat window_pixelformat;
00082
00083 MMSFBSurfacePixelFormat surface_pixelformat;
00084 } MMSFBLayerConfig;
00085
00086
00087
00088
00089
00090 class MMSFBLayer {
00091 private:
00092
00093 bool initialized;
00094
00095 #ifdef __HAVE_DIRECTFB__
00096
00097 IDirectFBDisplayLayer *dfblayer;
00098 #endif
00099
00100 #if defined(__HAVE_FBDEV__) || defined(__HAVE_KMS__)
00101 MMSFBSurface *mmsfbdev_surface;
00102 #endif
00103
00104 #ifdef __HAVE_XLIB__
00105 XImage *x_image1;
00106 XShmSegmentInfo x_shminfo1;
00107 XImage *x_image2;
00108 XShmSegmentInfo x_shminfo2;
00109 XImage *x_image_scaler;
00110 XShmSegmentInfo x_shminfo_scaler;
00111 MMSFBSurface *scaler;
00112 Visual *x_visual;
00113 Window x_window;
00114 Pixmap pixmap;
00115 XRenderPictFormat *pict_format;
00116 Picture x_pixmap_pict;
00117 Picture x_window_pict;
00118 GC x_gc;
00119 int x_window_h;
00120 int x_window_w;
00121 X11_IMPL impl;
00122
00123 #endif
00124 #ifdef __HAVE_XV__
00125 XvImage *xv_image1;
00126 XShmSegmentInfo xv_shminfo1;
00127 XvImage *xv_image2;
00128 XShmSegmentInfo xv_shminfo2;
00129 #endif
00130
00131
00132 MMSFBLayerConfig config;
00133
00134
00135 MMSFBSurface *surface;
00136
00137
00138 MMSFBFlipFlags flipflags;
00139
00140
00141 static bool firsttime_createsurface;
00142
00143
00144 static bool firsttime_createwindow_usealpha;
00145 static bool firsttime_createwindow_noalpha;
00146
00147 public:
00148 MMSFBLayer(int id, MMSFBBackend backend, MMSFBOutputType outputtype);
00149 virtual ~MMSFBLayer();
00150
00151 bool isInitialized();
00152
00153 bool getID(int *id);
00154 bool setExclusiveAccess();
00155 bool getConfiguration(MMSFBLayerConfig *config = NULL);
00156 bool getResolution(int *w, int *h);
00157 bool getPixelFormat(MMSFBSurfacePixelFormat *pixelformat);
00158 bool setConfiguration(int w=0, int h=0, MMSFBSurfacePixelFormat pixelformat=MMSFB_PF_NONE, string buffermode="", string options="",
00159 MMSFBSurfacePixelFormat window_pixelformat=MMSFB_PF_NONE, MMSFBSurfacePixelFormat surface_pixelformat=MMSFB_PF_NONE);
00160 bool setOpacity(unsigned char opacity);
00161 bool setLevel(int level);
00162 bool getSurface(MMSFBSurface **surface, bool clear = false);
00163
00164 bool setFlipFlags(MMSFBFlipFlags flags);
00165
00166 bool releaseLayer();
00167 bool restoreLayer();
00168
00169 bool createSurface(MMSFBSurface **surface, int w, int h,
00170 MMSFBSurfacePixelFormat pixelformat = MMSFB_PF_NONE, int backbuffer = 0);
00171 bool createWindow(MMSFBWindow **window, int x, int y, int w, int h,
00172 MMSFBSurfacePixelFormat pixelformat = MMSFB_PF_NONE,
00173 bool usealpha = true, int backbuffer = 1);
00174
00175 void *getImplementation();
00176
00177 friend class MMSFBManager;
00178 friend class MMSFBSurface;
00179 };
00180
00181 #endif