| Summary: | test/testalpha.c background of smiley face is visible | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Bob Pendleton <bob> |
| Component: | video | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | bob, paolo.bonzini |
| Version: | HG 2.0 | ||
| Hardware: | x86 | ||
| OS: | Linux | ||
|
Description
Bob Pendleton
2008-02-29 09:39:10 UTC
What is happening is something like this. The sprite is an RLE surface that is also being alpha blended. Everything works fine until the alpha level reaches 255. At that point the blit code decides to recompute the blit function to optimize for what is now an opaque alpha level. As part of that it calls SDL_UnRLESurface which seems to lose the colorkey information which was used when the sprite was RLE compressed. I've added a printf to SDL_LowerBlit to trace the the address of the src & dst and their flags values after the call to SDL_MapSurface. I'll check it in with the line commented out. Here are the results of that line from the start of the program through showing the bug: bob@voyager:~/sdl/sdl1.3/test$ testalpha src = 0x00661DC0 src->flags = 00000000 src->map->info.flags = 00000000 dst = 0x00661B30 dst->flags = 00000000 dst->map->info.flags = 00000000 src->map->blit = 0x76aaf570 src = 0x00661C60 src->flags = 00000000 src->map->info.flags = 00000000 dst = 0x00661CD0 dst->flags = 00000000 dst->map->info.flags = 00000000 src->map->blit = 0x76aaf570 Screen is at 32 bits per pixel Screen is in system memory Sprite is in system memory src = 0x0065C6A0 src->flags = 00000000 src->map->info.flags = 00000000 dst = 0x00661CD0 dst->flags = 00000000 dst->map->info.flags = 00001000 src->map->blit = 0x76aaf570 src = 0x00661B30 src->flags = 00000001 src->map->info.flags = 00003122 dst = 0x0065C6A0 dst->flags = 00000001 dst->map->info.flags = 00000000 src->map->blit = 0x76aa94fb Sprite blit dosn't uses hardware alpha acceleration src = 0x00661CD0 src->flags = 00000001 src->map->info.flags = 00001000 dst = 0x0065C6A0 dst->flags = 00000001 dst->map->info.flags = 00000000 src->map->blit = 0x76aaf570 src = 0x00661B30 src->flags = 00000001 src->map->info.flags = 00002000 dst = 0x0065C6A0 dst->flags = 00000001 dst->map->info.flags = 00000000 src->map->blit = 0x76aaf570 src = 0x00661B30 src->flags = 00000001 src->map->info.flags = 00002022 dst = 0x0065C6A0 dst->flags = 00000001 dst->map->info.flags = 00000000 src->map->blit = 0x76aaf570 src = 0x00661B30 src->flags = 00000001 src->map->info.flags = 00002020 dst = 0x0065C6A0 dst->flags = 00000001 dst->map->info.flags = 00000000 src->map->blit = 0x76aaf570 src = 0x00661B30 src->flags = 00000001 src->map->info.flags = 00002022 dst = 0x0065C6A0 dst->flags = 00000001 dst->map->info.flags = 00000000 src->map->blit = 0x76aaf570 You can see how the info.flags changes from just SDL_COPY_RLE_COLORKEY to add in SDL_COPY_MODULATE_ALPHA and SDL_COPY_BLEND. Which seems to be related to the problem. Hope this helps. I actually have a fix for this in progress, but it's a slight rearchitecting of the 2D blitting system and is taking a while to finish. I may have to revert your checkin of revision 3573 to avoid conflicts. I checked in a better, non-invasive fix. The basic problem was that the surface had both SDL_SRCALPHA and a colorkey set, which according to the spec, results in the colorkey being ignored. |