Mercurial > sdl-ios-xcode
comparison src/video/directfb/SDL_DirectFB_render.c @ 5145:c8e049de174c
Making the API simpler, the renderer present semantics are always having a backbuffer and then discarding it. This is best for hardware accelerated rendering.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 01 Feb 2011 12:19:46 -0800 |
parents | 31e7f523ab3d |
children | 5429daf5e3f9 |
comparison
equal
deleted
inserted
replaced
5144:31e7f523ab3d | 5145:c8e049de174c |
---|---|
85 | 85 |
86 SDL_RenderDriver DirectFB_RenderDriver = { | 86 SDL_RenderDriver DirectFB_RenderDriver = { |
87 DirectFB_CreateRenderer, | 87 DirectFB_CreateRenderer, |
88 { | 88 { |
89 "directfb", | 89 "directfb", |
90 (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY | | 90 (SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED), |
91 SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 | | |
92 SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_PRESENTDISCARD | | |
93 SDL_RENDERER_ACCELERATED), | |
94 14, | 91 14, |
95 { | 92 { |
96 SDL_PIXELFORMAT_INDEX4LSB, | 93 SDL_PIXELFORMAT_INDEX4LSB, |
97 SDL_PIXELFORMAT_INDEX8, | 94 SDL_PIXELFORMAT_INDEX8, |
98 SDL_PIXELFORMAT_RGB332, | 95 SDL_PIXELFORMAT_RGB332, |
254 { | 251 { |
255 SDL_DFB_WINDOWDATA(window); | 252 SDL_DFB_WINDOWDATA(window); |
256 SDL_VideoDisplay *display = window->display; | 253 SDL_VideoDisplay *display = window->display; |
257 SDL_Renderer *renderer = NULL; | 254 SDL_Renderer *renderer = NULL; |
258 DirectFB_RenderData *data = NULL; | 255 DirectFB_RenderData *data = NULL; |
259 DFBSurfaceCapabilities scaps; | |
260 char *p; | 256 char *p; |
261 | 257 |
262 SDL_DFB_CALLOC(renderer, 1, sizeof(*renderer)); | 258 SDL_DFB_CALLOC(renderer, 1, sizeof(*renderer)); |
263 SDL_DFB_CALLOC(data, 1, sizeof(*data)); | 259 SDL_DFB_CALLOC(data, 1, sizeof(*data)); |
264 | 260 |
286 renderer->DestroyRenderer = DirectFB_DestroyRenderer; | 282 renderer->DestroyRenderer = DirectFB_DestroyRenderer; |
287 renderer->info = DirectFB_RenderDriver.info; | 283 renderer->info = DirectFB_RenderDriver.info; |
288 renderer->window = window; /* SDL window */ | 284 renderer->window = window; /* SDL window */ |
289 renderer->driverdata = data; | 285 renderer->driverdata = data; |
290 | 286 |
291 renderer->info.flags = | 287 renderer->info.flags = SDL_RENDERER_ACCELERATED; |
292 SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTDISCARD; | |
293 | 288 |
294 data->window = window; | 289 data->window = window; |
295 | 290 |
296 data->flipflags = DSFLIP_PIPELINE | DSFLIP_BLIT; | 291 data->flipflags = DSFLIP_PIPELINE | DSFLIP_BLIT; |
297 | 292 |
298 if (flags & SDL_RENDERER_PRESENTVSYNC) { | 293 if (flags & SDL_RENDERER_PRESENTVSYNC) { |
299 data->flipflags |= DSFLIP_WAITFORSYNC | DSFLIP_ONSYNC; | 294 data->flipflags |= DSFLIP_WAITFORSYNC | DSFLIP_ONSYNC; |
300 renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; | 295 renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; |
301 } else | 296 } else |
302 data->flipflags |= DSFLIP_ONSYNC; | 297 data->flipflags |= DSFLIP_ONSYNC; |
303 | |
304 SDL_DFB_CHECKERR(windata->surface-> | |
305 GetCapabilities(windata->surface, &scaps)); | |
306 if (scaps & DSCAPS_DOUBLE) | |
307 renderer->info.flags |= SDL_RENDERER_PRESENTFLIP2; | |
308 else if (scaps & DSCAPS_TRIPLE) | |
309 renderer->info.flags |= SDL_RENDERER_PRESENTFLIP3; | |
310 else | |
311 renderer->info.flags |= SDL_RENDERER_SINGLEBUFFER; | |
312 | 298 |
313 data->isyuvdirect = 0; /* default is off! */ | 299 data->isyuvdirect = 0; /* default is off! */ |
314 p = SDL_getenv(DFBENV_USE_YUV_DIRECT); | 300 p = SDL_getenv(DFBENV_USE_YUV_DIRECT); |
315 if (p) | 301 if (p) |
316 data->isyuvdirect = atoi(p); | 302 data->isyuvdirect = atoi(p); |