Mercurial > sdl-ios-xcode
comparison src/video/win32/SDL_gdirender.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 |
---|---|
205 renderer->RenderWritePixels = GDI_RenderWritePixels; | 205 renderer->RenderWritePixels = GDI_RenderWritePixels; |
206 renderer->RenderPresent = GDI_RenderPresent; | 206 renderer->RenderPresent = GDI_RenderPresent; |
207 renderer->DestroyTexture = GDI_DestroyTexture; | 207 renderer->DestroyTexture = GDI_DestroyTexture; |
208 renderer->DestroyRenderer = GDI_DestroyRenderer; | 208 renderer->DestroyRenderer = GDI_DestroyRenderer; |
209 renderer->info = GDI_RenderDriver.info; | 209 renderer->info = GDI_RenderDriver.info; |
210 renderer->window = window->id; | 210 renderer->window = window; |
211 renderer->driverdata = data; | 211 renderer->driverdata = data; |
212 | 212 |
213 renderer->info.flags = SDL_RENDERER_ACCELERATED; | 213 renderer->info.flags = SDL_RENDERER_ACCELERATED; |
214 | 214 |
215 data->hwnd = windowdata->hwnd; | 215 data->hwnd = windowdata->hwnd; |
272 | 272 |
273 static int | 273 static int |
274 GDI_DisplayModeChanged(SDL_Renderer * renderer) | 274 GDI_DisplayModeChanged(SDL_Renderer * renderer) |
275 { | 275 { |
276 GDI_RenderData *data = (GDI_RenderData *) renderer->driverdata; | 276 GDI_RenderData *data = (GDI_RenderData *) renderer->driverdata; |
277 SDL_Window *window = SDL_GetWindowFromID(renderer->window); | 277 SDL_Window *window = renderer->window; |
278 int i, n; | 278 int i, n; |
279 | 279 |
280 if (renderer->info.flags & SDL_RENDERER_SINGLEBUFFER) { | 280 if (renderer->info.flags & SDL_RENDERER_SINGLEBUFFER) { |
281 n = 0; | 281 n = 0; |
282 } else if (renderer->info.flags & SDL_RENDERER_PRESENTFLIP2) { | 282 } else if (renderer->info.flags & SDL_RENDERER_PRESENTFLIP2) { |
376 | 376 |
377 static int | 377 static int |
378 GDI_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) | 378 GDI_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) |
379 { | 379 { |
380 GDI_RenderData *renderdata = (GDI_RenderData *) renderer->driverdata; | 380 GDI_RenderData *renderdata = (GDI_RenderData *) renderer->driverdata; |
381 SDL_Window *window = SDL_GetWindowFromID(renderer->window); | 381 SDL_Window *window = renderer->window; |
382 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); | 382 SDL_VideoDisplay *display = window->display; |
383 GDI_TextureData *data; | 383 GDI_TextureData *data; |
384 | 384 |
385 data = (GDI_TextureData *) SDL_calloc(1, sizeof(*data)); | 385 data = (GDI_TextureData *) SDL_calloc(1, sizeof(*data)); |
386 if (!data) { | 386 if (!data) { |
387 SDL_OutOfMemory(); | 387 SDL_OutOfMemory(); |
697 int i; | 697 int i; |
698 COLORREF color; | 698 COLORREF color; |
699 | 699 |
700 if (data->makedirty) { | 700 if (data->makedirty) { |
701 /* Get the smallest rectangle that contains everything */ | 701 /* Get the smallest rectangle that contains everything */ |
702 SDL_Window *window = SDL_GetWindowFromID(renderer->window); | 702 SDL_Window *window = renderer->window; |
703 SDL_Rect rect; | 703 SDL_Rect rect; |
704 | 704 |
705 rect.x = 0; | 705 rect.x = 0; |
706 rect.y = 0; | 706 rect.y = 0; |
707 rect.w = window->w; | 707 rect.w = window->w; |
730 HPEN pen; | 730 HPEN pen; |
731 BOOL status; | 731 BOOL status; |
732 | 732 |
733 if (data->makedirty) { | 733 if (data->makedirty) { |
734 /* Get the smallest rectangle that contains everything */ | 734 /* Get the smallest rectangle that contains everything */ |
735 SDL_Window *window = SDL_GetWindowFromID(renderer->window); | 735 SDL_Window *window = renderer->window; |
736 SDL_Rect clip, rect; | 736 SDL_Rect clip, rect; |
737 | 737 |
738 clip.x = 0; | 738 clip.x = 0; |
739 clip.y = 0; | 739 clip.y = 0; |
740 clip.w = window->w; | 740 clip.w = window->w; |
785 HPEN pen; | 785 HPEN pen; |
786 POINT vertices[5]; | 786 POINT vertices[5]; |
787 int i, status = 1; | 787 int i, status = 1; |
788 | 788 |
789 if (data->makedirty) { | 789 if (data->makedirty) { |
790 SDL_Window *window = SDL_GetWindowFromID(renderer->window); | 790 SDL_Window *window = renderer->window; |
791 SDL_Rect clip, rect; | 791 SDL_Rect clip, rect; |
792 | 792 |
793 clip.x = 0; | 793 clip.x = 0; |
794 clip.y = 0; | 794 clip.y = 0; |
795 clip.w = window->w; | 795 clip.w = window->w; |
842 RECT rc; | 842 RECT rc; |
843 HBRUSH brush; | 843 HBRUSH brush; |
844 int i, status = 1; | 844 int i, status = 1; |
845 | 845 |
846 if (data->makedirty) { | 846 if (data->makedirty) { |
847 SDL_Window *window = SDL_GetWindowFromID(renderer->window); | 847 SDL_Window *window = renderer->window; |
848 SDL_Rect clip, rect; | 848 SDL_Rect clip, rect; |
849 | 849 |
850 clip.x = 0; | 850 clip.x = 0; |
851 clip.y = 0; | 851 clip.y = 0; |
852 clip.w = window->w; | 852 clip.w = window->w; |
941 static int | 941 static int |
942 GDI_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, | 942 GDI_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, |
943 Uint32 format, void * pixels, int pitch) | 943 Uint32 format, void * pixels, int pitch) |
944 { | 944 { |
945 GDI_RenderData *renderdata = (GDI_RenderData *) renderer->driverdata; | 945 GDI_RenderData *renderdata = (GDI_RenderData *) renderer->driverdata; |
946 SDL_Window *window = SDL_GetWindowFromID(renderer->window); | 946 SDL_Window *window = renderer->window; |
947 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); | 947 SDL_VideoDisplay *display = window->display; |
948 struct { | 948 struct { |
949 HBITMAP hbm; | 949 HBITMAP hbm; |
950 void *pixels; | 950 void *pixels; |
951 int pitch; | 951 int pitch; |
952 Uint32 format; | 952 Uint32 format; |
982 static int | 982 static int |
983 GDI_RenderWritePixels(SDL_Renderer * renderer, const SDL_Rect * rect, | 983 GDI_RenderWritePixels(SDL_Renderer * renderer, const SDL_Rect * rect, |
984 Uint32 format, const void * pixels, int pitch) | 984 Uint32 format, const void * pixels, int pitch) |
985 { | 985 { |
986 GDI_RenderData *renderdata = (GDI_RenderData *) renderer->driverdata; | 986 GDI_RenderData *renderdata = (GDI_RenderData *) renderer->driverdata; |
987 SDL_Window *window = SDL_GetWindowFromID(renderer->window); | 987 SDL_Window *window = renderer->window; |
988 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window); | 988 SDL_VideoDisplay *display = window->display; |
989 struct { | 989 struct { |
990 HBITMAP hbm; | 990 HBITMAP hbm; |
991 void *pixels; | 991 void *pixels; |
992 int pitch; | 992 int pitch; |
993 Uint32 format; | 993 Uint32 format; |