comparison src/video/photon/SDL_ph_image.c @ 886:05c551e5bc64

Date: Sat, 24 Apr 2004 15:13:32 +0300 From: "Mike Gorchak" Subject: SDL updates for the QNX6 1. Updated the README.QNX 2. Updated libtool scripts, which are shipped with SDL for QNX6 support. 3. Added some code to support the new QNX 6.3.0, which is in beta now. 4. Added code to detect the hw features, which driver supports. 5. Added hw alpha blits code. 6. Fixed bug when application switches to fullscreen more the 2 times. (afte\ r that window becames always stay on top). 7. Updated a bit README for the tests. 8. Added information about acceleration show in the testalpha.c test. 9. Added small fixes to the testoverlay2.c test. 10. Added alpha and cc+alpha blits benchmarks to the testvidinfo.c test.
author Sam Lantinga <slouken@libsdl.org>
date Thu, 06 May 2004 15:55:06 +0000
parents 30168104389f
children 4ab6d1fd028f
comparison
equal deleted inserted replaced
885:9f6ad2286011 886:05c551e5bc64
150 return -1; 150 return -1;
151 } 151 }
152 break; 152 break;
153 } 153 }
154 154
155 /* Currently only offscreen contexts with the same bit depth as the 155 /* Currently offscreen contexts with the same bit depth as display bpp only can be created */
156 * display can be created. */
157 OCImage.offscreen_context = PdCreateOffscreenContext(0, screen->w, screen->h, Pg_OSC_MEM_PAGE_ALIGN); 156 OCImage.offscreen_context = PdCreateOffscreenContext(0, screen->w, screen->h, Pg_OSC_MEM_PAGE_ALIGN);
158 157
159 if (OCImage.offscreen_context == NULL) 158 if (OCImage.offscreen_context == NULL)
160 { 159 {
161 SDL_SetError("ph_SetupOCImage(): PdCreateOffscreenContext() function failed !\n"); 160 SDL_SetError("ph_SetupOCImage(): PdCreateOffscreenContext() function failed !\n");
480 { 479 {
481 SDL_SetError("ph_UpdateHWInfo(): GetVideoModeInfo() function failed !\n"); 480 SDL_SetError("ph_UpdateHWInfo(): GetVideoModeInfo() function failed !\n");
482 return -1; 481 return -1;
483 } 482 }
484 483
485 this->info.blit_hw = 1; 484 if ((vmode.mode_capabilities1 & PgVM_MODE_CAP1_OFFSCREEN) == PgVM_MODE_CAP1_OFFSCREEN)
485 {
486 /* this is a special test for drivers which tries to lie about offscreen capability */
487 if (hwcaps.currently_available_video_ram!=0)
488 {
489 this->info.hw_available = 1;
490 }
491 else
492 {
493 this->info.hw_available = 0;
494 }
495 }
496 else
497 {
498 this->info.hw_available = 0;
499 }
500
501 if ((vmode.mode_capabilities2 & PgVM_MODE_CAP2_RECTANGLE) == PgVM_MODE_CAP2_RECTANGLE)
502 {
503 this->info.blit_fill = 1;
504 }
505 else
506 {
507 this->info.blit_fill = 0;
508 }
509
510 if ((vmode.mode_capabilities2 & PgVM_MODE_CAP2_BITBLT) == PgVM_MODE_CAP2_BITBLT)
511 {
512 this->info.blit_hw = 1;
513 }
514 else
515 {
516 this->info.blit_hw = 0;
517 }
486 518
487 if ((vmode.mode_capabilities2 & PgVM_MODE_CAP2_ALPHA_BLEND) == PgVM_MODE_CAP2_ALPHA_BLEND) 519 if ((vmode.mode_capabilities2 & PgVM_MODE_CAP2_ALPHA_BLEND) == PgVM_MODE_CAP2_ALPHA_BLEND)
488 { 520 {
489 this->info.blit_hw_A = 1; 521 this->info.blit_hw_A = 1;
490 } 522 }
491 else 523 else
492 { 524 {
493 this->info.blit_hw_A = 0; 525 this->info.blit_hw_A = 0;
494 } 526 }
495 527
496 if ((vmode.mode_capabilities2 & PgVM_MODE_CAP2_CHROMA) == PgVM_MODE_CAP2_CHROMA) 528 if ((vmode.mode_capabilities2 & PgVM_MODE_CAP2_CHROMA) == PgVM_MODE_CAP2_CHROMA)
497 { 529 {
498 this->info.blit_hw_CC = 1; 530 this->info.blit_hw_CC = 1;
499 } 531 }
500 else 532 else
501 { 533 {
502 this->info.blit_hw_CC = 0; 534 this->info.blit_hw_CC = 0;
503 } 535 }
504 536
505 return 0; 537 return 0;
506 } 538 }
507 539
746 { 778 {
747 PgColor_t oldcolor; 779 PgColor_t oldcolor;
748 Uint32 truecolor; 780 Uint32 truecolor;
749 int ydisp=0; 781 int ydisp=0;
750 782
783 if (this->info.blit_fill!=1)
784 {
785 return -1;
786 }
787
751 truecolor=ph_ExpandColor(this, surface, color); 788 truecolor=ph_ExpandColor(this, surface, color);
752 if (truecolor==0xFFFFFFFFUL) 789 if (truecolor==0xFFFFFFFFUL)
753 { 790 {
754 return -1; 791 return -1;
755 } 792 }
881 { 918 {
882 if ((src->flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY) 919 if ((src->flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY)
883 { 920 {
884 ph_SetHWColorKey(this, src, src->format->colorkey); 921 ph_SetHWColorKey(this, src, src->format->colorkey);
885 PgChromaOn(); 922 PgChromaOn();
923 }
924
925 if ((src->flags & SDL_SRCALPHA) == SDL_SRCALPHA)
926 {
927 ph_SetHWAlpha(this, src, src->format->alpha);
928 PgAlphaOn();
886 } 929 }
887 930
888 if (dst == this->screen) 931 if (dst == this->screen)
889 { 932 {
890 if (src == this->screen) 933 if (src == this->screen)
914 /* blitting offscreen to offscreen */ 957 /* blitting offscreen to offscreen */
915 PgContextBlitArea(src->hwdata->offscreenctx, &srcarea, dst->hwdata->offscreenctx, &dstarea); 958 PgContextBlitArea(src->hwdata->offscreenctx, &srcarea, dst->hwdata->offscreenctx, &dstarea);
916 } 959 }
917 } 960 }
918 961
962 if ((src->flags & SDL_SRCALPHA) == SDL_SRCALPHA)
963 {
964 PgAlphaOff();
965 }
966
919 if ((src->flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY) 967 if ((src->flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY)
920 { 968 {
921 PgChromaOff(); 969 PgChromaOff();
922 } 970 }
923 } 971 }
933 return 0; 981 return 0;
934 } 982 }
935 983
936 int ph_SetHWColorKey(_THIS, SDL_Surface *surface, Uint32 key) 984 int ph_SetHWColorKey(_THIS, SDL_Surface *surface, Uint32 key)
937 { 985 {
986 if (this->info.blit_hw_CC!=1)
987 {
988 return -1;
989 }
990
938 if (surface->hwdata!=NULL) 991 if (surface->hwdata!=NULL)
939 { 992 {
940 surface->hwdata->colorkey=ph_ExpandColor(this, surface, key); 993 surface->hwdata->colorkey=ph_ExpandColor(this, surface, key);
941 if (surface->hwdata->colorkey==0xFFFFFFFFUL) 994 if (surface->hwdata->colorkey==0xFFFFFFFFUL)
942 { 995 {
948 return 0; 1001 return 0;
949 } 1002 }
950 1003
951 int ph_SetHWAlpha(_THIS, SDL_Surface* surface, Uint8 alpha) 1004 int ph_SetHWAlpha(_THIS, SDL_Surface* surface, Uint8 alpha)
952 { 1005 {
953 return -1; 1006 if (this->info.blit_hw_A!=1)
1007 {
1008 return -1;
1009 }
1010
1011 PgSetAlphaBlend(NULL, alpha);
1012
1013 return 0;
954 } 1014 }
955 1015
956 #ifdef HAVE_OPENGL 1016 #ifdef HAVE_OPENGL
957 void ph_OpenGLUpdate(_THIS, int numrects, SDL_Rect* rects) 1017 void ph_OpenGLUpdate(_THIS, int numrects, SDL_Rect* rects)
958 { 1018 {