Mercurial > sdl-ios-xcode
comparison src/video/win32/SDL_gdirender.c @ 1965:a788656ca29a
SDL constants are all uppercase.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 05 Aug 2006 17:09:42 +0000 |
parents | 69217fdd2c0a |
children | ccef0d0c40c6 |
comparison
equal
deleted
inserted
replaced
1964:071b6598d48f | 1965:a788656ca29a |
---|---|
63 | 63 |
64 SDL_RenderDriver GDI_RenderDriver = { | 64 SDL_RenderDriver GDI_RenderDriver = { |
65 GDI_CreateRenderer, | 65 GDI_CreateRenderer, |
66 { | 66 { |
67 "gdi", | 67 "gdi", |
68 (SDL_Renderer_SingleBuffer | SDL_Renderer_PresentCopy | | 68 (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY | |
69 SDL_Renderer_PresentFlip2 | SDL_Renderer_PresentFlip3 | | 69 SDL_RENDERER_PRESENTFLIP2 | sDL_RENDERER_PRESENTFLIP3 | |
70 SDL_Renderer_PresentDiscard | SDL_Renderer_Accelerated), | 70 SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_ACCELERATED), |
71 (SDL_TextureBlendMode_None | SDL_TextureBlendMode_Mask | | 71 (SDL_TEXTUREBLENDMODE_NONE | SDL_TEXTUREBLENDMODE_MASK | |
72 SDL_TextureBlendMode_Blend), | 72 SDL_TEXTUREBLENDMODE_BLEND), |
73 (SDL_TextureScaleMode_None | SDL_TextureScaleMode_Fast), | 73 (SDL_TEXTURESCALEMODE_NONE | SDL_TEXTURESCALEMODE_FAST), |
74 11, | 74 11, |
75 { | 75 { |
76 SDL_PixelFormat_Index8, | 76 SDL_PIXELFORMAT_INDEX8, |
77 SDL_PixelFormat_RGB555, | 77 SDL_PIXELFORMAT_RGB555, |
78 SDL_PixelFormat_RGB565, | 78 SDL_PIXELFORMAT_RGB565, |
79 SDL_PixelFormat_RGB888, | 79 SDL_PIXELFORMAT_RGB888, |
80 SDL_PixelFormat_BGR888, | 80 SDL_PIXELFORMAT_BGR888, |
81 SDL_PixelFormat_ARGB8888, | 81 SDL_PIXELFORMAT_ARGB8888, |
82 SDL_PixelFormat_RGBA8888, | 82 SDL_PIXELFORMAT_RGBA8888, |
83 SDL_PixelFormat_ABGR8888, | 83 SDL_PIXELFORMAT_ABGR8888, |
84 SDL_PixelFormat_BGRA8888, | 84 SDL_PIXELFORMAT_BGRA8888, |
85 SDL_PixelFormat_YUY2, | 85 SDL_PIXELFORMAT_YUY2, |
86 SDL_PixelFormat_UYVY}, | 86 SDL_PIXELFORMAT_UYVY}, |
87 0, | 87 0, |
88 0} | 88 0} |
89 }; | 89 }; |
90 | 90 |
91 typedef struct | 91 typedef struct |
170 renderer->DestroyRenderer = GDI_DestroyRenderer; | 170 renderer->DestroyRenderer = GDI_DestroyRenderer; |
171 renderer->info = GDI_RenderDriver.info; | 171 renderer->info = GDI_RenderDriver.info; |
172 renderer->window = window->id; | 172 renderer->window = window->id; |
173 renderer->driverdata = data; | 173 renderer->driverdata = data; |
174 | 174 |
175 renderer->info.flags = SDL_Renderer_Accelerated; | 175 renderer->info.flags = SDL_RENDERER_ACCELERATED; |
176 | 176 |
177 data->hwnd = windowdata->hwnd; | 177 data->hwnd = windowdata->hwnd; |
178 data->window_hdc = windowdata->hdc; | 178 data->window_hdc = windowdata->hdc; |
179 data->render_hdc = CreateCompatibleDC(data->window_hdc); | 179 data->render_hdc = CreateCompatibleDC(data->window_hdc); |
180 data->memory_hdc = CreateCompatibleDC(data->window_hdc); | 180 data->memory_hdc = CreateCompatibleDC(data->window_hdc); |
192 hbm = CreateCompatibleBitmap(data->window_hdc, 1, 1); | 192 hbm = CreateCompatibleBitmap(data->window_hdc, 1, 1); |
193 GetDIBits(data->window_hdc, hbm, 0, 1, NULL, data->bmi, DIB_RGB_COLORS); | 193 GetDIBits(data->window_hdc, hbm, 0, 1, NULL, data->bmi, DIB_RGB_COLORS); |
194 GetDIBits(data->window_hdc, hbm, 0, 1, NULL, data->bmi, DIB_RGB_COLORS); | 194 GetDIBits(data->window_hdc, hbm, 0, 1, NULL, data->bmi, DIB_RGB_COLORS); |
195 DeleteObject(hbm); | 195 DeleteObject(hbm); |
196 | 196 |
197 if (flags & SDL_Renderer_SingleBuffer) { | 197 if (flags & SDL_RENDERER_SINGLEBUFFER) { |
198 renderer->info.flags |= | 198 renderer->info.flags |= |
199 (SDL_Renderer_SingleBuffer | SDL_Renderer_PresentCopy); | 199 (SDL_RENDERER_SINGLEBUFFER | sDL_RENDERER_PRESENTCOPY); |
200 n = 0; | 200 n = 0; |
201 } else if (flags & SDL_Renderer_PresentFlip2) { | 201 } else if (flags & SDL_RENDERER_PRESENTFLIP2) { |
202 renderer->info.flags |= SDL_Renderer_PresentFlip2; | 202 renderer->info.flags |= SDL_RENDERER_PRESENTFLIP2; |
203 n = 2; | 203 n = 2; |
204 } else if (flags & SDL_Renderer_PresentFlip3) { | 204 } else if (flags & SDL_RENDERER_PRESENTFLIP3) { |
205 renderer->info.flags |= SDL_Renderer_PresentFlip3; | 205 renderer->info.flags |= SDL_RENDERER_PRESENTFLIP3; |
206 n = 3; | 206 n = 3; |
207 } else { | 207 } else { |
208 renderer->info.flags |= SDL_Renderer_PresentCopy; | 208 renderer->info.flags |= SDL_RENDERER_PRESENTCOPY; |
209 n = 1; | 209 n = 1; |
210 } | 210 } |
211 for (i = 0; i < n; ++i) { | 211 for (i = 0; i < n; ++i) { |
212 data->hbm[i] = | 212 data->hbm[i] = |
213 CreateCompatibleBitmap(data->window_hdc, window->w, window->h); | 213 CreateCompatibleBitmap(data->window_hdc, window->w, window->h); |
255 } else { | 255 } else { |
256 data->format = texture->format; | 256 data->format = texture->format; |
257 } | 257 } |
258 data->pitch = (texture->w * SDL_BYTESPERPIXEL(data->format)); | 258 data->pitch = (texture->w * SDL_BYTESPERPIXEL(data->format)); |
259 | 259 |
260 if (data->yuv || texture->access == SDL_TextureAccess_Local | 260 if (data->yuv || texture->access == SDL_TEXTUREACCESS_LOCAL |
261 || texture->format != SDL_GetCurrentDisplayMode()->format) { | 261 || texture->format != SDL_GetCurrentDisplayMode()->format) { |
262 int bmi_size; | 262 int bmi_size; |
263 LPBITMAPINFO bmi; | 263 LPBITMAPINFO bmi; |
264 | 264 |
265 bmi_size = sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD); | 265 bmi_size = sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD); |
535 SelectObject(data->memory_hdc, texturedata->hbm); | 535 SelectObject(data->memory_hdc, texturedata->hbm); |
536 if (texturedata->hpal) { | 536 if (texturedata->hpal) { |
537 SelectPalette(data->memory_hdc, texturedata->hpal, TRUE); | 537 SelectPalette(data->memory_hdc, texturedata->hpal, TRUE); |
538 RealizePalette(data->memory_hdc); | 538 RealizePalette(data->memory_hdc); |
539 } | 539 } |
540 if (blendMode & (SDL_TextureBlendMode_Mask | SDL_TextureBlendMode_Blend)) { | 540 if (blendMode & (SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND)) { |
541 static BLENDFUNCTION blendFunc = { | 541 static BLENDFUNCTION blendFunc = { |
542 AC_SRC_OVER, | 542 AC_SRC_OVER, |
543 0, | 543 0, |
544 255, | 544 255, |
545 AC_SRC_ALPHA | 545 AC_SRC_ALPHA |
579 { | 579 { |
580 GDI_RenderData *data = (GDI_RenderData *) renderer->driverdata; | 580 GDI_RenderData *data = (GDI_RenderData *) renderer->driverdata; |
581 SDL_DirtyRect *dirty; | 581 SDL_DirtyRect *dirty; |
582 | 582 |
583 /* Send the data to the display */ | 583 /* Send the data to the display */ |
584 if (!(renderer->info.flags & SDL_Renderer_SingleBuffer)) { | 584 if (!(renderer->info.flags & SDL_RENDERER_SINGLEBUFFER)) { |
585 for (dirty = data->dirty.list; dirty; dirty = dirty->next) { | 585 for (dirty = data->dirty.list; dirty; dirty = dirty->next) { |
586 const SDL_Rect *rect = &dirty->rect; | 586 const SDL_Rect *rect = &dirty->rect; |
587 BitBlt(data->window_hdc, rect->x, rect->y, rect->w, rect->h, | 587 BitBlt(data->window_hdc, rect->x, rect->y, rect->w, rect->h, |
588 data->render_hdc, rect->x, rect->y, SRCCOPY); | 588 data->render_hdc, rect->x, rect->y, SRCCOPY); |
589 } | 589 } |
590 SDL_ClearDirtyRects(&data->dirty); | 590 SDL_ClearDirtyRects(&data->dirty); |
591 } | 591 } |
592 | 592 |
593 /* Update the flipping chain, if any */ | 593 /* Update the flipping chain, if any */ |
594 if (renderer->info.flags & SDL_Renderer_PresentFlip2) { | 594 if (renderer->info.flags & SDL_RENDERER_PRESENTFLIP2) { |
595 data->current_hbm = (data->current_hbm + 1) % 2; | 595 data->current_hbm = (data->current_hbm + 1) % 2; |
596 SelectObject(data->render_hdc, data->hbm[data->current_hbm]); | 596 SelectObject(data->render_hdc, data->hbm[data->current_hbm]); |
597 } else if (renderer->info.flags & SDL_Renderer_PresentFlip3) { | 597 } else if (renderer->info.flags & SDL_RENDERER_PRESENTFLIP3) { |
598 data->current_hbm = (data->current_hbm + 1) % 3; | 598 data->current_hbm = (data->current_hbm + 1) % 3; |
599 SelectObject(data->render_hdc, data->hbm[data->current_hbm]); | 599 SelectObject(data->render_hdc, data->hbm[data->current_hbm]); |
600 } | 600 } |
601 } | 601 } |
602 | 602 |