From d14a66b8e73a66bbfb650698ff7d120654b0380c Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 30 Aug 2004 06:38:08 +0000 Subject: [PATCH] simplify --- stepmania/src/RageSurface_Load_PNG.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/stepmania/src/RageSurface_Load_PNG.cpp b/stepmania/src/RageSurface_Load_PNG.cpp index c6bfed892e..2944601274 100644 --- a/stepmania/src/RageSurface_Load_PNG.cpp +++ b/stepmania/src/RageSurface_Load_PNG.cpp @@ -162,19 +162,6 @@ static RageSurface *RageSurface_Load_PNG( RageFile *f, const char *fn, char erro if( png_get_tRNS( png, info_ptr, NULL, NULL, &trans ) == PNG_INFO_tRNS ) iColorKey = trans->gray; } - else if( color_type != PNG_COLOR_TYPE_PALETTE ) - { - /* If we have RGB image and tRNS, it's a color key. Just convert it to RGBA. */ - if( png_get_valid(png, info_ptr, PNG_INFO_tRNS) ) - { - /* We don't care about RGB color keys; just convert them to alpha. */ - png_set_tRNS_to_alpha( png ); - type = RGBA; - } - - /* RGB->RGBX */ - png_set_filler( png, 0xff, PNG_FILLER_AFTER ); - } else if( color_type == PNG_COLOR_TYPE_PALETTE ) { int num_palette; @@ -196,6 +183,19 @@ static RageSurface *RageSurface_Load_PNG( RageFile *f, const char *fn, char erro colors[i].a = trans[i]; } } + else + { + /* If we have RGB image and tRNS, it's a color key. Just convert it to RGBA. */ + if( png_get_valid(png, info_ptr, PNG_INFO_tRNS) ) + { + /* We don't care about RGB color keys; just convert them to alpha. */ + png_set_tRNS_to_alpha( png ); + type = RGBA; + } + + /* RGB->RGBX */ + png_set_filler( png, 0xff, PNG_FILLER_AFTER ); + } png_set_interlace_handling( png );