Mercurial > sdl-ios-xcode
comparison src/video/SDL_video.c @ 1920:8a162bfdc838
Convert SDL_malloc to SDL_calloc if appropriate, slightly faster on operating systems which map the zero page for memory allocations.
OpenGL renderer in progress
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 22 Jul 2006 08:33:18 +0000 |
parents | 00816063b9c9 |
children | d4572b97b08f |
comparison
equal
deleted
inserted
replaced
1919:00816063b9c9 | 1920:8a162bfdc838 |
---|---|
277 return (-1); | 277 return (-1); |
278 } | 278 } |
279 | 279 |
280 /* The software renderer is always available */ | 280 /* The software renderer is always available */ |
281 for (i = 0; i < _this->num_displays; ++i) { | 281 for (i = 0; i < _this->num_displays; ++i) { |
282 #if SDL_VIDEO_OPENGL | |
283 SDL_AddRenderDriver(i, &GL_RenderDriver); | |
284 #endif | |
282 if (_this->displays[i].num_render_drivers > 0) { | 285 if (_this->displays[i].num_render_drivers > 0) { |
283 #if 0 //SDL_VIDEO_OPENGL | |
284 SDL_AddRenderDriver(i, &GL_RenderDriver); | |
285 #endif | |
286 SDL_AddRenderDriver(i, &SW_RenderDriver); | 286 SDL_AddRenderDriver(i, &SW_RenderDriver); |
287 } | 287 } |
288 } | 288 } |
289 | 289 |
290 /* We're ready to go! */ | 290 /* We're ready to go! */ |
1401 renderer = SDL_CurrentDisplay.current_renderer; | 1401 renderer = SDL_CurrentDisplay.current_renderer; |
1402 if (!renderer || !renderer->CreateTexture) { | 1402 if (!renderer || !renderer->CreateTexture) { |
1403 return 0; | 1403 return 0; |
1404 } | 1404 } |
1405 | 1405 |
1406 texture = (SDL_Texture *) SDL_malloc(sizeof(*texture)); | 1406 texture = (SDL_Texture *) SDL_calloc(1, sizeof(*texture)); |
1407 if (!texture) { | 1407 if (!texture) { |
1408 SDL_OutOfMemory(); | 1408 SDL_OutOfMemory(); |
1409 return 0; | 1409 return 0; |
1410 } | 1410 } |
1411 | 1411 |
1412 SDL_zerop(texture); | |
1413 texture->id = _this->next_object_id++; | 1412 texture->id = _this->next_object_id++; |
1414 texture->format = format; | 1413 texture->format = format; |
1415 texture->access = access; | 1414 texture->access = access; |
1416 texture->w = w; | 1415 texture->w = w; |
1417 texture->h = h; | 1416 texture->h = h; |