Mercurial > sdl-ios-xcode
comparison src/video/win32/SDL_d3drender.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 | e86edac50872 |
children | f7b03b6838cb |
comparison
equal
deleted
inserted
replaced
3684:cc564f08884f | 3685:64ce267332c6 |
---|---|
425 } | 425 } |
426 | 426 |
427 SDL_Renderer * | 427 SDL_Renderer * |
428 D3D_CreateRenderer(SDL_Window * window, Uint32 flags) | 428 D3D_CreateRenderer(SDL_Window * window, Uint32 flags) |
429 { | 429 { |
430 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); | 430 SDL_VideoDisplay *display = window->display; |
431 SDL_VideoData *videodata = (SDL_VideoData *) display->device->driverdata; | 431 SDL_VideoData *videodata = (SDL_VideoData *) display->device->driverdata; |
432 SDL_WindowData *windowdata = (SDL_WindowData *) window->driverdata; | 432 SDL_WindowData *windowdata = (SDL_WindowData *) window->driverdata; |
433 SDL_Renderer *renderer; | 433 SDL_Renderer *renderer; |
434 D3D_RenderData *data; | 434 D3D_RenderData *data; |
435 HRESULT result; | 435 HRESULT result; |
473 renderer->RenderWritePixels = D3D_RenderWritePixels; | 473 renderer->RenderWritePixels = D3D_RenderWritePixels; |
474 renderer->RenderPresent = D3D_RenderPresent; | 474 renderer->RenderPresent = D3D_RenderPresent; |
475 renderer->DestroyTexture = D3D_DestroyTexture; | 475 renderer->DestroyTexture = D3D_DestroyTexture; |
476 renderer->DestroyRenderer = D3D_DestroyRenderer; | 476 renderer->DestroyRenderer = D3D_DestroyRenderer; |
477 renderer->info = D3D_RenderDriver.info; | 477 renderer->info = D3D_RenderDriver.info; |
478 renderer->window = window->id; | 478 renderer->window = window; |
479 renderer->driverdata = data; | 479 renderer->driverdata = data; |
480 | 480 |
481 renderer->info.flags = SDL_RENDERER_ACCELERATED; | 481 renderer->info.flags = SDL_RENDERER_ACCELERATED; |
482 | 482 |
483 SDL_zero(pparams); | 483 SDL_zero(pparams); |
675 | 675 |
676 static int | 676 static int |
677 D3D_DisplayModeChanged(SDL_Renderer * renderer) | 677 D3D_DisplayModeChanged(SDL_Renderer * renderer) |
678 { | 678 { |
679 D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata; | 679 D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata; |
680 SDL_Window *window = SDL_GetWindowFromID(renderer->window); | 680 SDL_Window *window = renderer->window; |
681 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); | 681 SDL_VideoDisplay *display = window->display; |
682 | 682 |
683 data->pparams.BackBufferWidth = window->w; | 683 data->pparams.BackBufferWidth = window->w; |
684 data->pparams.BackBufferHeight = window->h; | 684 data->pparams.BackBufferHeight = window->h; |
685 if (window->flags & SDL_WINDOW_FULLSCREEN) { | 685 if (window->flags & SDL_WINDOW_FULLSCREEN) { |
686 data->pparams.BackBufferFormat = | 686 data->pparams.BackBufferFormat = |
693 | 693 |
694 static int | 694 static int |
695 D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) | 695 D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) |
696 { | 696 { |
697 D3D_RenderData *renderdata = (D3D_RenderData *) renderer->driverdata; | 697 D3D_RenderData *renderdata = (D3D_RenderData *) renderer->driverdata; |
698 SDL_Window *window = SDL_GetWindowFromID(renderer->window); | 698 SDL_Window *window = renderer->window; |
699 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); | 699 SDL_VideoDisplay *display = window->display; |
700 Uint32 display_format = display->current_mode.format; | 700 Uint32 display_format = display->current_mode.format; |
701 D3D_TextureData *data; | 701 D3D_TextureData *data; |
702 HRESULT result; | 702 HRESULT result; |
703 | 703 |
704 data = (D3D_TextureData *) SDL_calloc(1, sizeof(*data)); | 704 data = (D3D_TextureData *) SDL_calloc(1, sizeof(*data)); |
1396 static int | 1396 static int |
1397 D3D_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, | 1397 D3D_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, |
1398 Uint32 format, void * pixels, int pitch) | 1398 Uint32 format, void * pixels, int pitch) |
1399 { | 1399 { |
1400 D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata; | 1400 D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata; |
1401 SDL_Window *window = SDL_GetWindowFromID(renderer->window); | 1401 SDL_Window *window = renderer->window; |
1402 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); | 1402 SDL_VideoDisplay *display = window->display; |
1403 D3DSURFACE_DESC desc; | 1403 D3DSURFACE_DESC desc; |
1404 LPDIRECT3DSURFACE9 backBuffer; | 1404 LPDIRECT3DSURFACE9 backBuffer; |
1405 LPDIRECT3DSURFACE9 surface; | 1405 LPDIRECT3DSURFACE9 surface; |
1406 RECT d3drect; | 1406 RECT d3drect; |
1407 D3DLOCKED_RECT locked; | 1407 D3DLOCKED_RECT locked; |