zenilib: zenilib/jni/external/sdl/src/video/directfb/SDL_DirectFB_video.h Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SDL_DirectFB_video.h
Go to the documentation of this file.
1 /*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20 */
21
22 #include "SDL_config.h"
23
24 #ifndef _SDL_DirectFB_video_h
25 #define _SDL_DirectFB_video_h
26
27 #include <directfb.h>
28 #include <directfb_version.h>
29
30 #include "../SDL_sysvideo.h"
31 #include "SDL_scancode.h"
32 #include "SDL_render.h"
33
34 #include "SDL_log.h"
35
36 #define DFB_VERSIONNUM(X, Y, Z) \
37 ((X)*1000 + (Y)*100 + (Z))
38
39 #define DFB_COMPILEDVERSION \
40 DFB_VERSIONNUM(DIRECTFB_MAJOR_VERSION, DIRECTFB_MINOR_VERSION, DIRECTFB_MICRO_VERSION)
41
42 #define DFB_VERSION_ATLEAST(X, Y, Z) \
43 (DFB_COMPILEDVERSION >= DFB_VERSIONNUM(X, Y, Z))
44
45 #if (DFB_VERSION_ATLEAST(1,0,0))
46 #ifdef SDL_VIDEO_OPENGL
47 #define SDL_DIRECTFB_OPENGL 1
48 #endif
49 #else
50 #error "SDL_DIRECTFB: Please compile against libdirectfb version >= 1.0.0"
51 #endif
52
53 /* Set below to 1 to compile with (old) multi mice/keyboard api. Code left in
54 * in case we see this again ...
55 */
56
57 #define USE_MULTI_API (0)
58
59 /* Support for LUT8/INDEX8 pixel format.
60 * This is broken in DirectFB 1.4.3. It works in 1.4.0 and 1.4.5
61 * occurred.
62 */
63
64 #if (DFB_COMPILEDVERSION == DFB_VERSIONNUM(1, 4, 3))
65 #define ENABLE_LUT8 (0)
66 #else
67 #define ENABLE_LUT8 (1)
68 #endif
69
70 #define DIRECTFB_DEBUG 1
71
72 #define DFBENV_USE_YUV_UNDERLAY "SDL_DIRECTFB_YUV_UNDERLAY" /* Default: off */
73 #define DFBENV_USE_YUV_DIRECT "SDL_DIRECTFB_YUV_DIRECT" /* Default: off */
74 #define DFBENV_USE_X11_CHECK "SDL_DIRECTFB_X11_CHECK" /* Default: on */
75 #define DFBENV_USE_LINUX_INPUT "SDL_DIRECTFB_LINUX_INPUT" /* Default: on */
76 #define DFBENV_USE_WM "SDL_DIRECTFB_WM" /* Default: off */
77
78 #define SDL_DFB_RELEASE(x) do { if ( (x) != NULL ) { SDL_DFB_CHECK(x->Release(x)); x = NULL; } } while (0)
79 #define SDL_DFB_FREE(x) do { SDL_free((x)); (x) = NULL; } while (0)
80 #define SDL_DFB_UNLOCK(x) do { if ( (x) != NULL ) { x->Unlock(x); } } while (0)
81
82 #define SDL_DFB_CONTEXT "SDL_DirectFB"
83
84 #define SDL_DFB_ERR(x...) SDL_LogError(SDL_LOG_CATEGORY_ERROR, x)
85
86 #if (DIRECTFB_DEBUG)
87 #define SDL_DFB_LOG(x...) SDL_LogInfo(SDL_LOG_CATEGORY_VIDEO, x)
88
89 #define SDL_DFB_DEBUG(x...) SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, x)
90
91 static inline DFBResult sdl_dfb_check(DFBResult ret, const char *src_file, int src_line) {
92 if (ret != DFB_OK) {
93 SDL_DFB_LOG("%s (%d):%s", src_file, src_line, DirectFBErrorString (ret) );
94 SDL_SetError("%s:%s", SDL_DFB_CONTEXT, DirectFBErrorString (ret) );
95 }
96 return ret;
97 }
98
99 #define SDL_DFB_CHECK(x...) do { sdl_dfb_check( x, __FILE__, __LINE__); } while (0)
100 #define SDL_DFB_CHECKERR(x...) do { if ( sdl_dfb_check( x, __FILE__, __LINE__) != DFB_OK ) goto error; } while (0)
101
102 #else
103
104 #define SDL_DFB_CHECK(x...) x
105 #define SDL_DFB_CHECKERR(x...) do { if (x != DFB_OK ) goto error; } while (0)
106 #define SDL_DFB_LOG(x...) do {} while (0)
107 #define SDL_DFB_DEBUG(x...) do {} while (0)
108
109 #endif
110
111
112 #define SDL_DFB_CALLOC(r, n, s) \
113 do { \
114 r = SDL_calloc (n, s); \
115 if (!(r)) { \
116 SDL_DFB_ERR("Out of memory"); \
117 SDL_OutOfMemory(); \
118 goto error; \
119 } \
120 } while (0)
121
122 #define SDL_DFB_ALLOC_CLEAR(r, s) SDL_DFB_CALLOC(r, 1, s)
123
124 /* Private display data */
125
126 #define SDL_DFB_DEVICEDATA(dev) DFB_DeviceData *devdata = (dev ? (DFB_DeviceData *) ((dev)->driverdata) : NULL)
127
128 #define DFB_MAX_SCREENS 10
129
130 typedef struct _DFB_KeyboardData DFB_KeyboardData;
131 struct _DFB_KeyboardData
132 {
133 const SDL_Scancode *map; /* keyboard scancode map */
134 int map_size; /* size of map */
135 int map_adjust; /* index adjust */
136 int is_generic; /* generic keyboard */
137 int id;
138 };
139
140 typedef struct _DFB_DeviceData DFB_DeviceData;
141 struct _DFB_DeviceData
142 {
143 int initialized;
144
145 IDirectFB *dfb;
146 int num_mice;
147 int mouse_id[0x100];
148 int num_keyboard;
149 DFB_KeyboardData keyboard[10];
150 SDL_Window *firstwin;
151
152 int use_yuv_underlays;
153 int use_yuv_direct;
154 int use_linux_input;
155 int has_own_wm;
156
157
158 /* window grab */
159 SDL_Window *grabbed_window;
160
161 /* global events */
162 IDirectFBEventBuffer *events;
163 };
164
165 Uint32 DirectFB_DFBToSDLPixelFormat(DFBSurfacePixelFormat pixelformat);
166 DFBSurfacePixelFormat DirectFB_SDLToDFBPixelFormat(Uint32 format);
167 void DirectFB_SetSupportedPixelFormats(SDL_RendererInfo *ri);
168
169
170 #endif /* _SDL_DirectFB_video_h */
SDL_DFB_LOG
#define SDL_DFB_LOG(x...)
Definition: SDL_DirectFB_video.h:87
DirectFB_SetSupportedPixelFormats
void DirectFB_SetSupportedPixelFormats(SDL_RendererInfo *ri)
SDL_render.h
_DFB_DeviceData::dfb
IDirectFB * dfb
Definition: SDL_DirectFB_video.h:145
SDL_log.h
_DFB_DeviceData::num_mice
int num_mice
Definition: SDL_DirectFB_video.h:146
_DFB_KeyboardData::map_size
int map_size
Definition: SDL_DirectFB_video.h:134
DirectFB_SDLToDFBPixelFormat
DFBSurfacePixelFormat DirectFB_SDLToDFBPixelFormat(Uint32 format)
_DFB_KeyboardData::map_adjust
int map_adjust
Definition: SDL_DirectFB_video.h:135
DirectFB_DFBToSDLPixelFormat
Uint32 DirectFB_DFBToSDLPixelFormat(DFBSurfacePixelFormat pixelformat)
_DFB_DeviceData::use_linux_input
int use_linux_input
Definition: SDL_DirectFB_video.h:154
chktrcmp.src_line
tuple src_line
Definition: chktrcmp.py:64
SDL_config.h
_DFB_KeyboardData::map
const SDL_Scancode * map
Definition: SDL_DirectFB_video.h:133
ret
ret
Definition: glew_str_glx.c:2
_DFB_KeyboardData::id
int id
Definition: SDL_DirectFB_video.h:137
Uint32
uint32_t Uint32
An unsigned 32-bit integer type.
Definition: SDL_stdinc.h:145
_DFB_KeyboardData
Definition: SDL_DirectFB_video.h:131
_DFB_DeviceData::firstwin
SDL_Window * firstwin
Definition: SDL_DirectFB_video.h:150
_DFB_DeviceData::has_own_wm
int has_own_wm
Definition: SDL_DirectFB_video.h:155
_DFB_DeviceData::keyboard
DFB_KeyboardData keyboard[10]
Definition: SDL_DirectFB_video.h:149
_DFB_DeviceData::initialized
int initialized
Definition: SDL_DirectFB_video.h:143
SDL_scancode.h
SDL_DFB_CONTEXT
#define SDL_DFB_CONTEXT
Definition: SDL_DirectFB_video.h:82
format
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl2ext.h:845
SDL_SetError
DECLSPEC int SDLCALL SDL_SetError(const char *fmt,...)
Definition: SDL_error.c:53
sdl_dfb_check
static DFBResult sdl_dfb_check(DFBResult ret, const char *src_file, int src_line)
Definition: SDL_DirectFB_video.h:91
SDL_RendererInfo
Information on the capabilities of a render driver or context.
Definition: SDL_render.h:78
_DFB_DeviceData::grabbed_window
SDL_Window * grabbed_window
Definition: SDL_DirectFB_video.h:159
SDL_Window
Definition: SDL_sysvideo.h:71
_DFB_DeviceData::use_yuv_underlays
int use_yuv_underlays
Definition: SDL_DirectFB_video.h:152
_DFB_DeviceData::mouse_id
int mouse_id[0x100]
Definition: SDL_DirectFB_video.h:147
_DFB_DeviceData::num_keyboard
int num_keyboard
Definition: SDL_DirectFB_video.h:148
_DFB_DeviceData
Definition: SDL_DirectFB_video.h:141
SDL_Scancode
SDL_Scancode
The SDL keyboard scancode representation.
Definition: SDL_scancode.h:43
_DFB_DeviceData::use_yuv_direct
int use_yuv_direct
Definition: SDL_DirectFB_video.h:153
_DFB_KeyboardData::is_generic
int is_generic
Definition: SDL_DirectFB_video.h:136
_DFB_DeviceData::events
IDirectFBEventBuffer * events
Definition: SDL_DirectFB_video.h:162