Mercurial > sdl-ios-xcode
comparison src/video/SDL_renderer_sw.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 | 0f958e527e5e |
children | f7b03b6838cb |
comparison
equal
deleted
inserted
replaced
3684:cc564f08884f | 3685:64ce267332c6 |
---|---|
199 } | 199 } |
200 | 200 |
201 SDL_Renderer * | 201 SDL_Renderer * |
202 SW_CreateRenderer(SDL_Window * window, Uint32 flags) | 202 SW_CreateRenderer(SDL_Window * window, Uint32 flags) |
203 { | 203 { |
204 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); | 204 SDL_VideoDisplay *display = window->display; |
205 SDL_DisplayMode *displayMode = &display->current_mode; | 205 SDL_DisplayMode *displayMode = &display->current_mode; |
206 SDL_Renderer *renderer; | 206 SDL_Renderer *renderer; |
207 SW_RenderData *data; | 207 SW_RenderData *data; |
208 int i, n; | 208 int i, n; |
209 int bpp; | 209 int bpp; |
241 renderer->RenderWritePixels = SW_RenderWritePixels; | 241 renderer->RenderWritePixels = SW_RenderWritePixels; |
242 renderer->RenderPresent = SW_RenderPresent; | 242 renderer->RenderPresent = SW_RenderPresent; |
243 renderer->DestroyRenderer = SW_DestroyRenderer; | 243 renderer->DestroyRenderer = SW_DestroyRenderer; |
244 renderer->info.name = SW_RenderDriver.info.name; | 244 renderer->info.name = SW_RenderDriver.info.name; |
245 renderer->info.flags = 0; | 245 renderer->info.flags = 0; |
246 renderer->window = window->id; | 246 renderer->window = window; |
247 renderer->driverdata = data; | 247 renderer->driverdata = data; |
248 Setup_SoftwareRenderer(renderer); | 248 Setup_SoftwareRenderer(renderer); |
249 | 249 |
250 if (flags & SDL_RENDERER_PRESENTFLIP2) { | 250 if (flags & SDL_RENDERER_PRESENTFLIP2) { |
251 renderer->info.flags |= SDL_RENDERER_PRESENTFLIP2; | 251 renderer->info.flags |= SDL_RENDERER_PRESENTFLIP2; |
319 | 319 |
320 static int | 320 static int |
321 SW_ActivateRenderer(SDL_Renderer * renderer) | 321 SW_ActivateRenderer(SDL_Renderer * renderer) |
322 { | 322 { |
323 SW_RenderData *data = (SW_RenderData *) renderer->driverdata; | 323 SW_RenderData *data = (SW_RenderData *) renderer->driverdata; |
324 SDL_Window *window = SDL_GetWindowFromID(renderer->window); | 324 SDL_Window *window = renderer->window; |
325 int i, n; | 325 int i, n; |
326 | 326 |
327 if (data->renderer && data->renderer->ActivateRenderer) { | 327 if (data->renderer && data->renderer->ActivateRenderer) { |
328 if (data->renderer->ActivateRenderer(data->renderer) < 0) { | 328 if (data->renderer->ActivateRenderer(data->renderer) < 0) { |
329 return -1; | 329 return -1; |
792 static int | 792 static int |
793 SW_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, | 793 SW_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, |
794 const SDL_Rect * srcrect, const SDL_Rect * dstrect) | 794 const SDL_Rect * srcrect, const SDL_Rect * dstrect) |
795 { | 795 { |
796 SW_RenderData *data = (SW_RenderData *) renderer->driverdata; | 796 SW_RenderData *data = (SW_RenderData *) renderer->driverdata; |
797 SDL_Window *window = SDL_GetWindowFromID(renderer->window); | 797 SDL_Window *window = renderer->window; |
798 int status; | 798 int status; |
799 | 799 |
800 if (data->renderer->info.flags & SDL_RENDERER_PRESENTCOPY) { | 800 if (data->renderer->info.flags & SDL_RENDERER_PRESENTCOPY) { |
801 SDL_AddDirtyRect(&data->dirty, dstrect); | 801 SDL_AddDirtyRect(&data->dirty, dstrect); |
802 } | 802 } |
926 | 926 |
927 static void | 927 static void |
928 SW_DestroyRenderer(SDL_Renderer * renderer) | 928 SW_DestroyRenderer(SDL_Renderer * renderer) |
929 { | 929 { |
930 SW_RenderData *data = (SW_RenderData *) renderer->driverdata; | 930 SW_RenderData *data = (SW_RenderData *) renderer->driverdata; |
931 SDL_Window *window = SDL_GetWindowFromID(renderer->window); | 931 SDL_Window *window = renderer->window; |
932 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); | 932 SDL_VideoDisplay *display = window->display; |
933 int i; | 933 int i; |
934 | 934 |
935 if (data) { | 935 if (data) { |
936 for (i = 0; i < SDL_arraysize(data->texture); ++i) { | 936 for (i = 0; i < SDL_arraysize(data->texture); ++i) { |
937 if (data->texture[i]) { | 937 if (data->texture[i]) { |