comparison src/video/SDL_video.c @ 2787:93764fe8601a

It turns out both the software and the OpenGL renderer had the same problem. According to the spec, when SDL_SRCALPHA is set, the colorkey is ignored, so we just need to convert the colorkey into the alpha channel.
author Sam Lantinga <slouken@libsdl.org>
date Tue, 25 Nov 2008 05:29:14 +0000
parents 6bacfecbf27e
children 985001797115
comparison
equal deleted inserted replaced
2786:6bacfecbf27e 2787:93764fe8601a
43 /* On Windows, windows.h defines CreateWindow */ 43 /* On Windows, windows.h defines CreateWindow */
44 #ifdef CreateWindow 44 #ifdef CreateWindow
45 #undef CreateWindow 45 #undef CreateWindow
46 #endif 46 #endif
47 #endif /* SDL_VIDEO_OPENGL */ 47 #endif /* SDL_VIDEO_OPENGL */
48
49 /* From SDL_surface.c */
50 extern void SDL_ConvertColorkeyToAlpha(SDL_Surface * surface);
51 48
52 /* Available video drivers */ 49 /* Available video drivers */
53 static VideoBootStrap *bootstrap[] = { 50 static VideoBootStrap *bootstrap[] = {
54 #if SDL_VIDEO_DRIVER_COCOA 51 #if SDL_VIDEO_DRIVER_COCOA
55 &COCOA_bootstrap, 52 &COCOA_bootstrap,
1586 SDL_BITSPERPIXEL(format)); 1583 SDL_BITSPERPIXEL(format));
1587 } 1584 }
1588 } 1585 }
1589 dst = SDL_ConvertSurface(surface, dst_fmt, 0); 1586 dst = SDL_ConvertSurface(surface, dst_fmt, 0);
1590 if (dst) { 1587 if (dst) {
1591 SDL_ConvertColorkeyToAlpha(dst);
1592 SDL_UpdateTexture(textureID, NULL, dst->pixels, dst->pitch); 1588 SDL_UpdateTexture(textureID, NULL, dst->pixels, dst->pitch);
1593 SDL_FreeSurface(dst); 1589 SDL_FreeSurface(dst);
1594 } 1590 }
1595 if (dst_fmt->palette) { 1591 if (dst_fmt->palette) {
1596 SDL_FreePalette(dst_fmt->palette); 1592 SDL_FreePalette(dst_fmt->palette);