Mercurial > sdl-ios-xcode
comparison src/video/directfb/SDL_DirectFB_render.c @ 3013:8cc00819c8d6
Reverted Bob's indent checkin
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 10 Jan 2009 21:50:26 +0000 |
parents | 8f4ed5ec2b06 |
children | d72a0dd80e8b |
comparison
equal
deleted
inserted
replaced
3012:7e30c2dc7783 | 3013:8cc00819c8d6 |
---|---|
416 | 416 |
417 if (renddata->size_changed) { | 417 if (renddata->size_changed) { |
418 int cw, ch; | 418 int cw, ch; |
419 int ret; | 419 int ret; |
420 | 420 |
421 SDL_DFB_CHECKERR(windata-> | 421 SDL_DFB_CHECKERR(windata->surface-> |
422 surface->GetSize(windata->surface, &cw, &ch)); | 422 GetSize(windata->surface, &cw, &ch)); |
423 if (cw != window->w || ch != window->h) | 423 if (cw != window->w || ch != window->h) |
424 SDL_DFB_CHECKERR(windata-> | 424 SDL_DFB_CHECKERR(windata->window-> |
425 window->ResizeSurface(windata->window, window->w, | 425 ResizeSurface(windata->window, window->w, |
426 window->h)); | 426 window->h)); |
427 } | 427 } |
428 return 0; | 428 return 0; |
429 error: | 429 error: |
430 return -1; | 430 return -1; |
431 } | 431 } |
460 layconf.width = texture->w; | 460 layconf.width = texture->w; |
461 layconf.height = texture->h; | 461 layconf.height = texture->h; |
462 layconf.pixelformat = SDLToDFBPixelFormat(data->format); | 462 layconf.pixelformat = SDLToDFBPixelFormat(data->format); |
463 layconf.surface_caps = DSCAPS_VIDEOONLY | DSCAPS_DOUBLE; | 463 layconf.surface_caps = DSCAPS_VIDEOONLY | DSCAPS_DOUBLE; |
464 | 464 |
465 SDL_DFB_CHECKERR(devdata-> | 465 SDL_DFB_CHECKERR(devdata->dfb-> |
466 dfb->GetDisplayLayer(devdata->dfb, dispdata->vidID, | 466 GetDisplayLayer(devdata->dfb, dispdata->vidID, |
467 &dispdata->vidlayer)); | 467 &dispdata->vidlayer)); |
468 SDL_DFB_CHECKERR(dispdata-> | 468 SDL_DFB_CHECKERR(dispdata->vidlayer-> |
469 vidlayer->SetCooperativeLevel(dispdata->vidlayer, | 469 SetCooperativeLevel(dispdata->vidlayer, |
470 DLSCL_EXCLUSIVE)); | 470 DLSCL_EXCLUSIVE)); |
471 | 471 |
472 if (devdata->use_yuv_underlays) { | 472 if (devdata->use_yuv_underlays) { |
473 ret = dispdata->vidlayer->SetLevel(dispdata->vidlayer, -1); | 473 ret = dispdata->vidlayer->SetLevel(dispdata->vidlayer, -1); |
474 if (ret != DFB_OK) | 474 if (ret != DFB_OK) |
475 SDL_DFB_DEBUG("Underlay Setlevel not supported\n"); | 475 SDL_DFB_DEBUG("Underlay Setlevel not supported\n"); |
476 } | 476 } |
477 SDL_DFB_CHECKERR(dispdata-> | 477 SDL_DFB_CHECKERR(dispdata->vidlayer-> |
478 vidlayer->SetConfiguration(dispdata->vidlayer, | 478 SetConfiguration(dispdata->vidlayer, &layconf)); |
479 &layconf)); | 479 SDL_DFB_CHECKERR(dispdata->vidlayer-> |
480 SDL_DFB_CHECKERR(dispdata-> | 480 GetSurface(dispdata->vidlayer, &data->surface)); |
481 vidlayer->GetSurface(dispdata->vidlayer, | |
482 &data->surface)); | |
483 dispdata->vidIDinuse = 1; | 481 dispdata->vidIDinuse = 1; |
484 data->display = display; | 482 data->display = display; |
485 return 0; | 483 return 0; |
486 } | 484 } |
487 return 1; | 485 return 1; |
488 error: | 486 error: |
489 if (dispdata->vidlayer) { | 487 if (dispdata->vidlayer) { |
490 SDL_DFB_RELEASE(data->surface); | 488 SDL_DFB_RELEASE(data->surface); |
491 SDL_DFB_CHECKERR(dispdata-> | 489 SDL_DFB_CHECKERR(dispdata->vidlayer-> |
492 vidlayer->SetCooperativeLevel(dispdata->vidlayer, | 490 SetCooperativeLevel(dispdata->vidlayer, |
493 DLSCL_ADMINISTRATIVE)); | 491 DLSCL_ADMINISTRATIVE)); |
494 SDL_DFB_RELEASE(dispdata->vidlayer); | 492 SDL_DFB_RELEASE(dispdata->vidlayer); |
495 } | 493 } |
496 return 1; | 494 return 1; |
497 } | 495 } |
498 | 496 |
540 } | 538 } |
541 | 539 |
542 data->pixels = NULL; | 540 data->pixels = NULL; |
543 | 541 |
544 /* Create the surface */ | 542 /* Create the surface */ |
545 SDL_DFB_CHECKERR(devdata-> | 543 SDL_DFB_CHECKERR(devdata->dfb-> |
546 dfb->CreateSurface(devdata->dfb, &dsc, | 544 CreateSurface(devdata->dfb, &dsc, &data->surface)); |
547 &data->surface)); | |
548 if (SDL_ISPIXELFORMAT_INDEXED(data->format) | 545 if (SDL_ISPIXELFORMAT_INDEXED(data->format) |
549 && !SDL_ISPIXELFORMAT_FOURCC(data->format)) { | 546 && !SDL_ISPIXELFORMAT_FOURCC(data->format)) { |
550 SDL_DFB_CHECKERR(data-> | 547 SDL_DFB_CHECKERR(data->surface-> |
551 surface->GetPalette(data->surface, | 548 GetPalette(data->surface, &data->palette)); |
552 &data->palette)); | |
553 } | 549 } |
554 | 550 |
555 } | 551 } |
556 #if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) | 552 #if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) |
557 data->render_options = DSRO_NONE; | 553 data->render_options = DSRO_NONE; |
604 entries[i].r = colors[i].r; | 600 entries[i].r = colors[i].r; |
605 entries[i].g = colors[i].g; | 601 entries[i].g = colors[i].g; |
606 entries[i].b = colors[i].b; | 602 entries[i].b = colors[i].b; |
607 entries[i].a = 0xFF; | 603 entries[i].a = 0xFF; |
608 } | 604 } |
609 SDL_DFB_CHECKERR(data-> | 605 SDL_DFB_CHECKERR(data->palette-> |
610 palette->SetEntries(data->palette, entries, ncolors, | 606 SetEntries(data->palette, entries, ncolors, |
611 firstcolor)); | 607 firstcolor)); |
612 return 0; | 608 return 0; |
613 } else { | 609 } else { |
614 SDL_SetError("YUV textures don't have a palette"); | 610 SDL_SetError("YUV textures don't have a palette"); |
615 return -1; | 611 return -1; |
616 } | 612 } |
628 if (SDL_ISPIXELFORMAT_INDEXED(data->format) | 624 if (SDL_ISPIXELFORMAT_INDEXED(data->format) |
629 && !SDL_ISPIXELFORMAT_FOURCC(data->format)) { | 625 && !SDL_ISPIXELFORMAT_FOURCC(data->format)) { |
630 DFBColor entries[256]; | 626 DFBColor entries[256]; |
631 int i; | 627 int i; |
632 | 628 |
633 SDL_DFB_CHECKERR(data-> | 629 SDL_DFB_CHECKERR(data->palette-> |
634 palette->GetEntries(data->palette, entries, ncolors, | 630 GetEntries(data->palette, entries, ncolors, |
635 firstcolor)); | 631 firstcolor)); |
636 | 632 |
637 for (i = 0; i < ncolors; ++i) { | 633 for (i = 0; i < ncolors; ++i) { |
638 colors[i].r = entries[i].r; | 634 colors[i].r = entries[i].r; |
639 colors[i].g = entries[i].g; | 635 colors[i].g = entries[i].g; |
640 colors[i].b = entries[i].b; | 636 colors[i].b = entries[i].b; |
809 g = renderer->g; | 805 g = renderer->g; |
810 b = renderer->b; | 806 b = renderer->b; |
811 a = renderer->a; | 807 a = renderer->a; |
812 | 808 |
813 SetBlendMode(data, renderer->blendMode, NULL); | 809 SetBlendMode(data, renderer->blendMode, NULL); |
814 SDL_DFB_CHECKERR(data-> | 810 SDL_DFB_CHECKERR(data->surface-> |
815 surface->SetDrawingFlags(data->surface, | 811 SetDrawingFlags(data->surface, data->drawFlags)); |
816 data->drawFlags)); | |
817 | 812 |
818 switch (renderer->blendMode) { | 813 switch (renderer->blendMode) { |
819 case SDL_BLENDMODE_NONE: | 814 case SDL_BLENDMODE_NONE: |
820 case SDL_BLENDMODE_MASK: | 815 case SDL_BLENDMODE_MASK: |
821 case SDL_BLENDMODE_BLEND: | 816 case SDL_BLENDMODE_BLEND: |
871 { | 866 { |
872 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; | 867 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; |
873 DFBResult ret; | 868 DFBResult ret; |
874 | 869 |
875 PrepareDraw(renderer); | 870 PrepareDraw(renderer); |
876 SDL_DFB_CHECKERR(data-> | 871 SDL_DFB_CHECKERR(data->surface-> |
877 surface->FillRectangle(data->surface, rect->x, rect->y, | 872 FillRectangle(data->surface, rect->x, rect->y, rect->w, |
878 rect->w, rect->h)); | 873 rect->h)); |
879 | 874 |
880 return 0; | 875 return 0; |
881 error: | 876 error: |
882 return -1; | 877 return -1; |
883 } | 878 } |
897 SDL_Window *window = SDL_GetWindowFromID(renderer->window); | 892 SDL_Window *window = SDL_GetWindowFromID(renderer->window); |
898 SDL_DFB_WINDOWDATA(window); | 893 SDL_DFB_WINDOWDATA(window); |
899 SDL_VideoDisplay *display = texturedata->display; | 894 SDL_VideoDisplay *display = texturedata->display; |
900 DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata; | 895 DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata; |
901 | 896 |
902 SDL_DFB_CHECKERR(dispdata-> | 897 SDL_DFB_CHECKERR(dispdata->vidlayer-> |
903 vidlayer->SetSourceRectangle(dispdata->vidlayer, | 898 SetSourceRectangle(dispdata->vidlayer, srcrect->x, |
904 srcrect->x, srcrect->y, | 899 srcrect->y, srcrect->w, |
905 srcrect->w, | 900 srcrect->h)); |
906 srcrect->h)); | |
907 windata->window->GetPosition(windata->window, &px, &py); | 901 windata->window->GetPosition(windata->window, &px, &py); |
908 SDL_DFB_CHECKERR(dispdata-> | 902 SDL_DFB_CHECKERR(dispdata->vidlayer-> |
909 vidlayer->SetScreenRectangle(dispdata->vidlayer, | 903 SetScreenRectangle(dispdata->vidlayer, |
910 px + dstrect->x, | 904 px + dstrect->x, py + dstrect->y, |
911 py + dstrect->y, | 905 dstrect->w, dstrect->h)); |
912 dstrect->w, | |
913 dstrect->h)); | |
914 } else { | 906 } else { |
915 DFBRectangle sr, dr; | 907 DFBRectangle sr, dr; |
916 DFBSurfaceBlittingFlags flags = 0; | 908 DFBSurfaceBlittingFlags flags = 0; |
917 | 909 |
918 if (texturedata->dirty.list) { | 910 if (texturedata->dirty.list) { |
936 SDLtoDFBRect(srcrect, &sr); | 928 SDLtoDFBRect(srcrect, &sr); |
937 SDLtoDFBRect(dstrect, &dr); | 929 SDLtoDFBRect(dstrect, &dr); |
938 | 930 |
939 SDL_DFB_CHECKERR(data->surface->SetColor(data->surface, 0xFF, | 931 SDL_DFB_CHECKERR(data->surface->SetColor(data->surface, 0xFF, |
940 0xFF, 0xFF, 0xFF)); | 932 0xFF, 0xFF, 0xFF)); |
941 if (texture->modMode & | 933 if (texture-> |
942 (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA)) { | 934 modMode & (SDL_TEXTUREMODULATE_COLOR | SDL_TEXTUREMODULATE_ALPHA)) |
935 { | |
943 if (texture->modMode & SDL_TEXTUREMODULATE_ALPHA) { | 936 if (texture->modMode & SDL_TEXTUREMODULATE_ALPHA) { |
944 alpha = texture->a; | 937 alpha = texture->a; |
945 SDL_DFB_CHECKERR(data->surface->SetColor(data->surface, 0xFF, | 938 SDL_DFB_CHECKERR(data->surface->SetColor(data->surface, 0xFF, |
946 0xFF, 0xFF, alpha)); | 939 0xFF, 0xFF, alpha)); |
947 } | 940 } |
948 if (texture->modMode & SDL_TEXTUREMODULATE_COLOR) { | 941 if (texture->modMode & SDL_TEXTUREMODULATE_COLOR) { |
949 | 942 |
950 SDL_DFB_CHECKERR(data-> | 943 SDL_DFB_CHECKERR(data->surface-> |
951 surface->SetColor(data->surface, texture->r, | 944 SetColor(data->surface, texture->r, |
952 texture->g, texture->b, | 945 texture->g, texture->b, alpha)); |
953 alpha)); | |
954 flags |= DSBLIT_COLORIZE; | 946 flags |= DSBLIT_COLORIZE; |
955 } | 947 } |
956 if (alpha < 0xFF) | 948 if (alpha < 0xFF) |
957 flags |= DSBLIT_SRC_PREMULTCOLOR; | 949 flags |= DSBLIT_SRC_PREMULTCOLOR; |
958 } else | 950 } else |
959 SDL_DFB_CHECKERR(data->surface->SetColor(data->surface, 0xFF, | 951 SDL_DFB_CHECKERR(data->surface->SetColor(data->surface, 0xFF, |
960 0xFF, 0xFF, 0xFF)); | 952 0xFF, 0xFF, 0xFF)); |
961 | 953 |
962 SetBlendMode(data, texture->blendMode, texturedata); | 954 SetBlendMode(data, texture->blendMode, texturedata); |
963 | 955 |
964 SDL_DFB_CHECKERR(data->surface->SetBlittingFlags(data->surface, | 956 SDL_DFB_CHECKERR(data->surface-> |
965 data-> | 957 SetBlittingFlags(data->surface, |
966 blitFlags | flags)); | 958 data->blitFlags | flags)); |
967 | 959 |
968 #if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) | 960 #if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) |
969 SDL_DFB_CHECKERR(data->surface->SetRenderOptions(data->surface, | 961 SDL_DFB_CHECKERR(data->surface->SetRenderOptions(data->surface, |
970 texturedata->render_options)); | 962 texturedata-> |
963 render_options)); | |
971 #endif | 964 #endif |
972 | 965 |
973 if (srcrect->w == dstrect->w && srcrect->h == dstrect->h) { | 966 if (srcrect->w == dstrect->w && srcrect->h == dstrect->h) { |
974 SDL_DFB_CHECKERR(data-> | 967 SDL_DFB_CHECKERR(data->surface-> |
975 surface->Blit(data->surface, | 968 Blit(data->surface, texturedata->surface, |
976 texturedata->surface, &sr, dr.x, | 969 &sr, dr.x, dr.y)); |
977 dr.y)); | |
978 } else { | 970 } else { |
979 SDL_DFB_CHECKERR(data-> | 971 SDL_DFB_CHECKERR(data->surface-> |
980 surface->StretchBlit(data->surface, | 972 StretchBlit(data->surface, texturedata->surface, |
981 texturedata->surface, &sr, | 973 &sr, &dr)); |
982 &dr)); | |
983 } | 974 } |
984 } | 975 } |
985 return 0; | 976 return 0; |
986 error: | 977 error: |
987 return -1; | 978 return -1; |
1000 sr.y = 0; | 991 sr.y = 0; |
1001 sr.w = window->w; | 992 sr.w = window->w; |
1002 sr.h = window->h; | 993 sr.h = window->h; |
1003 | 994 |
1004 /* Send the data to the display */ | 995 /* Send the data to the display */ |
1005 SDL_DFB_CHECKERR(data-> | 996 SDL_DFB_CHECKERR(data->surface-> |
1006 surface->Flip(data->surface, NULL, data->flipflags)); | 997 Flip(data->surface, NULL, data->flipflags)); |
1007 | 998 |
1008 return; | 999 return; |
1009 error: | 1000 error: |
1010 return; | 1001 return; |
1011 } | 1002 } |