comparison src/video/win32/SDL_gdirender.c @ 2810:27cb878a278e

Implemented the X11 (non-OpenGL) renderer, no alpha or scaling available.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 30 Nov 2008 21:58:23 +0000
parents 6bacfecbf27e
children 7af2419ad5b0
comparison
equal deleted inserted replaced
2809:7e257c3a3bf0 2810:27cb878a278e
53 int pitch); 53 int pitch);
54 static int GDI_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, 54 static int GDI_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
55 const SDL_Rect * rect, int markDirty, 55 const SDL_Rect * rect, int markDirty,
56 void **pixels, int *pitch); 56 void **pixels, int *pitch);
57 static void GDI_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture); 57 static void GDI_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
58 static void GDI_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture,
59 int numrects, const SDL_Rect * rects);
60 static int GDI_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b, 58 static int GDI_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b,
61 Uint8 a, const SDL_Rect * rect); 59 Uint8 a, const SDL_Rect * rect);
62 static int GDI_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, 60 static int GDI_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
63 const SDL_Rect * srcrect, const SDL_Rect * dstrect); 61 const SDL_Rect * srcrect, const SDL_Rect * dstrect);
64 static void GDI_RenderPresent(SDL_Renderer * renderer); 62 static void GDI_RenderPresent(SDL_Renderer * renderer);
76 SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_ACCELERATED), 74 SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_ACCELERATED),
77 (SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_ALPHA), 75 (SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_ALPHA),
78 (SDL_TEXTUREBLENDMODE_NONE | SDL_TEXTUREBLENDMODE_MASK | 76 (SDL_TEXTUREBLENDMODE_NONE | SDL_TEXTUREBLENDMODE_MASK |
79 SDL_TEXTUREBLENDMODE_BLEND), 77 SDL_TEXTUREBLENDMODE_BLEND),
80 (SDL_TEXTURESCALEMODE_NONE | SDL_TEXTURESCALEMODE_FAST), 78 (SDL_TEXTURESCALEMODE_NONE | SDL_TEXTURESCALEMODE_FAST),
81 11, 79 12,
82 { 80 {
83 SDL_PIXELFORMAT_INDEX8, 81 SDL_PIXELFORMAT_INDEX8,
84 SDL_PIXELFORMAT_RGB555, 82 SDL_PIXELFORMAT_RGB555,
85 SDL_PIXELFORMAT_RGB565, 83 SDL_PIXELFORMAT_RGB565,
86 SDL_PIXELFORMAT_RGB888, 84 SDL_PIXELFORMAT_RGB888,
88 SDL_PIXELFORMAT_ARGB8888, 86 SDL_PIXELFORMAT_ARGB8888,
89 SDL_PIXELFORMAT_RGBA8888, 87 SDL_PIXELFORMAT_RGBA8888,
90 SDL_PIXELFORMAT_ABGR8888, 88 SDL_PIXELFORMAT_ABGR8888,
91 SDL_PIXELFORMAT_BGRA8888, 89 SDL_PIXELFORMAT_BGRA8888,
92 SDL_PIXELFORMAT_YUY2, 90 SDL_PIXELFORMAT_YUY2,
93 SDL_PIXELFORMAT_UYVY}, 91 SDL_PIXELFORMAT_UYVY,
92 SDL_PIXELFORMAT_YVYU},
94 0, 93 0,
95 0} 94 0}
96 }; 95 };
97 96
98 typedef struct 97 typedef struct
171 renderer->SetTextureBlendMode = GDI_SetTextureBlendMode; 170 renderer->SetTextureBlendMode = GDI_SetTextureBlendMode;
172 renderer->SetTextureScaleMode = GDI_SetTextureScaleMode; 171 renderer->SetTextureScaleMode = GDI_SetTextureScaleMode;
173 renderer->UpdateTexture = GDI_UpdateTexture; 172 renderer->UpdateTexture = GDI_UpdateTexture;
174 renderer->LockTexture = GDI_LockTexture; 173 renderer->LockTexture = GDI_LockTexture;
175 renderer->UnlockTexture = GDI_UnlockTexture; 174 renderer->UnlockTexture = GDI_UnlockTexture;
176 renderer->DirtyTexture = GDI_DirtyTexture;
177 renderer->RenderFill = GDI_RenderFill; 175 renderer->RenderFill = GDI_RenderFill;
178 renderer->RenderCopy = GDI_RenderCopy; 176 renderer->RenderCopy = GDI_RenderCopy;
179 renderer->RenderPresent = GDI_RenderPresent; 177 renderer->RenderPresent = GDI_RenderPresent;
180 renderer->DestroyTexture = GDI_DestroyTexture; 178 renderer->DestroyTexture = GDI_DestroyTexture;
181 renderer->DestroyRenderer = GDI_DestroyRenderer; 179 renderer->DestroyRenderer = GDI_DestroyRenderer;
272 } 270 }
273 } 271 }
274 if (n > 0) { 272 if (n > 0) {
275 SelectObject(data->render_hdc, data->hbm[0]); 273 SelectObject(data->render_hdc, data->hbm[0]);
276 } 274 }
275 data->current_hbm = 0;
276
277 return 0; 277 return 0;
278 } 278 }
279 279
280 static int 280 static int
281 GDI_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) 281 GDI_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
566 SDL_SW_UnlockYUVTexture(data->yuv); 566 SDL_SW_UnlockYUVTexture(data->yuv);
567 UpdateYUVTextureData(texture); 567 UpdateYUVTextureData(texture);
568 } 568 }
569 } 569 }
570 570
571 static void
572 GDI_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture, int numrects,
573 const SDL_Rect * rects)
574 {
575 }
576
577 static int 571 static int
578 GDI_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a, 572 GDI_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a,
579 const SDL_Rect * rect) 573 const SDL_Rect * rect)
580 { 574 {
581 GDI_RenderData *data = (GDI_RenderData *) renderer->driverdata; 575 GDI_RenderData *data = (GDI_RenderData *) renderer->driverdata;