Mercurial > sdl-ios-xcode
comparison src/video/directfb/SDL_DirectFB_render.c @ 3023:d72a0dd80e8b
DirectFB cleanups & simple window manager
- use SDL_getenv, not getenv ...
- no more support for 0.9.25 - not even mentioned any longer on directfb.org
- fix fullscreen issues
- add a simple window manager unless the directfb team comes up with a working wm.
The driver has support for a very, very basic window manager you may
want to use when runnning with "wm=default". Use
export SDL_DIRECTFB_WM=1
to enable basic window borders including icon support. In order to have the window title rendered,
you need to have the following font installed:
/usr/share/fonts/truetype/freefont/FreeSans.ttf
author | Couriersud <couriersud@arcor.de> |
---|---|
date | Sun, 11 Jan 2009 23:49:23 +0000 |
parents | 8cc00819c8d6 |
children | 490f3e4fe753 |
comparison
equal
deleted
inserted
replaced
3022:db20dde98dd3 | 3023:d72a0dd80e8b |
---|---|
39 static int DirectFB_DisplayModeChanged(SDL_Renderer * renderer); | 39 static int DirectFB_DisplayModeChanged(SDL_Renderer * renderer); |
40 static int DirectFB_ActivateRenderer(SDL_Renderer * renderer); | 40 static int DirectFB_ActivateRenderer(SDL_Renderer * renderer); |
41 static int DirectFB_CreateTexture(SDL_Renderer * renderer, | 41 static int DirectFB_CreateTexture(SDL_Renderer * renderer, |
42 SDL_Texture * texture); | 42 SDL_Texture * texture); |
43 static int DirectFB_QueryTexturePixels(SDL_Renderer * renderer, | 43 static int DirectFB_QueryTexturePixels(SDL_Renderer * renderer, |
44 SDL_Texture * texture, void **pixels, | 44 SDL_Texture * texture, |
45 int *pitch); | 45 void **pixels, int *pitch); |
46 static int DirectFB_SetTexturePalette(SDL_Renderer * renderer, | 46 static int DirectFB_SetTexturePalette(SDL_Renderer * renderer, |
47 SDL_Texture * texture, | 47 SDL_Texture * texture, |
48 const SDL_Color * colors, | 48 const SDL_Color * colors, |
49 int firstcolor, int ncolors); | 49 int firstcolor, int ncolors); |
50 static int DirectFB_GetTexturePalette(SDL_Renderer * renderer, | 50 static int DirectFB_GetTexturePalette(SDL_Renderer * renderer, |
51 SDL_Texture * texture, | 51 SDL_Texture * texture, |
52 SDL_Color * colors, int firstcolor, | 52 SDL_Color * colors, |
53 int ncolors); | 53 int firstcolor, int ncolors); |
54 static int DirectFB_SetTextureAlphaMod(SDL_Renderer * renderer, | 54 static int DirectFB_SetTextureAlphaMod(SDL_Renderer * renderer, |
55 SDL_Texture * texture); | 55 SDL_Texture * texture); |
56 static int DirectFB_SetTextureColorMod(SDL_Renderer * renderer, | 56 static int DirectFB_SetTextureColorMod(SDL_Renderer * renderer, |
57 SDL_Texture * texture); | 57 SDL_Texture * texture); |
58 static int DirectFB_SetTextureBlendMode(SDL_Renderer * renderer, | 58 static int DirectFB_SetTextureBlendMode(SDL_Renderer * renderer, |
59 SDL_Texture * texture); | 59 SDL_Texture * texture); |
60 static int DirectFB_SetTextureScaleMode(SDL_Renderer * renderer, | 60 static int DirectFB_SetTextureScaleMode(SDL_Renderer * renderer, |
61 SDL_Texture * texture); | 61 SDL_Texture * texture); |
62 static int DirectFB_UpdateTexture(SDL_Renderer * renderer, | 62 static int DirectFB_UpdateTexture(SDL_Renderer * renderer, |
63 SDL_Texture * texture, | 63 SDL_Texture * texture, |
64 const SDL_Rect * rect, const void *pixels, | 64 const SDL_Rect * rect, |
65 int pitch); | 65 const void *pixels, int pitch); |
66 static int DirectFB_LockTexture(SDL_Renderer * renderer, | 66 static int DirectFB_LockTexture(SDL_Renderer * renderer, |
67 SDL_Texture * texture, const SDL_Rect * rect, | 67 SDL_Texture * texture, |
68 int markDirty, void **pixels, int *pitch); | 68 const SDL_Rect * rect, int markDirty, |
69 void **pixels, int *pitch); | |
69 static void DirectFB_UnlockTexture(SDL_Renderer * renderer, | 70 static void DirectFB_UnlockTexture(SDL_Renderer * renderer, |
70 SDL_Texture * texture); | 71 SDL_Texture * texture); |
71 static void DirectFB_DirtyTexture(SDL_Renderer * renderer, | 72 static void DirectFB_DirtyTexture(SDL_Renderer * renderer, |
72 SDL_Texture * texture, int numrects, | 73 SDL_Texture * texture, int numrects, |
73 const SDL_Rect * rects); | 74 const SDL_Rect * rects); |
74 static int DirectFB_RenderPoint(SDL_Renderer * renderer, int x, int y); | 75 static int DirectFB_RenderPoint(SDL_Renderer * renderer, int x, int y); |
75 static int DirectFB_RenderLine(SDL_Renderer * renderer, int x1, int y1, | 76 static int DirectFB_RenderLine(SDL_Renderer * renderer, int x1, int y1, |
76 int x2, int y2); | 77 int x2, int y2); |
77 static int DirectFB_RenderFill(SDL_Renderer * renderer, | 78 static int DirectFB_RenderFill(SDL_Renderer * renderer, |
78 const SDL_Rect * rect); | 79 const SDL_Rect * rect); |
79 static int DirectFB_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, | 80 static int DirectFB_RenderCopy(SDL_Renderer * renderer, |
81 SDL_Texture * texture, | |
80 const SDL_Rect * srcrect, | 82 const SDL_Rect * srcrect, |
81 const SDL_Rect * dstrect); | 83 const SDL_Rect * dstrect); |
82 static void DirectFB_RenderPresent(SDL_Renderer * renderer); | 84 static void DirectFB_RenderPresent(SDL_Renderer * renderer); |
83 static void DirectFB_DestroyTexture(SDL_Renderer * renderer, | 85 static void DirectFB_DestroyTexture(SDL_Renderer * renderer, |
84 SDL_Texture * texture); | 86 SDL_Texture * texture); |
92 SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 | | 94 SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 | |
93 SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_PRESENTDISCARD | | 95 SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_PRESENTDISCARD | |
94 SDL_RENDERER_ACCELERATED), | 96 SDL_RENDERER_ACCELERATED), |
95 (SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_COLOR | | 97 (SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_COLOR | |
96 SDL_TEXTUREMODULATE_ALPHA), | 98 SDL_TEXTUREMODULATE_ALPHA), |
97 (SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK | | 99 (SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK | SDL_BLENDMODE_BLEND | |
98 SDL_BLENDMODE_BLEND | SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD), | 100 SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD), |
99 (SDL_TEXTURESCALEMODE_NONE | SDL_TEXTURESCALEMODE_FAST | | 101 (SDL_TEXTURESCALEMODE_NONE | SDL_TEXTURESCALEMODE_FAST | |
100 SDL_TEXTURESCALEMODE_SLOW | SDL_TEXTURESCALEMODE_BEST), | 102 SDL_TEXTURESCALEMODE_SLOW | SDL_TEXTURESCALEMODE_BEST), |
101 14, | 103 14, |
102 { | 104 { |
103 SDL_PIXELFORMAT_INDEX4LSB, | 105 SDL_PIXELFORMAT_INDEX4LSB, |
325 renderer->info.flags |= SDL_RENDERER_PRESENTFLIP3; | 327 renderer->info.flags |= SDL_RENDERER_PRESENTFLIP3; |
326 else | 328 else |
327 renderer->info.flags |= SDL_RENDERER_SINGLEBUFFER; | 329 renderer->info.flags |= SDL_RENDERER_SINGLEBUFFER; |
328 | 330 |
329 data->isyuvdirect = 0; /* default is off! */ | 331 data->isyuvdirect = 0; /* default is off! */ |
330 p = getenv(DFBENV_USE_YUV_DIRECT); | 332 p = SDL_getenv(DFBENV_USE_YUV_DIRECT); |
331 if (p) | 333 if (p) |
332 data->isyuvdirect = atoi(p); | 334 data->isyuvdirect = atoi(p); |
333 | 335 |
334 /* Set up a palette watch on the display palette */ | 336 /* Set up a palette watch on the display palette */ |
335 if (display->palette) { | 337 if (display->palette) { |
412 { | 414 { |
413 SDL_DFB_RENDERERDATA(renderer); | 415 SDL_DFB_RENDERERDATA(renderer); |
414 SDL_Window *window = SDL_GetWindowFromID(renderer->window); | 416 SDL_Window *window = SDL_GetWindowFromID(renderer->window); |
415 SDL_DFB_WINDOWDATA(window); | 417 SDL_DFB_WINDOWDATA(window); |
416 | 418 |
417 if (renddata->size_changed) { | 419 if (renddata->size_changed || windata->wm_needs_redraw) { |
418 int cw, ch; | 420 DirectFB_AdjustWindowSurface(window); |
419 int ret; | 421 } |
420 | 422 return 0; |
421 SDL_DFB_CHECKERR(windata->surface-> | |
422 GetSize(windata->surface, &cw, &ch)); | |
423 if (cw != window->w || ch != window->h) | |
424 SDL_DFB_CHECKERR(windata->window-> | |
425 ResizeSurface(windata->window, window->w, | |
426 window->h)); | |
427 } | |
428 return 0; | |
429 error: | |
430 return -1; | |
431 } | 423 } |
432 | 424 |
433 static int | 425 static int |
434 DirectFB_DisplayModeChanged(SDL_Renderer * renderer) | 426 DirectFB_DisplayModeChanged(SDL_Renderer * renderer) |
435 { | 427 { |
460 layconf.width = texture->w; | 452 layconf.width = texture->w; |
461 layconf.height = texture->h; | 453 layconf.height = texture->h; |
462 layconf.pixelformat = SDLToDFBPixelFormat(data->format); | 454 layconf.pixelformat = SDLToDFBPixelFormat(data->format); |
463 layconf.surface_caps = DSCAPS_VIDEOONLY | DSCAPS_DOUBLE; | 455 layconf.surface_caps = DSCAPS_VIDEOONLY | DSCAPS_DOUBLE; |
464 | 456 |
465 SDL_DFB_CHECKERR(devdata->dfb-> | 457 SDL_DFB_CHECKERR(devdata->dfb->GetDisplayLayer(devdata->dfb, |
466 GetDisplayLayer(devdata->dfb, dispdata->vidID, | 458 dispdata->vidID, |
467 &dispdata->vidlayer)); | 459 &dispdata->vidlayer)); |
468 SDL_DFB_CHECKERR(dispdata->vidlayer-> | 460 SDL_DFB_CHECKERR(dispdata-> |
469 SetCooperativeLevel(dispdata->vidlayer, | 461 vidlayer->SetCooperativeLevel(dispdata->vidlayer, |
470 DLSCL_EXCLUSIVE)); | 462 DLSCL_EXCLUSIVE)); |
471 | 463 |
472 if (devdata->use_yuv_underlays) { | 464 if (devdata->use_yuv_underlays) { |
473 ret = dispdata->vidlayer->SetLevel(dispdata->vidlayer, -1); | 465 ret = dispdata->vidlayer->SetLevel(dispdata->vidlayer, -1); |
474 if (ret != DFB_OK) | 466 if (ret != DFB_OK) |
475 SDL_DFB_DEBUG("Underlay Setlevel not supported\n"); | 467 SDL_DFB_DEBUG("Underlay Setlevel not supported\n"); |
476 } | 468 } |
477 SDL_DFB_CHECKERR(dispdata->vidlayer-> | 469 SDL_DFB_CHECKERR(dispdata-> |
478 SetConfiguration(dispdata->vidlayer, &layconf)); | 470 vidlayer->SetConfiguration(dispdata->vidlayer, |
479 SDL_DFB_CHECKERR(dispdata->vidlayer-> | 471 &layconf)); |
480 GetSurface(dispdata->vidlayer, &data->surface)); | 472 SDL_DFB_CHECKERR(dispdata-> |
473 vidlayer->GetSurface(dispdata->vidlayer, | |
474 &data->surface)); | |
481 dispdata->vidIDinuse = 1; | 475 dispdata->vidIDinuse = 1; |
482 data->display = display; | 476 data->display = display; |
483 return 0; | 477 return 0; |
484 } | 478 } |
485 return 1; | 479 return 1; |
486 error: | 480 error: |
487 if (dispdata->vidlayer) { | 481 if (dispdata->vidlayer) { |
488 SDL_DFB_RELEASE(data->surface); | 482 SDL_DFB_RELEASE(data->surface); |
489 SDL_DFB_CHECKERR(dispdata->vidlayer-> | 483 SDL_DFB_CHECKERR(dispdata-> |
490 SetCooperativeLevel(dispdata->vidlayer, | 484 vidlayer->SetCooperativeLevel(dispdata->vidlayer, |
491 DLSCL_ADMINISTRATIVE)); | 485 DLSCL_ADMINISTRATIVE)); |
492 SDL_DFB_RELEASE(dispdata->vidlayer); | 486 SDL_DFB_RELEASE(dispdata->vidlayer); |
493 } | 487 } |
494 return 1; | 488 return 1; |
495 } | 489 } |
496 | 490 |
538 } | 532 } |
539 | 533 |
540 data->pixels = NULL; | 534 data->pixels = NULL; |
541 | 535 |
542 /* Create the surface */ | 536 /* Create the surface */ |
543 SDL_DFB_CHECKERR(devdata->dfb-> | 537 SDL_DFB_CHECKERR(devdata->dfb->CreateSurface(devdata->dfb, &dsc, |
544 CreateSurface(devdata->dfb, &dsc, &data->surface)); | 538 &data->surface)); |
545 if (SDL_ISPIXELFORMAT_INDEXED(data->format) | 539 if (SDL_ISPIXELFORMAT_INDEXED(data->format) |
546 && !SDL_ISPIXELFORMAT_FOURCC(data->format)) { | 540 && !SDL_ISPIXELFORMAT_FOURCC(data->format)) { |
547 SDL_DFB_CHECKERR(data->surface-> | 541 SDL_DFB_CHECKERR(data->surface->GetPalette(data->surface, |
548 GetPalette(data->surface, &data->palette)); | 542 &data->palette)); |
549 } | 543 } |
550 | 544 |
551 } | 545 } |
552 #if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) | 546 #if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) |
553 data->render_options = DSRO_NONE; | 547 data->render_options = DSRO_NONE; |
566 SDL_DFB_FREE(texture->driverdata); | 560 SDL_DFB_FREE(texture->driverdata); |
567 return -1; | 561 return -1; |
568 } | 562 } |
569 | 563 |
570 static int | 564 static int |
571 DirectFB_QueryTexturePixels(SDL_Renderer * renderer, SDL_Texture * texture, | 565 DirectFB_QueryTexturePixels(SDL_Renderer * renderer, |
572 void **pixels, int *pitch) | 566 SDL_Texture * texture, void **pixels, int *pitch) |
573 { | 567 { |
574 DirectFB_TextureData *texturedata = | 568 DirectFB_TextureData *texturedata = |
575 (DirectFB_TextureData *) texture->driverdata; | 569 (DirectFB_TextureData *) texture->driverdata; |
576 | 570 |
577 if (texturedata->display) { | 571 if (texturedata->display) { |
582 } | 576 } |
583 return 0; | 577 return 0; |
584 } | 578 } |
585 | 579 |
586 static int | 580 static int |
587 DirectFB_SetTexturePalette(SDL_Renderer * renderer, SDL_Texture * texture, | 581 DirectFB_SetTexturePalette(SDL_Renderer * renderer, |
582 SDL_Texture * texture, | |
588 const SDL_Color * colors, int firstcolor, | 583 const SDL_Color * colors, int firstcolor, |
589 int ncolors) | 584 int ncolors) |
590 { | 585 { |
591 DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata; | 586 DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata; |
592 DFBResult ret; | 587 DFBResult ret; |
600 entries[i].r = colors[i].r; | 595 entries[i].r = colors[i].r; |
601 entries[i].g = colors[i].g; | 596 entries[i].g = colors[i].g; |
602 entries[i].b = colors[i].b; | 597 entries[i].b = colors[i].b; |
603 entries[i].a = 0xFF; | 598 entries[i].a = 0xFF; |
604 } | 599 } |
605 SDL_DFB_CHECKERR(data->palette-> | 600 SDL_DFB_CHECKERR(data-> |
606 SetEntries(data->palette, entries, ncolors, | 601 palette->SetEntries(data->palette, entries, ncolors, |
607 firstcolor)); | 602 firstcolor)); |
608 return 0; | 603 return 0; |
609 } else { | 604 } else { |
610 SDL_SetError("YUV textures don't have a palette"); | 605 SDL_SetError("YUV textures don't have a palette"); |
611 return -1; | 606 return -1; |
612 } | 607 } |
613 error: | 608 error: |
614 return -1; | 609 return -1; |
615 } | 610 } |
616 | 611 |
617 static int | 612 static int |
618 DirectFB_GetTexturePalette(SDL_Renderer * renderer, SDL_Texture * texture, | 613 DirectFB_GetTexturePalette(SDL_Renderer * renderer, |
619 SDL_Color * colors, int firstcolor, int ncolors) | 614 SDL_Texture * texture, SDL_Color * colors, |
615 int firstcolor, int ncolors) | |
620 { | 616 { |
621 DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata; | 617 DirectFB_TextureData *data = (DirectFB_TextureData *) texture->driverdata; |
622 DFBResult ret; | 618 DFBResult ret; |
623 | 619 |
624 if (SDL_ISPIXELFORMAT_INDEXED(data->format) | 620 if (SDL_ISPIXELFORMAT_INDEXED(data->format) |
625 && !SDL_ISPIXELFORMAT_FOURCC(data->format)) { | 621 && !SDL_ISPIXELFORMAT_FOURCC(data->format)) { |
626 DFBColor entries[256]; | 622 DFBColor entries[256]; |
627 int i; | 623 int i; |
628 | 624 |
629 SDL_DFB_CHECKERR(data->palette-> | 625 SDL_DFB_CHECKERR(data-> |
630 GetEntries(data->palette, entries, ncolors, | 626 palette->GetEntries(data->palette, entries, ncolors, |
631 firstcolor)); | 627 firstcolor)); |
632 | 628 |
633 for (i = 0; i < ncolors; ++i) { | 629 for (i = 0; i < ncolors; ++i) { |
634 colors[i].r = entries[i].r; | 630 colors[i].r = entries[i].r; |
635 colors[i].g = entries[i].g; | 631 colors[i].g = entries[i].g; |
636 colors[i].b = entries[i].b; | 632 colors[i].b = entries[i].b; |
735 | 731 |
736 } | 732 } |
737 | 733 |
738 static int | 734 static int |
739 DirectFB_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, | 735 DirectFB_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, |
740 const SDL_Rect * rect, int markDirty, void **pixels, | 736 const SDL_Rect * rect, int markDirty, |
741 int *pitch) | 737 void **pixels, int *pitch) |
742 { | 738 { |
743 DirectFB_TextureData *texturedata = | 739 DirectFB_TextureData *texturedata = |
744 (DirectFB_TextureData *) texture->driverdata; | 740 (DirectFB_TextureData *) texture->driverdata; |
745 DFBResult ret; | 741 DFBResult ret; |
746 | 742 |
805 g = renderer->g; | 801 g = renderer->g; |
806 b = renderer->b; | 802 b = renderer->b; |
807 a = renderer->a; | 803 a = renderer->a; |
808 | 804 |
809 SetBlendMode(data, renderer->blendMode, NULL); | 805 SetBlendMode(data, renderer->blendMode, NULL); |
810 SDL_DFB_CHECKERR(data->surface-> | 806 SDL_DFB_CHECKERR(data->surface->SetDrawingFlags(data->surface, |
811 SetDrawingFlags(data->surface, data->drawFlags)); | 807 data->drawFlags)); |
812 | 808 |
813 switch (renderer->blendMode) { | 809 switch (renderer->blendMode) { |
814 case SDL_BLENDMODE_NONE: | 810 case SDL_BLENDMODE_NONE: |
815 case SDL_BLENDMODE_MASK: | 811 case SDL_BLENDMODE_MASK: |
816 case SDL_BLENDMODE_BLEND: | 812 case SDL_BLENDMODE_BLEND: |
866 { | 862 { |
867 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; | 863 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; |
868 DFBResult ret; | 864 DFBResult ret; |
869 | 865 |
870 PrepareDraw(renderer); | 866 PrepareDraw(renderer); |
871 SDL_DFB_CHECKERR(data->surface-> | 867 SDL_DFB_CHECKERR(data-> |
872 FillRectangle(data->surface, rect->x, rect->y, rect->w, | 868 surface->FillRectangle(data->surface, rect->x, rect->y, |
873 rect->h)); | 869 rect->w, rect->h)); |
874 | 870 |
875 return 0; | 871 return 0; |
876 error: | 872 error: |
877 return -1; | 873 return -1; |
878 } | 874 } |
892 SDL_Window *window = SDL_GetWindowFromID(renderer->window); | 888 SDL_Window *window = SDL_GetWindowFromID(renderer->window); |
893 SDL_DFB_WINDOWDATA(window); | 889 SDL_DFB_WINDOWDATA(window); |
894 SDL_VideoDisplay *display = texturedata->display; | 890 SDL_VideoDisplay *display = texturedata->display; |
895 DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata; | 891 DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata; |
896 | 892 |
897 SDL_DFB_CHECKERR(dispdata->vidlayer-> | 893 SDL_DFB_CHECKERR(dispdata-> |
898 SetSourceRectangle(dispdata->vidlayer, srcrect->x, | 894 vidlayer->SetSourceRectangle(dispdata->vidlayer, |
899 srcrect->y, srcrect->w, | 895 srcrect->x, srcrect->y, |
900 srcrect->h)); | 896 srcrect->w, |
897 srcrect->h)); | |
901 windata->window->GetPosition(windata->window, &px, &py); | 898 windata->window->GetPosition(windata->window, &px, &py); |
902 SDL_DFB_CHECKERR(dispdata->vidlayer-> | 899 px += windata->client.x; |
903 SetScreenRectangle(dispdata->vidlayer, | 900 py += windata->client.y; |
904 px + dstrect->x, py + dstrect->y, | 901 SDL_DFB_CHECKERR(dispdata-> |
905 dstrect->w, dstrect->h)); | 902 vidlayer->SetScreenRectangle(dispdata->vidlayer, |
903 px + dstrect->x, | |
904 py + dstrect->y, | |
905 dstrect->w, | |
906 dstrect->h)); | |
906 } else { | 907 } else { |
907 DFBRectangle sr, dr; | 908 DFBRectangle sr, dr; |
908 DFBSurfaceBlittingFlags flags = 0; | 909 DFBSurfaceBlittingFlags flags = 0; |
909 | 910 |
910 if (texturedata->dirty.list) { | 911 if (texturedata->dirty.list) { |
926 } | 927 } |
927 | 928 |
928 SDLtoDFBRect(srcrect, &sr); | 929 SDLtoDFBRect(srcrect, &sr); |
929 SDLtoDFBRect(dstrect, &dr); | 930 SDLtoDFBRect(dstrect, &dr); |
930 | 931 |
931 SDL_DFB_CHECKERR(data->surface->SetColor(data->surface, 0xFF, | 932 SDL_DFB_CHECKERR(data-> |
932 0xFF, 0xFF, 0xFF)); | 933 surface->SetColor(data->surface, 0xFF, 0xFF, 0xFF, |
933 if (texture-> | 934 0xFF)); |
934 modMode & (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA)) | 935 if (texture->modMode & |
935 { | 936 (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA)) { |
936 if (texture->modMode & SDL_TEXTUREMODULATE_ALPHA) { | 937 if (texture->modMode & SDL_TEXTUREMODULATE_ALPHA) { |
937 alpha = texture->a; | 938 alpha = texture->a; |
938 SDL_DFB_CHECKERR(data->surface->SetColor(data->surface, 0xFF, | 939 SDL_DFB_CHECKERR(data-> |
939 0xFF, 0xFF, alpha)); | 940 surface->SetColor(data->surface, 0xFF, 0xFF, |
941 0xFF, alpha)); | |
940 } | 942 } |
941 if (texture->modMode & SDL_TEXTUREMODULATE_COLOR) { | 943 if (texture->modMode & SDL_TEXTUREMODULATE_COLOR) { |
942 | 944 |
943 SDL_DFB_CHECKERR(data->surface-> | 945 SDL_DFB_CHECKERR(data->surface->SetColor(data->surface, |
944 SetColor(data->surface, texture->r, | 946 texture->r, |
945 texture->g, texture->b, alpha)); | 947 texture->g, |
948 texture->b, alpha)); | |
946 flags |= DSBLIT_COLORIZE; | 949 flags |= DSBLIT_COLORIZE; |
947 } | 950 } |
948 if (alpha < 0xFF) | 951 if (alpha < 0xFF) |
949 flags |= DSBLIT_SRC_PREMULTCOLOR; | 952 flags |= DSBLIT_SRC_PREMULTCOLOR; |
950 } else | 953 } else |
951 SDL_DFB_CHECKERR(data->surface->SetColor(data->surface, 0xFF, | 954 SDL_DFB_CHECKERR(data-> |
952 0xFF, 0xFF, 0xFF)); | 955 surface->SetColor(data->surface, 0xFF, 0xFF, |
956 0xFF, 0xFF)); | |
953 | 957 |
954 SetBlendMode(data, texture->blendMode, texturedata); | 958 SetBlendMode(data, texture->blendMode, texturedata); |
955 | 959 |
956 SDL_DFB_CHECKERR(data->surface-> | 960 SDL_DFB_CHECKERR(data->surface->SetBlittingFlags(data->surface, |
957 SetBlittingFlags(data->surface, | 961 data->blitFlags |
958 data->blitFlags | flags)); | 962 | flags)); |
959 | 963 |
960 #if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) | 964 #if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) |
961 SDL_DFB_CHECKERR(data->surface->SetRenderOptions(data->surface, | 965 SDL_DFB_CHECKERR(data->surface->SetRenderOptions(data->surface, |
962 texturedata-> | 966 texturedata-> |
963 render_options)); | 967 render_options)); |
964 #endif | 968 #endif |
965 | 969 |
966 if (srcrect->w == dstrect->w && srcrect->h == dstrect->h) { | 970 if (srcrect->w == dstrect->w && srcrect->h == dstrect->h) { |
967 SDL_DFB_CHECKERR(data->surface-> | 971 SDL_DFB_CHECKERR(data->surface->Blit(data->surface, |
968 Blit(data->surface, texturedata->surface, | 972 texturedata->surface, |
969 &sr, dr.x, dr.y)); | 973 &sr, dr.x, dr.y)); |
970 } else { | 974 } else { |
971 SDL_DFB_CHECKERR(data->surface-> | 975 SDL_DFB_CHECKERR(data->surface->StretchBlit(data->surface, |
972 StretchBlit(data->surface, texturedata->surface, | 976 texturedata->surface, |
973 &sr, &dr)); | 977 &sr, &dr)); |
974 } | 978 } |
975 } | 979 } |
976 return 0; | 980 return 0; |
977 error: | 981 error: |
978 return -1; | 982 return -1; |
981 static void | 985 static void |
982 DirectFB_RenderPresent(SDL_Renderer * renderer) | 986 DirectFB_RenderPresent(SDL_Renderer * renderer) |
983 { | 987 { |
984 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; | 988 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; |
985 SDL_Window *window = SDL_GetWindowFromID(renderer->window); | 989 SDL_Window *window = SDL_GetWindowFromID(renderer->window); |
990 SDL_DFB_WINDOWDATA(window); | |
986 | 991 |
987 DFBRectangle sr; | 992 DFBRectangle sr; |
988 DFBResult ret; | 993 DFBResult ret; |
989 | 994 |
990 sr.x = 0; | 995 sr.x = 0; |
991 sr.y = 0; | 996 sr.y = 0; |
992 sr.w = window->w; | 997 sr.w = window->w; |
993 sr.h = window->h; | 998 sr.h = window->h; |
994 | 999 |
995 /* Send the data to the display */ | 1000 /* Send the data to the display */ |
996 SDL_DFB_CHECKERR(data->surface-> | 1001 SDL_DFB_CHECK(windata->window_surface->Flip(windata->window_surface, NULL, |
997 Flip(data->surface, NULL, data->flipflags)); | 1002 data->flipflags)); |
998 | |
999 return; | |
1000 error: | |
1001 return; | |
1002 } | 1003 } |
1003 | 1004 |
1004 static void | 1005 static void |
1005 DirectFB_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture) | 1006 DirectFB_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture) |
1006 { | 1007 { |