Mercurial > sdl-ios-xcode
comparison src/video/nds/SDL_ndsrender.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 | 7f684f249ec9 |
children | f7b03b6838cb |
comparison
equal
deleted
inserted
replaced
3684:cc564f08884f | 3685:64ce267332c6 |
---|---|
124 | 124 |
125 | 125 |
126 SDL_Renderer * | 126 SDL_Renderer * |
127 NDS_CreateRenderer(SDL_Window * window, Uint32 flags) | 127 NDS_CreateRenderer(SDL_Window * window, Uint32 flags) |
128 { | 128 { |
129 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); | 129 SDL_VideoDisplay *display = window->display; |
130 SDL_DisplayMode *displayMode = &display->current_mode; | 130 SDL_DisplayMode *displayMode = &display->current_mode; |
131 SDL_Renderer *renderer; | 131 SDL_Renderer *renderer; |
132 NDS_RenderData *data; | 132 NDS_RenderData *data; |
133 int i, n; | 133 int i, n; |
134 int bpp; | 134 int bpp; |
173 renderer->RenderCopy = NDS_RenderCopy; | 173 renderer->RenderCopy = NDS_RenderCopy; |
174 renderer->RenderPresent = NDS_RenderPresent; | 174 renderer->RenderPresent = NDS_RenderPresent; |
175 renderer->DestroyRenderer = NDS_DestroyRenderer; | 175 renderer->DestroyRenderer = NDS_DestroyRenderer; |
176 renderer->info.name = NDS_RenderDriver.info.name; | 176 renderer->info.name = NDS_RenderDriver.info.name; |
177 renderer->info.flags = 0; | 177 renderer->info.flags = 0; |
178 renderer->window = window->id; | 178 renderer->window = window; |
179 renderer->driverdata = data; | 179 renderer->driverdata = data; |
180 renderer->CreateTexture = NDS_CreateTexture; | 180 renderer->CreateTexture = NDS_CreateTexture; |
181 renderer->QueryTexturePixels = NDS_QueryTexturePixels; | 181 renderer->QueryTexturePixels = NDS_QueryTexturePixels; |
182 renderer->SetTexturePalette = NDS_SetTexturePalette; | 182 renderer->SetTexturePalette = NDS_SetTexturePalette; |
183 renderer->GetTexturePalette = NDS_GetTexturePalette; | 183 renderer->GetTexturePalette = NDS_GetTexturePalette; |
488 NDS_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, | 488 NDS_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, |
489 const SDL_Rect * srcrect, const SDL_Rect * dstrect) | 489 const SDL_Rect * srcrect, const SDL_Rect * dstrect) |
490 { | 490 { |
491 NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata; | 491 NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata; |
492 NDS_TextureData *txdat = (NDS_TextureData *) texture->driverdata; | 492 NDS_TextureData *txdat = (NDS_TextureData *) texture->driverdata; |
493 SDL_Window *window = SDL_GetWindowFromID(renderer->window); | 493 SDL_Window *window = renderer->window; |
494 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); | 494 SDL_VideoDisplay *display = window->display; |
495 int Bpp = SDL_BYTESPERPIXEL(texture->format); | 495 int Bpp = SDL_BYTESPERPIXEL(texture->format); |
496 | 496 |
497 if (txdat->type == NDSTX_BG) { | 497 if (txdat->type == NDSTX_BG) { |
498 txdat->scroll.x = dstrect->x; | 498 txdat->scroll.x = dstrect->x; |
499 txdat->scroll.y = dstrect->y; | 499 txdat->scroll.y = dstrect->y; |
513 | 513 |
514 static void | 514 static void |
515 NDS_RenderPresent(SDL_Renderer * renderer) | 515 NDS_RenderPresent(SDL_Renderer * renderer) |
516 { | 516 { |
517 NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata; | 517 NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata; |
518 SDL_Window *window = SDL_GetWindowFromID(renderer->window); | 518 SDL_Window *window = renderer->window; |
519 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); | 519 SDL_VideoDisplay *display = window->display; |
520 | 520 |
521 /* update sprites */ | 521 /* update sprites */ |
522 // NDS_OAM_Update(&(data->oam_copy), data->sub); | 522 // NDS_OAM_Update(&(data->oam_copy), data->sub); |
523 /* vsync for NDS */ | 523 /* vsync for NDS */ |
524 if (renderer->info.flags & SDL_RENDERER_PRESENTVSYNC) { | 524 if (renderer->info.flags & SDL_RENDERER_PRESENTVSYNC) { |
536 | 536 |
537 static void | 537 static void |
538 NDS_DestroyRenderer(SDL_Renderer * renderer) | 538 NDS_DestroyRenderer(SDL_Renderer * renderer) |
539 { | 539 { |
540 NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata; | 540 NDS_RenderData *data = (NDS_RenderData *) renderer->driverdata; |
541 SDL_Window *window = SDL_GetWindowFromID(renderer->window); | |
542 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); | |
543 int i; | 541 int i; |
544 | 542 |
545 if (data) { | 543 if (data) { |
546 /* free anything else relevant if anything else is allocated. */ | 544 /* free anything else relevant if anything else is allocated. */ |
547 SDL_free(data); | 545 SDL_free(data); |