comparison src/video/dummy/SDL_nullvideo.c @ 1668:4da1ee79c9af SDL-1.3

more tweaking indent options
author Sam Lantinga <slouken@libsdl.org>
date Mon, 29 May 2006 04:04:35 +0000
parents 1fddae038bc8
children 9857d21967bb
comparison
equal deleted inserted replaced
1667:1fddae038bc8 1668:4da1ee79c9af
47 #include "SDL_nullmouse_c.h" 47 #include "SDL_nullmouse_c.h"
48 48
49 #define DUMMYVID_DRIVER_NAME "dummy" 49 #define DUMMYVID_DRIVER_NAME "dummy"
50 50
51 /* Initialization/Query functions */ 51 /* Initialization/Query functions */
52 static int DUMMY_VideoInit (_THIS); 52 static int DUMMY_VideoInit(_THIS);
53 static int DUMMY_SetDisplayMode (_THIS, const SDL_DisplayMode * mode); 53 static int DUMMY_SetDisplayMode(_THIS, const SDL_DisplayMode * mode);
54 static void DUMMY_CreateWindowSurface (_THIS, SDL_Window * window, 54 static void DUMMY_CreateWindowSurface(_THIS, SDL_Window * window,
55 Uint32 flags); 55 Uint32 flags);
56 static void DUMMY_VideoQuit (_THIS); 56 static void DUMMY_VideoQuit(_THIS);
57 57
58 /* DUMMY driver bootstrap functions */ 58 /* DUMMY driver bootstrap functions */
59 59
60 static int 60 static int
61 DUMMY_Available (void) 61 DUMMY_Available(void)
62 { 62 {
63 const char *envr = SDL_getenv ("SDL_VIDEODRIVER"); 63 const char *envr = SDL_getenv("SDL_VIDEODRIVER");
64 if ((envr) && (SDL_strcmp (envr, DUMMYVID_DRIVER_NAME) == 0)) { 64 if ((envr) && (SDL_strcmp(envr, DUMMYVID_DRIVER_NAME) == 0)) {
65 return (1); 65 return (1);
66 } 66 }
67 67
68 return (0); 68 return (0);
69 } 69 }
70 70
71 static void 71 static void
72 DUMMY_DeleteDevice (SDL_VideoDevice * device) 72 DUMMY_DeleteDevice(SDL_VideoDevice * device)
73 { 73 {
74 SDL_free (device->hidden); 74 SDL_free(device->hidden);
75 SDL_free (device); 75 SDL_free(device);
76 } 76 }
77 77
78 static SDL_VideoDevice * 78 static SDL_VideoDevice *
79 DUMMY_CreateDevice (int devindex) 79 DUMMY_CreateDevice(int devindex)
80 { 80 {
81 SDL_VideoDevice *device; 81 SDL_VideoDevice *device;
82 82
83 /* Initialize all variables that we clean on shutdown */ 83 /* Initialize all variables that we clean on shutdown */
84 device = (SDL_VideoDevice *) SDL_malloc (sizeof (SDL_VideoDevice)); 84 device = (SDL_VideoDevice *) SDL_malloc(sizeof(SDL_VideoDevice));
85 if (device) { 85 if (device) {
86 SDL_memset (device, 0, (sizeof *device)); 86 SDL_memset(device, 0, (sizeof *device));
87 device->hidden = (struct SDL_PrivateVideoData *) 87 device->hidden = (struct SDL_PrivateVideoData *)
88 SDL_malloc ((sizeof *device->hidden)); 88 SDL_malloc((sizeof *device->hidden));
89 } 89 }
90 if ((device == NULL) || (device->hidden == NULL)) { 90 if ((device == NULL) || (device->hidden == NULL)) {
91 SDL_OutOfMemory (); 91 SDL_OutOfMemory();
92 if (device) { 92 if (device) {
93 SDL_free (device); 93 SDL_free(device);
94 } 94 }
95 return (0); 95 return (0);
96 } 96 }
97 SDL_memset (device->hidden, 0, (sizeof *device->hidden)); 97 SDL_memset(device->hidden, 0, (sizeof *device->hidden));
98 98
99 /* Set the function pointers */ 99 /* Set the function pointers */
100 device->VideoInit = DUMMY_VideoInit; 100 device->VideoInit = DUMMY_VideoInit;
101 device->SetDisplayMode = DUMMY_SetDisplayMode; 101 device->SetDisplayMode = DUMMY_SetDisplayMode;
102 device->CreateWindowSurface = DUMMY_CreateWindowSurface; 102 device->CreateWindowSurface = DUMMY_CreateWindowSurface;
114 DUMMY_Available, DUMMY_CreateDevice 114 DUMMY_Available, DUMMY_CreateDevice
115 }; 115 };
116 116
117 117
118 int 118 int
119 DUMMY_VideoInit (_THIS) 119 DUMMY_VideoInit(_THIS)
120 { 120 {
121 SDL_DisplayMode mode; 121 SDL_DisplayMode mode;
122 122
123 SDL_AddBasicVideoDisplay (NULL); 123 SDL_AddBasicVideoDisplay(NULL);
124 124
125 SDL_zero(mode); 125 SDL_zero(mode);
126 SDL_AddDisplayMode(0, &mode); 126 SDL_AddDisplayMode(0, &mode);
127 127
128 /* We're done! */ 128 /* We're done! */
129 return 0; 129 return 0;
130 } 130 }
131 131
132 static int 132 static int
133 DUMMY_SetDisplayMode (_THIS, const SDL_DisplayMode * mode) 133 DUMMY_SetDisplayMode(_THIS, const SDL_DisplayMode * mode)
134 { 134 {
135 return 0; 135 return 0;
136 } 136 }
137 137
138 static void 138 static void
139 DUMMY_CreateWindowSurface (_THIS, SDL_Window * window, Uint32 flags) 139 DUMMY_CreateWindowSurface(_THIS, SDL_Window * window, Uint32 flags)
140 { 140 {
141 int bpp; 141 int bpp;
142 Uint32 Rmask, Gmask, Bmask, Amask; 142 Uint32 Rmask, Gmask, Bmask, Amask;
143 143
144 SDL_PixelFormatEnumToMasks (SDL_GetCurrentDisplayMode ()->format, &bpp, 144 SDL_PixelFormatEnumToMasks(SDL_GetCurrentDisplayMode()->format, &bpp,
145 &Rmask, &Gmask, &Bmask, &Amask); 145 &Rmask, &Gmask, &Bmask, &Amask);
146 window->surface = 146 window->surface =
147 SDL_CreateRGBSurface (flags, window->w, window->h, bpp, Rmask, Gmask, 147 SDL_CreateRGBSurface(flags, window->w, window->h, bpp, Rmask, Gmask,
148 Bmask, Amask); 148 Bmask, Amask);
149 } 149 }
150 150
151 /* Note: If we are terminated, this could be called in the middle of 151 /* Note: If we are terminated, this could be called in the middle of
152 another SDL video routine -- notably UpdateRects. 152 another SDL video routine -- notably UpdateRects.
153 */ 153 */
154 void 154 void
155 DUMMY_VideoQuit (_THIS) 155 DUMMY_VideoQuit(_THIS)
156 { 156 {
157 } 157 }
158 158
159 /* vi: set ts=4 sw=4 expandtab: */ 159 /* vi: set ts=4 sw=4 expandtab: */