Minor cleanups
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
diff --git a/src/video/directfb/SDL_DirectFB_render.c b/src/video/directfb/SDL_DirectFB_render.c
index 61f9b00..3a0220e 100644
--- a/src/video/directfb/SDL_DirectFB_render.c
+++ b/src/video/directfb/SDL_DirectFB_render.c
@@ -52,7 +52,7 @@
#define SDL_DFB_RENDERERDATA(rend) DirectFB_RenderData *renddata = ((rend) ? (DirectFB_RenderData *) (rend)->driverdata : NULL)
-/* GDI renderer implementation */
+/* DirectFB renderer implementation */
static SDL_Renderer *DirectFB_CreateRenderer(SDL_Window * window,
Uint32 flags);
diff --git a/src/video/mx6/SDL_mx6video.c b/src/video/mx6/SDL_mx6video.c
index d449ef6..91ac4ce 100644
--- a/src/video/mx6/SDL_mx6video.c
+++ b/src/video/mx6/SDL_mx6video.c
@@ -48,6 +48,7 @@ static void
MX6_Destroy(SDL_VideoDevice * device)
{
if (device->driverdata != NULL) {
+ SDL_free(device->driverdata);
device->driverdata = NULL;
}
}
@@ -56,7 +57,7 @@ static SDL_VideoDevice *
MX6_Create()
{
SDL_VideoDevice *device;
- SDL_VideoData *phdata;
+ SDL_VideoData *data;
/* Initialize SDL_VideoDevice structure */
device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
@@ -66,14 +67,14 @@ MX6_Create()
}
/* Initialize internal data */
- phdata = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
- if (phdata == NULL) {
+ data = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
+ if (data == NULL) {
SDL_OutOfMemory();
SDL_free(device);
return NULL;
}
- device->driverdata = phdata;
+ device->driverdata = data;
/* Setup amount of available displays and current display */
device->num_displays = 0;
@@ -185,7 +186,7 @@ MX6_VideoInit(_THIS)
SDL_EVDEV_Init();
#endif
- return 1;
+ return 0;
}
void
@@ -213,31 +214,31 @@ int
MX6_CreateWindow(_THIS, SDL_Window * window)
{
SDL_DisplayData *displaydata;
- SDL_WindowData *wdata;
+ SDL_WindowData *data;
displaydata = SDL_GetDisplayDriverData(0);
/* Allocate window internal data */
- wdata = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData));
- if (wdata == NULL) {
+ data = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData));
+ if (data == NULL) {
return SDL_OutOfMemory();
}
/* Setup driver data for this window */
- window->driverdata = wdata;
+ window->driverdata = data;
window->flags |= SDL_WINDOW_OPENGL;
if (!_this->egl_data) {
return -1;
}
- wdata->native_window = egl_viv_data->fbCreateWindow(displaydata->native_display, window->x, window->y, window->w, window->h);
- if (!wdata->native_window) {
+ data->native_window = egl_viv_data->fbCreateWindow(displaydata->native_display, window->x, window->y, window->w, window->h);
+ if (!data->native_window) {
return SDL_SetError("MX6: Can't create native window");
}
- wdata->egl_surface = SDL_EGL_CreateSurface(_this, wdata->native_window);
- if (wdata->egl_surface == EGL_NO_SURFACE) {
+ data->egl_surface = SDL_EGL_CreateSurface(_this, data->native_window);
+ if (data->egl_surface == EGL_NO_SURFACE) {
return SDL_SetError("MX6: Can't create EGL surface");
}
@@ -248,22 +249,27 @@ MX6_CreateWindow(_THIS, SDL_Window * window)
void
MX6_DestroyWindow(_THIS, SDL_Window * window)
{
- SDL_WindowData *wdata;
+ SDL_WindowData *data;
- wdata = window->driverdata;
- if (wdata) {
- SDL_EGL_DestroySurface(_this, wdata->egl_surface);
- }
+ data = window->driverdata;
+ if (data) {
+ if (data->egl_surface != EGL_NO_SURFACE) {
+ SDL_EGL_DestroySurface(_this, data->egl_surface);
+ }
+
+ if (data->native_window) {
+ egl_viv_data->fbDestroyWindow(data->native_window);
+ }
- if (egl_viv_data) {
- egl_viv_data->fbDestroyWindow(wdata->native_window);
+ SDL_free(data);
}
+ window->driverdata = NULL;
}
int
MX6_CreateWindowFrom(_THIS, SDL_Window * window, const void *data)
{
- return -1;
+ return SDL_Unsupported();
}
void
diff --git a/src/video/x11/SDL_x11opengles.c b/src/video/x11/SDL_x11opengles.c
index bce59b1..5310420 100644
--- a/src/video/x11/SDL_x11opengles.c
+++ b/src/video/x11/SDL_x11opengles.c
@@ -29,8 +29,8 @@
/* EGL implementation of SDL OpenGL support */
int
-X11_GLES_LoadLibrary(_THIS, const char *path) {
-
+X11_GLES_LoadLibrary(_THIS, const char *path)
+{
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
/* If the profile requested is not GL ES, switch over to X11_GL functions */