comparison src/video/photon/SDL_photon_render.c @ 3685:64ce267332c6

Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.
author Sam Lantinga <slouken@libsdl.org>
date Thu, 21 Jan 2010 06:21:52 +0000
parents 4b594623401b
children f7b03b6838cb
comparison
equal deleted inserted replaced
3684:cc564f08884f 3685:64ce267332c6
122 }; 122 };
123 123
124 static SDL_Renderer * 124 static SDL_Renderer *
125 photon_createrenderer(SDL_Window * window, Uint32 flags) 125 photon_createrenderer(SDL_Window * window, Uint32 flags)
126 { 126 {
127 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); 127 SDL_VideoDisplay *display = window->display;
128 SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata; 128 SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata;
129 SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; 129 SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata;
130 SDL_Renderer *renderer = NULL; 130 SDL_Renderer *renderer = NULL;
131 SDL_RenderData *rdata = NULL; 131 SDL_RenderData *rdata = NULL;
132 132
169 renderer->RenderWritePixels = photon_renderwritepixels; 169 renderer->RenderWritePixels = photon_renderwritepixels;
170 renderer->RenderPresent = photon_renderpresent; 170 renderer->RenderPresent = photon_renderpresent;
171 renderer->DestroyTexture = photon_destroytexture; 171 renderer->DestroyTexture = photon_destroytexture;
172 renderer->DestroyRenderer = photon_destroyrenderer; 172 renderer->DestroyRenderer = photon_destroyrenderer;
173 renderer->info = photon_renderdriver.info; 173 renderer->info = photon_renderdriver.info;
174 renderer->window = window->id; 174 renderer->window = window;
175 renderer->driverdata = rdata; 175 renderer->driverdata = rdata;
176 176
177 /* Copy direct_mode status */ 177 /* Copy direct_mode status */
178 rdata->direct_mode=didata->direct_mode; 178 rdata->direct_mode=didata->direct_mode;
179 179
296 int32_t status; 296 int32_t status;
297 297
298 /* Obtain window and display structures */ 298 /* Obtain window and display structures */
299 window=SDL_GetWindowFromID(renderer->window); 299 window=SDL_GetWindowFromID(renderer->window);
300 wdata=(SDL_WindowData*)window->driverdata; 300 wdata=(SDL_WindowData*)window->driverdata;
301 display=SDL_GetDisplayFromWindow(window); 301 display=window->display;
302 didata=(SDL_DisplayData *) display->driverdata; 302 didata=(SDL_DisplayData *) display->driverdata;
303 phdata=(SDL_VideoData *) display->device->driverdata; 303 phdata=(SDL_VideoData *) display->device->driverdata;
304 304
305 /* Check if it is OpenGL ES window */ 305 /* Check if it is OpenGL ES window */
306 if ((window->flags & SDL_WINDOW_OPENGL) == SDL_WINDOW_OPENGL) { 306 if ((window->flags & SDL_WINDOW_OPENGL) == SDL_WINDOW_OPENGL) {
721 static int 721 static int
722 photon_displaymodechanged(SDL_Renderer * renderer) 722 photon_displaymodechanged(SDL_Renderer * renderer)
723 { 723 {
724 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; 724 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata;
725 SDL_Window *window = SDL_GetWindowFromID(renderer->window); 725 SDL_Window *window = SDL_GetWindowFromID(renderer->window);
726 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); 726 SDL_VideoDisplay *display = window->display;
727 SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata; 727 SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata;
728 728
729 /* Copy direct_mode status */ 729 /* Copy direct_mode status */
730 rdata->direct_mode=didata->direct_mode; 730 rdata->direct_mode=didata->direct_mode;
731 731
736 static int 736 static int
737 photon_createtexture(SDL_Renderer * renderer, SDL_Texture * texture) 737 photon_createtexture(SDL_Renderer * renderer, SDL_Texture * texture)
738 { 738 {
739 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; 739 SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata;
740 SDL_Window *window = SDL_GetWindowFromID(renderer->window); 740 SDL_Window *window = SDL_GetWindowFromID(renderer->window);
741 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); 741 SDL_VideoDisplay *display = window->display;
742 SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata; 742 SDL_DisplayData *didata = (SDL_DisplayData *) display->driverdata;
743 SDL_TextureData *tdata = NULL; 743 SDL_TextureData *tdata = NULL;
744 uint32_t it; 744 uint32_t it;
745 745
746 /* Check, if it is not initialized */ 746 /* Check, if it is not initialized */