comparison src/video/SDL_video.c @ 2257:340942cfda48

Moved the colorkey and per-surface alpha into the blit info, in preparation for support for general color channel modulation. Removed and consolidated some data in the blit info.
author Sam Lantinga <slouken@libsdl.org>
date Fri, 17 Aug 2007 00:54:53 +0000
parents 989fb86ad1ec
children e61ad15a205f
comparison
equal deleted inserted replaced
2256:e893d24ad8db 2257:340942cfda48
1593 } else { 1593 } else {
1594 SDL_UpdateTexture(textureID, NULL, surface->pixels, 1594 SDL_UpdateTexture(textureID, NULL, surface->pixels,
1595 surface->pitch); 1595 surface->pitch);
1596 } 1596 }
1597 } else { 1597 } else {
1598 Uint8 alpha; 1598 Uint32 cmod;
1599 SDL_Rect bounds; 1599 SDL_Rect bounds;
1600 SDL_Surface dst; 1600 SDL_Surface dst;
1601 1601
1602 /* Set up a destination surface for the texture update */ 1602 /* Set up a destination surface for the texture update */
1603 SDL_zero(dst); 1603 SDL_zero(dst);
1646 p += dst.pitch; 1646 p += dst.pitch;
1647 } 1647 }
1648 } 1648 }
1649 1649
1650 /* Copy over the alpha channel */ 1650 /* Copy over the alpha channel */
1651 cmod = surface->map->cmod;
1651 if (surface_flags & SDL_SRCALPHA) { 1652 if (surface_flags & SDL_SRCALPHA) {
1652 if (fmt->Amask) { 1653 if (fmt->Amask) {
1653 surface->flags &= ~SDL_SRCALPHA; 1654 surface->flags &= ~SDL_SRCALPHA;
1654 } else { 1655 } else {
1655 /* FIXME: Need to make sure the texture has an alpha channel 1656 /* FIXME: Need to make sure the texture has an alpha channel
1656 * and copy 'alpha' into the texture alpha channel. 1657 * and copy 'alpha' into the texture alpha channel.
1657 */ 1658 */
1658 alpha = surface->format->alpha;
1659 SDL_SetAlpha(surface, 0, 0); 1659 SDL_SetAlpha(surface, 0, 0);
1660 } 1660 }
1661 } 1661 }
1662 1662
1663 /* Copy over the image data */ 1663 /* Copy over the image data */
1671 if ((surface_flags & SDL_SRCALPHA) == SDL_SRCALPHA) { 1671 if ((surface_flags & SDL_SRCALPHA) == SDL_SRCALPHA) {
1672 Uint32 aflags = surface_flags & (SDL_SRCALPHA | SDL_RLEACCELOK); 1672 Uint32 aflags = surface_flags & (SDL_SRCALPHA | SDL_RLEACCELOK);
1673 if (fmt->Amask) { 1673 if (fmt->Amask) {
1674 surface->flags |= SDL_SRCALPHA; 1674 surface->flags |= SDL_SRCALPHA;
1675 } else { 1675 } else {
1676 SDL_SetAlpha(surface, aflags, alpha); 1676 SDL_SetAlpha(surface, aflags, (cmod >> 24));
1677 } 1677 }
1678 } 1678 }
1679 1679
1680 /* Update the texture */ 1680 /* Update the texture */
1681 SDL_UpdateTexture(textureID, NULL, dst.pixels, dst.pitch); 1681 SDL_UpdateTexture(textureID, NULL, dst.pixels, dst.pitch);