Mercurial > sdl-ios-xcode
comparison src/video/nanox/SDL_nximage.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 | 782fd950bd46 |
children |
comparison
equal
deleted
inserted
replaced
1667:1fddae038bc8 | 1668:4da1ee79c9af |
---|---|
27 #include "SDL_config.h" | 27 #include "SDL_config.h" |
28 | 28 |
29 #include "SDL_nximage_c.h" | 29 #include "SDL_nximage_c.h" |
30 | 30 |
31 void | 31 void |
32 NX_NormalUpdate (_THIS, int numrects, SDL_Rect * rects) | 32 NX_NormalUpdate(_THIS, int numrects, SDL_Rect * rects) |
33 { | 33 { |
34 int i, j, xinc, yinc, destinc, rowinc; | 34 int i, j, xinc, yinc, destinc, rowinc; |
35 int x, y, w, h; | 35 int x, y, w, h; |
36 unsigned char *src = NULL, *dest = NULL; | 36 unsigned char *src = NULL, *dest = NULL; |
37 | 37 |
38 Dprintf ("enter NX_NormalUpdate\n"); | 38 Dprintf("enter NX_NormalUpdate\n"); |
39 | 39 |
40 /* These are the values for the incoming image */ | 40 /* These are the values for the incoming image */ |
41 xinc = this->screen->format->BytesPerPixel; | 41 xinc = this->screen->format->BytesPerPixel; |
42 yinc = this->screen->pitch; | 42 yinc = this->screen->pitch; |
43 | 43 |
104 } | 104 } |
105 } | 105 } |
106 #endif | 106 #endif |
107 else { | 107 else { |
108 for (j = h; j > 0; --j, src += yinc, dest += destinc) | 108 for (j = h; j > 0; --j, src += yinc, dest += destinc) |
109 SDL_memcpy (dest, src, rowinc); | 109 SDL_memcpy(dest, src, rowinc); |
110 } | 110 } |
111 if (!Clientfb) { | 111 if (!Clientfb) { |
112 if (currently_fullscreen) { | 112 if (currently_fullscreen) { |
113 GrArea (FSwindow, SDL_GC, x + OffsetX, y + OffsetY, w, | 113 GrArea(FSwindow, SDL_GC, x + OffsetX, y + OffsetY, w, |
114 h, Image_buff, pixel_type); | 114 h, Image_buff, pixel_type); |
115 } else { | 115 } else { |
116 GrArea (SDL_Window, SDL_GC, x, y, w, h, Image_buff, | 116 GrArea(SDL_Window, SDL_GC, x, y, w, h, Image_buff, |
117 pixel_type); | 117 pixel_type); |
118 } | 118 } |
119 } | 119 } |
120 } | 120 } |
121 GrFlush (); | 121 GrFlush(); |
122 | 122 |
123 Dprintf ("leave NX_NormalUpdate\n"); | 123 Dprintf("leave NX_NormalUpdate\n"); |
124 } | 124 } |
125 | 125 |
126 int | 126 int |
127 NX_SetupImage (_THIS, SDL_Surface * screen) | 127 NX_SetupImage(_THIS, SDL_Surface * screen) |
128 { | 128 { |
129 int size = screen->h * screen->pitch; | 129 int size = screen->h * screen->pitch; |
130 | 130 |
131 Dprintf ("enter NX_SetupImage\n"); | 131 Dprintf("enter NX_SetupImage\n"); |
132 | 132 |
133 screen->pixels = (void *) SDL_malloc (size); | 133 screen->pixels = (void *) SDL_malloc(size); |
134 | 134 |
135 if (!Clientfb) { | 135 if (!Clientfb) { |
136 Image_buff = (unsigned char *) SDL_malloc (size); | 136 Image_buff = (unsigned char *) SDL_malloc(size); |
137 if (screen->pixels == NULL || Image_buff == NULL) { | 137 if (screen->pixels == NULL || Image_buff == NULL) { |
138 SDL_free (screen->pixels); | 138 SDL_free(screen->pixels); |
139 SDL_free (Image_buff); | 139 SDL_free(Image_buff); |
140 SDL_OutOfMemory (); | 140 SDL_OutOfMemory(); |
141 return -1; | 141 return -1; |
142 } | 142 } |
143 } | 143 } |
144 | 144 |
145 SDL_Image = (unsigned char *) screen->pixels; | 145 SDL_Image = (unsigned char *) screen->pixels; |
146 | 146 |
147 this->UpdateRects = NX_NormalUpdate; | 147 this->UpdateRects = NX_NormalUpdate; |
148 | 148 |
149 Dprintf ("leave NX_SetupImage\n"); | 149 Dprintf("leave NX_SetupImage\n"); |
150 return 0; | 150 return 0; |
151 } | 151 } |
152 | 152 |
153 void | 153 void |
154 NX_DestroyImage (_THIS, SDL_Surface * screen) | 154 NX_DestroyImage(_THIS, SDL_Surface * screen) |
155 { | 155 { |
156 Dprintf ("enter NX_DestroyImage\n"); | 156 Dprintf("enter NX_DestroyImage\n"); |
157 | 157 |
158 if (SDL_Image) | 158 if (SDL_Image) |
159 SDL_free (SDL_Image); | 159 SDL_free(SDL_Image); |
160 if (Image_buff) | 160 if (Image_buff) |
161 SDL_free (Image_buff); | 161 SDL_free(Image_buff); |
162 if (screen) | 162 if (screen) |
163 screen->pixels = NULL; | 163 screen->pixels = NULL; |
164 | 164 |
165 Dprintf ("leave NX_DestroyImage\n"); | 165 Dprintf("leave NX_DestroyImage\n"); |
166 } | 166 } |
167 | 167 |
168 int | 168 int |
169 NX_ResizeImage (_THIS, SDL_Surface * screen, Uint32 flags) | 169 NX_ResizeImage(_THIS, SDL_Surface * screen, Uint32 flags) |
170 { | 170 { |
171 int retval; | 171 int retval; |
172 GR_SCREEN_INFO si; | 172 GR_SCREEN_INFO si; |
173 | 173 |
174 Dprintf ("enter NX_ResizeImage\n"); | 174 Dprintf("enter NX_ResizeImage\n"); |
175 | 175 |
176 NX_DestroyImage (this, screen); | 176 NX_DestroyImage(this, screen); |
177 retval = NX_SetupImage (this, screen); | 177 retval = NX_SetupImage(this, screen); |
178 | 178 |
179 GrGetScreenInfo (&si); | 179 GrGetScreenInfo(&si); |
180 OffsetX = (si.cols - screen->w) / 2; | 180 OffsetX = (si.cols - screen->w) / 2; |
181 OffsetY = (si.rows - screen->h) / 2; | 181 OffsetY = (si.rows - screen->h) / 2; |
182 | 182 |
183 #ifdef ENABLE_NANOX_DIRECT_FB | 183 #ifdef ENABLE_NANOX_DIRECT_FB |
184 if (Clientfb) { | 184 if (Clientfb) { |
185 /* Get current window position and fb pointer */ | 185 /* Get current window position and fb pointer */ |
186 if (currently_fullscreen) | 186 if (currently_fullscreen) |
187 GrGetWindowFBInfo (FSwindow, &fbinfo); | 187 GrGetWindowFBInfo(FSwindow, &fbinfo); |
188 else | 188 else |
189 GrGetWindowFBInfo (SDL_Window, &fbinfo); | 189 GrGetWindowFBInfo(SDL_Window, &fbinfo); |
190 } | 190 } |
191 #endif | 191 #endif |
192 Dprintf ("leave NX_ResizeImage\n"); | 192 Dprintf("leave NX_ResizeImage\n"); |
193 return retval; | 193 return retval; |
194 } | 194 } |
195 | 195 |
196 void | 196 void |
197 NX_RefreshDisplay (_THIS) | 197 NX_RefreshDisplay(_THIS) |
198 { | 198 { |
199 Dprintf ("enter NX_RefreshDisplay\n"); | 199 Dprintf("enter NX_RefreshDisplay\n"); |
200 | 200 |
201 // Don't refresh a display that doesn't have an image (like GL) | 201 // Don't refresh a display that doesn't have an image (like GL) |
202 if (!SDL_Image) { | 202 if (!SDL_Image) { |
203 return; | 203 return; |
204 } | 204 } |
206 if (Clientfb) { | 206 if (Clientfb) { |
207 int j; | 207 int j; |
208 char *src, *dest = NULL; | 208 char *src, *dest = NULL; |
209 int xinc, yinc, rowinc; | 209 int xinc, yinc, rowinc; |
210 | 210 |
211 GrGetWindowFBInfo (SDL_Window, &fbinfo); | 211 GrGetWindowFBInfo(SDL_Window, &fbinfo); |
212 | 212 |
213 xinc = this->screen->format->BytesPerPixel; | 213 xinc = this->screen->format->BytesPerPixel; |
214 yinc = this->screen->pitch; | 214 yinc = this->screen->pitch; |
215 | 215 |
216 src = SDL_Image; | 216 src = SDL_Image; |
221 dest = fbinfo.winpixels; | 221 dest = fbinfo.winpixels; |
222 rowinc = xinc * this->screen->w; | 222 rowinc = xinc * this->screen->w; |
223 | 223 |
224 for (j = this->screen->h; j > 0; | 224 for (j = this->screen->h; j > 0; |
225 --j, src += yinc, dest += fbinfo.pitch) | 225 --j, src += yinc, dest += fbinfo.pitch) |
226 SDL_memcpy (dest, src, rowinc); | 226 SDL_memcpy(dest, src, rowinc); |
227 } else | 227 } else |
228 #endif | 228 #endif |
229 { | 229 { |
230 if (currently_fullscreen) { | 230 if (currently_fullscreen) { |
231 GrArea (FSwindow, SDL_GC, OffsetX, OffsetY, this->screen->w, | 231 GrArea(FSwindow, SDL_GC, OffsetX, OffsetY, this->screen->w, |
232 this->screen->h, SDL_Image, pixel_type); | 232 this->screen->h, SDL_Image, pixel_type); |
233 } else { | 233 } else { |
234 GrArea (SDL_Window, SDL_GC, 0, 0, this->screen->w, | 234 GrArea(SDL_Window, SDL_GC, 0, 0, this->screen->w, |
235 this->screen->h, SDL_Image, pixel_type); | 235 this->screen->h, SDL_Image, pixel_type); |
236 } | 236 } |
237 } | 237 } |
238 GrFlush (); | 238 GrFlush(); |
239 | 239 |
240 Dprintf ("leave NX_RefreshDisplay\n"); | 240 Dprintf("leave NX_RefreshDisplay\n"); |
241 } | 241 } |
242 | 242 |
243 /* vi: set ts=4 sw=4 expandtab: */ | 243 /* vi: set ts=4 sw=4 expandtab: */ |