Mercurial > sdl-ios-xcode
diff 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 |
line wrap: on
line diff
--- a/src/video/photon/SDL_ph_image.c Fri Apr 30 18:33:30 2004 +0000 +++ b/src/video/photon/SDL_ph_image.c Thu May 06 15:55:06 2004 +0000 @@ -152,8 +152,7 @@ break; } - /* Currently only offscreen contexts with the same bit depth as the - * display can be created. */ + /* Currently offscreen contexts with the same bit depth as display bpp only can be created */ OCImage.offscreen_context = PdCreateOffscreenContext(0, screen->w, screen->h, Pg_OSC_MEM_PAGE_ALIGN); if (OCImage.offscreen_context == NULL) @@ -482,24 +481,57 @@ return -1; } - this->info.blit_hw = 1; + if ((vmode.mode_capabilities1 & PgVM_MODE_CAP1_OFFSCREEN) == PgVM_MODE_CAP1_OFFSCREEN) + { + /* this is a special test for drivers which tries to lie about offscreen capability */ + if (hwcaps.currently_available_video_ram!=0) + { + this->info.hw_available = 1; + } + else + { + this->info.hw_available = 0; + } + } + else + { + this->info.hw_available = 0; + } + + if ((vmode.mode_capabilities2 & PgVM_MODE_CAP2_RECTANGLE) == PgVM_MODE_CAP2_RECTANGLE) + { + this->info.blit_fill = 1; + } + else + { + this->info.blit_fill = 0; + } + + if ((vmode.mode_capabilities2 & PgVM_MODE_CAP2_BITBLT) == PgVM_MODE_CAP2_BITBLT) + { + this->info.blit_hw = 1; + } + else + { + this->info.blit_hw = 0; + } if ((vmode.mode_capabilities2 & PgVM_MODE_CAP2_ALPHA_BLEND) == PgVM_MODE_CAP2_ALPHA_BLEND) { - this->info.blit_hw_A = 1; + this->info.blit_hw_A = 1; } else { - this->info.blit_hw_A = 0; + this->info.blit_hw_A = 0; } if ((vmode.mode_capabilities2 & PgVM_MODE_CAP2_CHROMA) == PgVM_MODE_CAP2_CHROMA) { - this->info.blit_hw_CC = 1; + this->info.blit_hw_CC = 1; } else { - this->info.blit_hw_CC = 0; + this->info.blit_hw_CC = 0; } return 0; @@ -748,6 +780,11 @@ Uint32 truecolor; int ydisp=0; + if (this->info.blit_fill!=1) + { + return -1; + } + truecolor=ph_ExpandColor(this, surface, color); if (truecolor==0xFFFFFFFFUL) { @@ -885,6 +922,12 @@ PgChromaOn(); } + if ((src->flags & SDL_SRCALPHA) == SDL_SRCALPHA) + { + ph_SetHWAlpha(this, src, src->format->alpha); + PgAlphaOn(); + } + if (dst == this->screen) { if (src == this->screen) @@ -916,6 +959,11 @@ } } + if ((src->flags & SDL_SRCALPHA) == SDL_SRCALPHA) + { + PgAlphaOff(); + } + if ((src->flags & SDL_SRCCOLORKEY) == SDL_SRCCOLORKEY) { PgChromaOff(); @@ -935,6 +983,11 @@ int ph_SetHWColorKey(_THIS, SDL_Surface *surface, Uint32 key) { + if (this->info.blit_hw_CC!=1) + { + return -1; + } + if (surface->hwdata!=NULL) { surface->hwdata->colorkey=ph_ExpandColor(this, surface, key); @@ -950,7 +1003,14 @@ int ph_SetHWAlpha(_THIS, SDL_Surface* surface, Uint8 alpha) { - return -1; + if (this->info.blit_hw_A!=1) + { + return -1; + } + + PgSetAlphaBlend(NULL, alpha); + + return 0; } #ifdef HAVE_OPENGL