Mercurial > sdl-ios-xcode
comparison src/video/directfb/SDL_DirectFB_render.c @ 2930:8acbb14124c5
Date: Mon, 29 Dec 2008 23:29:52 +0100
From: Couriersud
I have attached the latest DirectFB changes.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 30 Dec 2008 17:02:53 +0000 |
parents | 2133d2d300fd |
children | 8f4ed5ec2b06 |
comparison
equal
deleted
inserted
replaced
2929:81fc47035302 | 2930:8acbb14124c5 |
---|---|
203 DSBF_INVSRCALPHA); | 203 DSBF_INVSRCALPHA); |
204 break; | 204 break; |
205 case SDL_BLENDMODE_ADD: | 205 case SDL_BLENDMODE_ADD: |
206 data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL; | 206 data->blitFlags = DSBLIT_BLEND_ALPHACHANNEL; |
207 data->drawFlags = DSDRAW_BLEND; | 207 data->drawFlags = DSDRAW_BLEND; |
208 //FIXME: SRCALPHA kills performance on radeon ... | 208 // FIXME: SRCALPHA kills performance on radeon ... |
209 //Eventually use a premultiplied texture | 209 // It will be cheaper to copy the surface to |
210 if (0 && TextureHasAlpha(source)) | 210 // a temporay surface and premultiply |
211 if (source && TextureHasAlpha(source)) | |
211 data->surface->SetSrcBlendFunction(data->surface, | 212 data->surface->SetSrcBlendFunction(data->surface, |
212 DSBF_SRCALPHA); | 213 DSBF_SRCALPHA); |
213 else | 214 else |
214 data->surface->SetSrcBlendFunction(data->surface, DSBF_ONE); | 215 data->surface->SetSrcBlendFunction(data->surface, DSBF_ONE); |
215 data->surface->SetDstBlendFunction(data->surface, DSBF_ONE); | 216 data->surface->SetDstBlendFunction(data->surface, DSBF_ONE); |
711 Uint8 *dpixels; | 712 Uint8 *dpixels; |
712 int dpitch; | 713 int dpitch; |
713 Uint8 *src, *dst; | 714 Uint8 *src, *dst; |
714 int row; | 715 int row; |
715 size_t length; | 716 size_t length; |
717 int bpp = DFB_BYTES_PER_PIXEL(SDLToDFBPixelFormat(texture->format)); | |
718 // FIXME: SDL_BYTESPERPIXEL(texture->format) broken for yuv yv12 3 planes | |
716 | 719 |
717 SDL_DFB_CHECKERR(data->surface->Lock(data->surface, | 720 SDL_DFB_CHECKERR(data->surface->Lock(data->surface, |
718 DSLF_WRITE | DSLF_READ, | 721 DSLF_WRITE | DSLF_READ, |
719 ((void **) &dpixels), &dpitch)); | 722 ((void **) &dpixels), &dpitch)); |
720 src = (Uint8 *) pixels; | 723 src = (Uint8 *) pixels; |
721 dst = | 724 dst = (Uint8 *) dpixels + rect->y * dpitch + rect->x * bpp; |
722 (Uint8 *) dpixels + rect->y * dpitch + | 725 length = rect->w * bpp; |
723 rect->x * SDL_BYTESPERPIXEL(texture->format); | |
724 length = rect->w * SDL_BYTESPERPIXEL(texture->format); | |
725 for (row = 0; row < rect->h; ++row) { | 726 for (row = 0; row < rect->h; ++row) { |
726 SDL_memcpy(dst, src, length); | 727 SDL_memcpy(dst, src, length); |
727 src += pitch; | 728 src += pitch; |
728 dst += dpitch; | 729 dst += dpitch; |
729 } | 730 } |
834 { | 835 { |
835 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; | 836 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; |
836 DFBResult ret; | 837 DFBResult ret; |
837 | 838 |
838 PrepareDraw(renderer); | 839 PrepareDraw(renderer); |
839 SDL_DFB_CHECKERR(data->surface->DrawPoint(data->surface, x, y)); | 840 SDL_DFB_CHECKERR(data->surface->DrawLine(data->surface, x, y, x, y)); |
840 return 0; | 841 return 0; |
841 error: | 842 error: |
842 return -1; | 843 return -1; |
843 } | 844 } |
844 | 845 |
847 { | 848 { |
848 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; | 849 DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; |
849 DFBResult ret; | 850 DFBResult ret; |
850 | 851 |
851 PrepareDraw(renderer); | 852 PrepareDraw(renderer); |
853 /* Use antialiasing when available */ | |
854 #if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 2) | |
855 SDL_DFB_CHECKERR(data->surface->SetRenderOptions(data->surface, | |
856 DSRO_ANTIALIAS)); | |
857 #endif | |
852 SDL_DFB_CHECKERR(data->surface->DrawLine(data->surface, x1, y1, x2, y2)); | 858 SDL_DFB_CHECKERR(data->surface->DrawLine(data->surface, x1, y1, x2, y2)); |
853 return 0; | 859 return 0; |
854 error: | 860 error: |
855 return -1; | 861 return -1; |
856 } | 862 } |