Mercurial > sdl-ios-xcode
comparison src/video/directfb/SDL_DirectFB_render.c @ 4636:b196d2758026
Couriersud to Sam
Hi Sam,
20100815_1.diff contains updates for the directfb driver:
- more documentation, mainly on software OpenGL in README.directfb
- Revised error handling leading to leaner code
- Improved/fixed OpenGL handling of multiple contexts.
- Made the built-in simple window manager handle OpenGL windows.
- Rewrote pixelformat mapping - this was quite ugly before.
Well, all software GL, but working :-)
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 16 Aug 2010 09:04:55 -0700 |
parents | 25b9cd8bdc30 |
children | aa8888658021 |
comparison
equal
deleted
inserted
replaced
4635:0a07d002f10b | 4636:b196d2758026 |
---|---|
70 static void DirectFB_UnlockTexture(SDL_Renderer * renderer, | 70 static void DirectFB_UnlockTexture(SDL_Renderer * renderer, |
71 SDL_Texture * texture); | 71 SDL_Texture * texture); |
72 static void DirectFB_DirtyTexture(SDL_Renderer * renderer, | 72 static void DirectFB_DirtyTexture(SDL_Renderer * renderer, |
73 SDL_Texture * texture, int numrects, | 73 SDL_Texture * texture, int numrects, |
74 const SDL_Rect * rects); | 74 const SDL_Rect * rects); |
75 static int DirectFB_SetDrawBlendMode(SDL_Renderer * renderer); | |
75 static int DirectFB_RenderDrawPoints(SDL_Renderer * renderer, | 76 static int DirectFB_RenderDrawPoints(SDL_Renderer * renderer, |
76 const SDL_Point * points, int count); | 77 const SDL_Point * points, int count); |
77 static int DirectFB_RenderDrawLines(SDL_Renderer * renderer, | 78 static int DirectFB_RenderDrawLines(SDL_Renderer * renderer, |
78 const SDL_Point * points, int count); | 79 const SDL_Point * points, int count); |
79 static int DirectFB_RenderDrawRects(SDL_Renderer * renderer, | 80 static int DirectFB_RenderDrawRects(SDL_Renderer * renderer, |
192 switch (blendMode) { | 193 switch (blendMode) { |
193 case SDL_BLENDMODE_NONE: | 194 case SDL_BLENDMODE_NONE: |
194 /**< No blending */ | 195 /**< No blending */ |
195 data->blitFlags = DSBLIT_NOFX; | 196 data->blitFlags = DSBLIT_NOFX; |
196 data->drawFlags = DSDRAW_NOFX; | 197 data->drawFlags = DSDRAW_NOFX; |
197 destsurf->SetSrcBlendFunction(destsurf, DSBF_ONE); | 198 SDL_DFB_CHECK(destsurf->SetSrcBlendFunction(destsurf, DSBF_ONE)); |
198 destsurf->SetDstBlendFunction(destsurf, DSBF_ZERO); | 199 SDL_DFB_CHECK(destsurf->SetDstBlendFunction(destsurf, DSBF_ZERO)); |
199 break; | 200 break; |
200 case SDL_BLENDMODE_MASK: | 201 case SDL_BLENDMODE_MASK: |
201 data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL; | 202 data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL; |
202 data->drawFlags = DSDRAW_BLEND; | 203 data->drawFlags = DSDRAW_BLEND; |
203 destsurf->SetSrcBlendFunction(destsurf, DSBF_SRCALPHA); | 204 SDL_DFB_CHECK(destsurf->SetSrcBlendFunction(destsurf, DSBF_SRCALPHA)); |
204 destsurf->SetDstBlendFunction(destsurf, DSBF_INVSRCALPHA); | 205 SDL_DFB_CHECK(destsurf->SetDstBlendFunction(destsurf, DSBF_INVSRCALPHA)); |
205 break; | 206 break; |
206 case SDL_BLENDMODE_BLEND: | 207 case SDL_BLENDMODE_BLEND: |
207 data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL; | 208 data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL; |
208 data->drawFlags = DSDRAW_BLEND; | 209 data->drawFlags = DSDRAW_BLEND; |
209 destsurf->SetSrcBlendFunction(destsurf, DSBF_SRCALPHA); | 210 SDL_DFB_CHECK(destsurf->SetSrcBlendFunction(destsurf, DSBF_SRCALPHA)); |
210 destsurf->SetDstBlendFunction(destsurf, DSBF_INVSRCALPHA); | 211 SDL_DFB_CHECK(destsurf->SetDstBlendFunction(destsurf, DSBF_INVSRCALPHA)); |
211 break; | 212 break; |
212 case SDL_BLENDMODE_ADD: | 213 case SDL_BLENDMODE_ADD: |
213 data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL; | 214 data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL; |
214 data->drawFlags = DSDRAW_BLEND; | 215 data->drawFlags = DSDRAW_BLEND; |
215 // FIXME: SRCALPHA kills performance on radeon ... | 216 // FIXME: SRCALPHA kills performance on radeon ... |
216 // It will be cheaper to copy the surface to | 217 // It will be cheaper to copy the surface to |
217 // a temporay surface and premultiply | 218 // a temporay surface and premultiply |
218 if (source && TextureHasAlpha(source)) | 219 if (source && TextureHasAlpha(source)) |
219 destsurf->SetSrcBlendFunction(destsurf, DSBF_SRCALPHA); | 220 SDL_DFB_CHECK(destsurf->SetSrcBlendFunction(destsurf, DSBF_SRCALPHA)); |
220 else | 221 else |
221 destsurf->SetSrcBlendFunction(destsurf, DSBF_ONE); | 222 SDL_DFB_CHECK(destsurf->SetSrcBlendFunction(destsurf, DSBF_ONE)); |
222 destsurf->SetDstBlendFunction(destsurf, DSBF_ONE); | 223 SDL_DFB_CHECK(destsurf->SetDstBlendFunction(destsurf, DSBF_ONE)); |
223 break; | 224 break; |
224 case SDL_BLENDMODE_MOD: | 225 case SDL_BLENDMODE_MOD: |
225 data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL; | 226 data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL; |
226 data->drawFlags = DSDRAW_BLEND; | 227 data->drawFlags = DSDRAW_BLEND; |
227 destsurf->SetSrcBlendFunction(destsurf, DSBF_DESTCOLOR); | 228 SDL_DFB_CHECK(destsurf->SetSrcBlendFunction(destsurf, DSBF_DESTCOLOR)); |
228 destsurf->SetDstBlendFunction(destsurf, DSBF_ZERO); | 229 SDL_DFB_CHECK(destsurf->SetDstBlendFunction(destsurf, DSBF_ZERO)); |
229 break; | 230 break; |
230 } | 231 } |
231 data->lastBlendMode = blendMode; | 232 data->lastBlendMode = blendMode; |
232 } | 233 } |
233 } | 234 } |
248 #if USE_DISPLAY_PALETTE | 249 #if USE_DISPLAY_PALETTE |
249 DirectFB_RenderData *data = (DirectFB_RenderData *) userdata; | 250 DirectFB_RenderData *data = (DirectFB_RenderData *) userdata; |
250 SDL_DFB_WINDOWSURFACE(data->window); | 251 SDL_DFB_WINDOWSURFACE(data->window); |
251 IDirectFBPalette *surfpal; | 252 IDirectFBPalette *surfpal; |
252 | 253 |
253 int ret; | |
254 int i; | 254 int i; |
255 int ncolors; | 255 int ncolors; |
256 DFBColor entries[256]; | 256 DFBColor entries[256]; |
257 | 257 |
258 SDL_DFB_CHECKERR(destsurf->GetPalette(destsurf, &surfpal)); | 258 SDL_DFB_CHECKERR(destsurf->GetPalette(destsurf, &surfpal)); |
281 { | 281 { |
282 SDL_DFB_WINDOWDATA(window); | 282 SDL_DFB_WINDOWDATA(window); |
283 SDL_VideoDisplay *display = window->display; | 283 SDL_VideoDisplay *display = window->display; |
284 SDL_Renderer *renderer = NULL; | 284 SDL_Renderer *renderer = NULL; |
285 DirectFB_RenderData *data = NULL; | 285 DirectFB_RenderData *data = NULL; |
286 DFBResult ret; | |
287 DFBSurfaceCapabilities scaps; | 286 DFBSurfaceCapabilities scaps; |
288 char *p; | 287 char *p; |
289 | 288 |
290 SDL_DFB_CALLOC(renderer, 1, sizeof(*renderer)); | 289 SDL_DFB_CALLOC(renderer, 1, sizeof(*renderer)); |
291 SDL_DFB_CALLOC(data, 1, sizeof(*data)); | 290 SDL_DFB_CALLOC(data, 1, sizeof(*data)); |
304 renderer->LockTexture = DirectFB_LockTexture; | 303 renderer->LockTexture = DirectFB_LockTexture; |
305 renderer->UnlockTexture = DirectFB_UnlockTexture; | 304 renderer->UnlockTexture = DirectFB_UnlockTexture; |
306 renderer->DirtyTexture = DirectFB_DirtyTexture; | 305 renderer->DirtyTexture = DirectFB_DirtyTexture; |
307 renderer->RenderDrawPoints = DirectFB_RenderDrawPoints; | 306 renderer->RenderDrawPoints = DirectFB_RenderDrawPoints; |
308 renderer->RenderDrawLines = DirectFB_RenderDrawLines; | 307 renderer->RenderDrawLines = DirectFB_RenderDrawLines; |
308 /* SetDrawColor - no needed */ | |
309 renderer->SetDrawBlendMode = DirectFB_SetDrawBlendMode; | |
309 renderer->RenderFillRects = DirectFB_RenderFillRects; | 310 renderer->RenderFillRects = DirectFB_RenderFillRects; |
310 renderer->RenderDrawRects = DirectFB_RenderDrawRects; | 311 renderer->RenderDrawRects = DirectFB_RenderDrawRects; |
312 /* RenderDrawEllipse - no reference implementation yet */ | |
313 /* RenderFillEllipse - no reference implementation yet */ | |
311 renderer->RenderCopy = DirectFB_RenderCopy; | 314 renderer->RenderCopy = DirectFB_RenderCopy; |
312 renderer->RenderPresent = DirectFB_RenderPresent; | 315 renderer->RenderPresent = DirectFB_RenderPresent; |
316 /* RenderReadPixels is difficult to implement */ | |
317 /* RenderWritePixels is difficult to implement */ | |
313 renderer->DestroyTexture = DirectFB_DestroyTexture; | 318 renderer->DestroyTexture = DirectFB_DestroyTexture; |
314 renderer->DestroyRenderer = DirectFB_DestroyRenderer; | 319 renderer->DestroyRenderer = DirectFB_DestroyRenderer; |
315 renderer->info = DirectFB_RenderDriver.info; | 320 renderer->info = DirectFB_RenderDriver.info; |
316 renderer->window = window; /* SDL window */ | 321 renderer->window = window; /* SDL window */ |
317 renderer->driverdata = data; | 322 renderer->driverdata = data; |
322 data->window = window; | 327 data->window = window; |
323 | 328 |
324 data->flipflags = DSFLIP_PIPELINE | DSFLIP_BLIT; | 329 data->flipflags = DSFLIP_PIPELINE | DSFLIP_BLIT; |
325 | 330 |
326 if (flags & SDL_RENDERER_PRESENTVSYNC) { | 331 if (flags & SDL_RENDERER_PRESENTVSYNC) { |
327 data->flipflags |= DSFLIP_WAITFORSYNC; | 332 data->flipflags |= DSFLIP_WAITFORSYNC | DSFLIP_ONSYNC; |
328 renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; | 333 renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; |
329 } else | 334 } else |
330 data->flipflags |= DSFLIP_ONSYNC; | 335 data->flipflags |= DSFLIP_ONSYNC; |
331 | 336 |
332 SDL_DFB_CHECKERR(windata->surface-> | 337 SDL_DFB_CHECKERR(windata->surface-> |
394 return DSPF_UNKNOWN; | 399 return DSPF_UNKNOWN; |
395 case SDL_PIXELFORMAT_INDEX1MSB: | 400 case SDL_PIXELFORMAT_INDEX1MSB: |
396 return DSPF_UNKNOWN; | 401 return DSPF_UNKNOWN; |
397 case SDL_PIXELFORMAT_INDEX4MSB: | 402 case SDL_PIXELFORMAT_INDEX4MSB: |
398 return DSPF_UNKNOWN; | 403 return DSPF_UNKNOWN; |
404 #if (DFB_VERSION_ATLEAST(1,2,0)) | |
399 case SDL_PIXELFORMAT_RGB444: | 405 case SDL_PIXELFORMAT_RGB444: |
400 #if (DFB_VERSION_ATLEAST(1,2,0)) | |
401 return DSPF_RGB444; | 406 return DSPF_RGB444; |
402 #else | |
403 return DSPF_UNKNOWN; | |
404 #endif | 407 #endif |
405 case SDL_PIXELFORMAT_BGR24: | 408 case SDL_PIXELFORMAT_BGR24: |
406 return DSPF_UNKNOWN; | 409 return DSPF_UNKNOWN; |
407 case SDL_PIXELFORMAT_BGR888: | 410 case SDL_PIXELFORMAT_BGR888: |
408 return DSPF_UNKNOWN; | 411 return DSPF_UNKNOWN; |
425 SDL_DFB_RENDERERDATA(renderer); | 428 SDL_DFB_RENDERERDATA(renderer); |
426 SDL_Window *window = renderer->window; | 429 SDL_Window *window = renderer->window; |
427 SDL_DFB_WINDOWDATA(window); | 430 SDL_DFB_WINDOWDATA(window); |
428 | 431 |
429 if (renddata->size_changed || windata->wm_needs_redraw) { | 432 if (renddata->size_changed || windata->wm_needs_redraw) { |
430 DirectFB_AdjustWindowSurface(window); | 433 // DirectFB_AdjustWindowSurface(window); |
431 } | 434 } |
432 return 0; | 435 return 0; |
433 } | 436 } |
434 | 437 |
435 static int | 438 static int |
449 SDL_VideoDisplay *display = window->display; | 452 SDL_VideoDisplay *display = window->display; |
450 SDL_DFB_DEVICEDATA(display->device); | 453 SDL_DFB_DEVICEDATA(display->device); |
451 DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata; | 454 DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata; |
452 DirectFB_TextureData *data = texture->driverdata; | 455 DirectFB_TextureData *data = texture->driverdata; |
453 DFBDisplayLayerConfig layconf; | 456 DFBDisplayLayerConfig layconf; |
454 int ret; | 457 DFBResult ret; |
455 | 458 |
456 if (renddata->isyuvdirect && (dispdata->vidID >= 0) | 459 if (renddata->isyuvdirect && (dispdata->vidID >= 0) |
457 && (!dispdata->vidIDinuse) | 460 && (!dispdata->vidIDinuse) |
458 && SDL_ISPIXELFORMAT_FOURCC(data->format)) { | 461 && SDL_ISPIXELFORMAT_FOURCC(data->format)) { |
459 layconf.flags = | 462 layconf.flags = |
470 SDL_DFB_CHECKERR(dispdata-> | 473 SDL_DFB_CHECKERR(dispdata-> |
471 vidlayer->SetCooperativeLevel(dispdata->vidlayer, | 474 vidlayer->SetCooperativeLevel(dispdata->vidlayer, |
472 DLSCL_EXCLUSIVE)); | 475 DLSCL_EXCLUSIVE)); |
473 | 476 |
474 if (devdata->use_yuv_underlays) { | 477 if (devdata->use_yuv_underlays) { |
475 ret = dispdata->vidlayer->SetLevel(dispdata->vidlayer, -1); | 478 ret = SDL_DFB_CHECK(dispdata->vidlayer->SetLevel(dispdata->vidlayer, -1)); |
476 if (ret != DFB_OK) | 479 if (ret != DFB_OK) |
477 SDL_DFB_DEBUG("Underlay Setlevel not supported\n"); | 480 SDL_DFB_DEBUG("Underlay Setlevel not supported\n"); |
478 } | 481 } |
479 SDL_DFB_CHECKERR(dispdata-> | 482 SDL_DFB_CHECKERR(dispdata-> |
480 vidlayer->SetConfiguration(dispdata->vidlayer, | 483 vidlayer->SetConfiguration(dispdata->vidlayer, |
503 { | 506 { |
504 SDL_Window *window = renderer->window; | 507 SDL_Window *window = renderer->window; |
505 SDL_VideoDisplay *display = window->display; | 508 SDL_VideoDisplay *display = window->display; |
506 SDL_DFB_DEVICEDATA(display->device); | 509 SDL_DFB_DEVICEDATA(display->device); |
507 DirectFB_TextureData *data; | 510 DirectFB_TextureData *data; |
508 DFBResult ret; | |
509 DFBSurfaceDescription dsc; | 511 DFBSurfaceDescription dsc; |
510 DFBSurfacePixelFormat pixelformat; | 512 DFBSurfacePixelFormat pixelformat; |
511 | 513 |
512 SDL_DFB_CALLOC(data, 1, sizeof(*data)); | 514 SDL_DFB_CALLOC(data, 1, sizeof(*data)); |
513 texture->driverdata = data; | 515 texture->driverdata = data; |
598 SDL_Texture * texture, | 600 SDL_Texture * texture, |
599 const SDL_Color * colors, int firstcolor, | 601 const SDL_Color * colors, int firstcolor, |
600 int ncolors) | 602 int ncolors) |
601 { | 603 { |
602 DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata; | 604 DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata; |
603 DFBResult ret; | 605 |
604 | |
605 if (SDL_ISPIXELFORMAT_INDEXED(data->format) | 606 if (SDL_ISPIXELFORMAT_INDEXED(data->format) |
606 && !SDL_ISPIXELFORMAT_FOURCC(data->format)) { | 607 && !SDL_ISPIXELFORMAT_FOURCC(data->format)) { |
607 DFBColor entries[256]; | 608 DFBColor entries[256]; |
608 int i; | 609 int i; |
609 | 610 |
629 DirectFB_GetTexturePalette(SDL_Renderer * renderer, | 630 DirectFB_GetTexturePalette(SDL_Renderer * renderer, |
630 SDL_Texture * texture, SDL_Color * colors, | 631 SDL_Texture * texture, SDL_Color * colors, |
631 int firstcolor, int ncolors) | 632 int firstcolor, int ncolors) |
632 { | 633 { |
633 DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata; | 634 DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata; |
634 DFBResult ret; | |
635 | 635 |
636 if (SDL_ISPIXELFORMAT_INDEXED(data->format) | 636 if (SDL_ISPIXELFORMAT_INDEXED(data->format) |
637 && !SDL_ISPIXELFORMAT_FOURCC(data->format)) { | 637 && !SDL_ISPIXELFORMAT_FOURCC(data->format)) { |
638 DFBColor entries[256]; | 638 DFBColor entries[256]; |
639 int i; | 639 int i; |
680 case SDL_BLENDMODE_MOD: | 680 case SDL_BLENDMODE_MOD: |
681 return 0; | 681 return 0; |
682 default: | 682 default: |
683 SDL_Unsupported(); | 683 SDL_Unsupported(); |
684 texture->blendMode = SDL_BLENDMODE_NONE; | 684 texture->blendMode = SDL_BLENDMODE_NONE; |
685 return -1; | |
686 } | |
687 } | |
688 | |
689 static int | |
690 DirectFB_SetDrawBlendMode(SDL_Renderer * renderer) | |
691 { | |
692 switch (renderer->blendMode) { | |
693 case SDL_BLENDMODE_NONE: | |
694 case SDL_BLENDMODE_MASK: | |
695 case SDL_BLENDMODE_BLEND: | |
696 case SDL_BLENDMODE_ADD: | |
697 case SDL_BLENDMODE_MOD: | |
698 return 0; | |
699 default: | |
700 SDL_Unsupported(); | |
701 renderer->blendMode = SDL_BLENDMODE_NONE; | |
685 return -1; | 702 return -1; |
686 } | 703 } |
687 } | 704 } |
688 | 705 |
689 static int | 706 static int |
718 static int | 735 static int |
719 DirectFB_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, | 736 DirectFB_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, |
720 const SDL_Rect * rect, const void *pixels, int pitch) | 737 const SDL_Rect * rect, const void *pixels, int pitch) |
721 { | 738 { |
722 DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata; | 739 DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata; |
723 DFBResult ret; | |
724 Uint8 *dpixels; | 740 Uint8 *dpixels; |
725 int dpitch; | 741 int dpitch; |
726 Uint8 *src, *dst; | 742 Uint8 *src, *dst; |
727 int row; | 743 int row; |
728 size_t length; | 744 size_t length; |
770 const SDL_Rect * rect, int markDirty, | 786 const SDL_Rect * rect, int markDirty, |
771 void **pixels, int *pitch) | 787 void **pixels, int *pitch) |
772 { | 788 { |
773 DirectFB_TextureData *texturedata = | 789 DirectFB_TextureData *texturedata = |
774 (DirectFB_TextureData *) texture->driverdata; | 790 (DirectFB_TextureData *) texture->driverdata; |
775 DFBResult ret; | |
776 | 791 |
777 if (markDirty) { | 792 if (markDirty) { |
778 SDL_AddDirtyRect(&texturedata->dirty, rect); | 793 SDL_AddDirtyRect(&texturedata->dirty, rect); |
779 } | 794 } |
780 | 795 |
805 { | 820 { |
806 DirectFB_TextureData *texturedata = | 821 DirectFB_TextureData *texturedata = |
807 (DirectFB_TextureData *) texture->driverdata; | 822 (DirectFB_TextureData *) texture->driverdata; |
808 | 823 |
809 if (texturedata->display) { | 824 if (texturedata->display) { |
810 texturedata->surface->Unlock(texturedata->surface); | 825 SDL_DFB_CHECK(texturedata->surface->Unlock(texturedata->surface)); |
811 texturedata->pixels = NULL; | 826 texturedata->pixels = NULL; |
812 } | 827 } |
813 } | 828 } |
814 | 829 |
815 static void | 830 static void |
828 PrepareDraw(SDL_Renderer * renderer) | 843 PrepareDraw(SDL_Renderer * renderer) |
829 { | 844 { |
830 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; | 845 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; |
831 SDL_DFB_WINDOWSURFACE(data->window); | 846 SDL_DFB_WINDOWSURFACE(data->window); |
832 | 847 |
833 DFBResult ret; | |
834 Uint8 r, g, b, a; | 848 Uint8 r, g, b, a; |
835 | 849 |
836 r = renderer->r; | 850 r = renderer->r; |
837 g = renderer->g; | 851 g = renderer->g; |
838 b = renderer->b; | 852 b = renderer->b; |
864 static int DirectFB_RenderDrawPoints(SDL_Renderer * renderer, | 878 static int DirectFB_RenderDrawPoints(SDL_Renderer * renderer, |
865 const SDL_Point * points, int count) | 879 const SDL_Point * points, int count) |
866 { | 880 { |
867 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; | 881 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; |
868 SDL_DFB_WINDOWSURFACE(data->window); | 882 SDL_DFB_WINDOWSURFACE(data->window); |
869 DFBResult ret; | |
870 int i; | 883 int i; |
871 | 884 |
872 PrepareDraw(renderer); | 885 PrepareDraw(renderer); |
873 for (i=0; i < count; i++) | 886 for (i=0; i < count; i++) |
874 SDL_DFB_CHECKERR(destsurf->DrawLine(destsurf, points[i].x, points[i].y, points[i].x, points[i].y)); | 887 SDL_DFB_CHECKERR(destsurf->DrawLine(destsurf, points[i].x, points[i].y, points[i].x, points[i].y)); |
880 static int DirectFB_RenderDrawLines(SDL_Renderer * renderer, | 893 static int DirectFB_RenderDrawLines(SDL_Renderer * renderer, |
881 const SDL_Point * points, int count) | 894 const SDL_Point * points, int count) |
882 { | 895 { |
883 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; | 896 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; |
884 SDL_DFB_WINDOWSURFACE(data->window); | 897 SDL_DFB_WINDOWSURFACE(data->window); |
885 DFBResult ret; | |
886 int i; | 898 int i; |
887 | 899 |
888 PrepareDraw(renderer); | 900 PrepareDraw(renderer); |
889 /* Use antialiasing when available */ | 901 /* Use antialiasing when available */ |
890 #if (DFB_VERSION_ATLEAST(1,2,0)) | 902 #if (DFB_VERSION_ATLEAST(1,2,0)) |
902 static int | 914 static int |
903 DirectFB_RenderDrawRects(SDL_Renderer * renderer, const SDL_Rect ** rects, int count) | 915 DirectFB_RenderDrawRects(SDL_Renderer * renderer, const SDL_Rect ** rects, int count) |
904 { | 916 { |
905 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; | 917 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; |
906 SDL_DFB_WINDOWSURFACE(data->window); | 918 SDL_DFB_WINDOWSURFACE(data->window); |
907 DFBResult ret; | |
908 int i; | 919 int i; |
909 | 920 |
910 PrepareDraw(renderer); | 921 PrepareDraw(renderer); |
911 | 922 |
912 for (i=0; i<count; i++) | 923 for (i=0; i<count; i++) |
921 static int | 932 static int |
922 DirectFB_RenderFillRects(SDL_Renderer * renderer, const SDL_Rect ** rects, int count) | 933 DirectFB_RenderFillRects(SDL_Renderer * renderer, const SDL_Rect ** rects, int count) |
923 { | 934 { |
924 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; | 935 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; |
925 SDL_DFB_WINDOWSURFACE(data->window); | 936 SDL_DFB_WINDOWSURFACE(data->window); |
926 DFBResult ret; | |
927 int i; | 937 int i; |
928 | 938 |
929 PrepareDraw(renderer); | 939 PrepareDraw(renderer); |
930 | 940 |
931 for (i=0; i<count; i++) | 941 for (i=0; i<count; i++) |
944 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; | 954 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; |
945 SDL_DFB_WINDOWSURFACE(data->window); | 955 SDL_DFB_WINDOWSURFACE(data->window); |
946 DirectFB_TextureData *texturedata = | 956 DirectFB_TextureData *texturedata = |
947 (DirectFB_TextureData *) texture->driverdata; | 957 (DirectFB_TextureData *) texture->driverdata; |
948 Uint8 alpha = 0xFF; | 958 Uint8 alpha = 0xFF; |
949 DFBResult ret; | |
950 | 959 |
951 if (texturedata->display) { | 960 if (texturedata->display) { |
952 int px, py; | 961 int px, py; |
953 SDL_Window *window = renderer->window; | 962 SDL_Window *window = renderer->window; |
954 SDL_DFB_WINDOWDATA(window); | 963 SDL_DFB_WINDOWDATA(window); |
958 SDL_DFB_CHECKERR(dispdata-> | 967 SDL_DFB_CHECKERR(dispdata-> |
959 vidlayer->SetSourceRectangle(dispdata->vidlayer, | 968 vidlayer->SetSourceRectangle(dispdata->vidlayer, |
960 srcrect->x, srcrect->y, | 969 srcrect->x, srcrect->y, |
961 srcrect->w, | 970 srcrect->w, |
962 srcrect->h)); | 971 srcrect->h)); |
963 windata->window->GetPosition(windata->window, &px, &py); | 972 SDL_DFB_CHECK(windata->window->GetPosition(windata->window, &px, &py)); |
964 px += windata->client.x; | 973 px += windata->client.x; |
965 py += windata->client.y; | 974 py += windata->client.y; |
966 SDL_DFB_CHECKERR(dispdata-> | 975 SDL_DFB_CHECKERR(dispdata-> |
967 vidlayer->SetScreenRectangle(dispdata->vidlayer, | 976 vidlayer->SetScreenRectangle(dispdata->vidlayer, |
968 px + dstrect->x, | 977 px + dstrect->x, |
1050 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; | 1059 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; |
1051 SDL_Window *window = renderer->window; | 1060 SDL_Window *window = renderer->window; |
1052 SDL_DFB_WINDOWDATA(window); | 1061 SDL_DFB_WINDOWDATA(window); |
1053 | 1062 |
1054 DFBRectangle sr; | 1063 DFBRectangle sr; |
1055 DFBResult ret; | |
1056 | 1064 |
1057 sr.x = 0; | 1065 sr.x = 0; |
1058 sr.y = 0; | 1066 sr.y = 0; |
1059 sr.w = window->w; | 1067 sr.w = window->w; |
1060 sr.h = window->h; | 1068 sr.h = window->h; |
1076 SDL_DFB_RELEASE(data->surface); | 1084 SDL_DFB_RELEASE(data->surface); |
1077 if (data->display) { | 1085 if (data->display) { |
1078 DFB_DisplayData *dispdata = | 1086 DFB_DisplayData *dispdata = |
1079 (DFB_DisplayData *) data->display->driverdata; | 1087 (DFB_DisplayData *) data->display->driverdata; |
1080 dispdata->vidIDinuse = 0; | 1088 dispdata->vidIDinuse = 0; |
1081 dispdata->vidlayer->SetCooperativeLevel(dispdata->vidlayer, | 1089 /* FIXME: Shouldn't we reset the cooperative level */ |
1082 DLSCL_ADMINISTRATIVE); | 1090 SDL_DFB_CHECK(dispdata->vidlayer->SetCooperativeLevel(dispdata->vidlayer, |
1091 DLSCL_ADMINISTRATIVE)); | |
1083 SDL_DFB_RELEASE(dispdata->vidlayer); | 1092 SDL_DFB_RELEASE(dispdata->vidlayer); |
1084 } | 1093 } |
1085 SDL_FreeDirtyRects(&data->dirty); | 1094 SDL_FreeDirtyRects(&data->dirty); |
1086 SDL_DFB_FREE(data->pixels); | 1095 SDL_DFB_FREE(data->pixels); |
1087 SDL_free(data); | 1096 SDL_free(data); |