From dec895409a8389b33b0697ee363c9815efee73a5 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 5 Sep 2004 08:48:45 +0000 Subject: [PATCH] ApplyHotPinkColorKey: simplify, fix quick alpha enable, and disable it for now --- stepmania/src/RageSurfaceUtils.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/stepmania/src/RageSurfaceUtils.cpp b/stepmania/src/RageSurfaceUtils.cpp index c564739852..fb5989db25 100644 --- a/stepmania/src/RageSurfaceUtils.cpp +++ b/stepmania/src/RageSurfaceUtils.cpp @@ -933,26 +933,25 @@ void RageSurfaceUtils::ApplyHotPinkColorKey( RageSurface *&img ) return; } - /* RGBA. */ - /* Make sure we have alpha. */ - if( !img->format->Amask ) + /* RGBA. Make sure we have alpha. */ + if( img->format->Amask == 0 ) { /* We don't have any alpha. Try to enable it without copying. */ - int usable_bits = (1<format->BitsPerPixel)-1; - usable_bits &= ~img->format->Rmask; - usable_bits &= ~img->format->Gmask; - usable_bits &= ~img->format->Bmask; + /* XXX: need to scan the surface and make sure the new alpha bit is always 1 */ + /* + const int used_bits = img->format->Rmask | img->format->Gmask | img->format->Bmask; - for( int i = 0; img->format->Amask == 0 && i < 32; ++i ) + for( int i = 0; img->format->Amask == 0 && i < img->format->BitsPerPixel; ++i ) { - if( usable_bits & (1<format->Amask = 1<format->Aloss = 7; img->format->Ashift = (uint8_t) i; } } - + */ + /* If we didn't have any free bits, convert to make room. */ if( img->format->Amask == 0 ) ConvertSurface( img, img->w, img->h, 32, 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF ); @@ -970,7 +969,7 @@ void RageSurfaceUtils::ApplyHotPinkColorKey( RageSurface *&img ) for( int y = 0; y < img->h; ++y ) { - uint8_t *row = (uint8_t *)img->pixels + img->pitch*y; + uint8_t *row = img->pixels + img->pitch*y; for( int x = 0; x < img->w; ++x ) {