Replace 4alphaonly and 8alphaonly with the simpler and more generally
useful 32bpp and 16bpp hints. (alphaonly was broken and had the effect of 32bpp anyway). These force a texture to 32bpp and 16bpp, overriding the user's preference. Use 32bpp for images that really do need 32bpp (where "dither" isn't good enough). Use 16bpp for images that really don't need 32bpp, to save memory.
This commit is contained in:
@@ -141,22 +141,17 @@ apply_color_key:
|
||||
actualID.iAlphaBits = 0;
|
||||
else if(traits & TRAIT_BOOL_TRANSPARENCY)
|
||||
actualID.iAlphaBits = 1;
|
||||
if(traits & TRAIT_WHITE_ONLY)
|
||||
actualID.iTransparencyOnly = 8;
|
||||
}
|
||||
|
||||
// look in the file name for a format hints
|
||||
CString HintString = GetID().filename;
|
||||
HintString.MakeLower();
|
||||
|
||||
if( HintString.Find("4alphaonly") != -1 ) actualID.iTransparencyOnly = 4;
|
||||
else if( HintString.Find("8alphaonly") != -1 ) actualID.iTransparencyOnly = 8;
|
||||
if( HintString.Find("32bpp") != -1 ) actualID.iColorDepth = 32;
|
||||
else if( HintString.Find("16bpp") != -1 ) actualID.iColorDepth = 16;
|
||||
if( HintString.Find("dither") != -1 ) actualID.bDither = true;
|
||||
if( HintString.Find("stretch") != -1 ) actualID.bStretch = true;
|
||||
|
||||
if( actualID.iTransparencyOnly )
|
||||
actualID.iColorDepth = 32; /* Treat the image as 32-bit, so we don't lose any alpha precision. */
|
||||
|
||||
/* Cap the max texture size to the hardware max. */
|
||||
actualID.iMaxSize = min( actualID.iMaxSize, DISPLAY->GetMaxTextureSize() );
|
||||
|
||||
@@ -246,18 +241,6 @@ apply_color_key:
|
||||
RageException::Throw( "Invalid color depth: %d bits", actualID.iColorDepth );
|
||||
}
|
||||
|
||||
/* Override the internalformat with an alpha format if it was requested.
|
||||
* Don't use iTransparencyOnly with paletted images; there's no point--paletted
|
||||
* images are as small or smaller (and the load will fail). */
|
||||
/* SDL surfaces don't allow for 8 bpp surfaces that aren't paletted. Arg!
|
||||
* fix this later. -Chris */
|
||||
// if(actualID.iTransparencyOnly > 0)
|
||||
// {
|
||||
// imagePixfmt = FMT_ALPHA8;
|
||||
// texturePixfmt = FMT_ALPHA8;
|
||||
// }
|
||||
|
||||
|
||||
/* It's either not a paletted image, or we can't handle paletted textures.
|
||||
* Convert to the desired RGBA format, dithering if appropriate. */
|
||||
if( actualID.bDither &&
|
||||
@@ -351,7 +334,6 @@ apply_color_key:
|
||||
props += PixelFormatToString( pixfmt ) + " ";
|
||||
if(actualID.iAlphaBits == 0) props += "opaque ";
|
||||
if(actualID.iAlphaBits == 1) props += "matte ";
|
||||
if(actualID.iTransparencyOnly) props += "mask ";
|
||||
if(actualID.bStretch) props += "stretch ";
|
||||
if(actualID.bDither) props += "dither ";
|
||||
props.erase(props.size()-1);
|
||||
|
||||
@@ -38,11 +38,6 @@ void RageTextureID::Init()
|
||||
/* If true, enable HOT PINK color keying. (deprecated but needed for
|
||||
* banners) */
|
||||
bHotPinkColorKey = false;
|
||||
|
||||
/* This indicates that the image is a transparency. This allows for
|
||||
* high-resolution, memory-compact transparent layers. The diffuse
|
||||
* color will be used with no texture color. (0, 4, 8) */
|
||||
iTransparencyOnly = 0;
|
||||
}
|
||||
|
||||
bool RageTextureID::operator<(const RageTextureID &rhs) const
|
||||
@@ -53,7 +48,6 @@ bool RageTextureID::operator<(const RageTextureID &rhs) const
|
||||
COMP(iMipMaps);
|
||||
COMP(iAlphaBits);
|
||||
COMP(iColorDepth);
|
||||
COMP(iTransparencyOnly);
|
||||
COMP(bDither);
|
||||
COMP(bStretch);
|
||||
COMP(bHotPinkColorKey);
|
||||
@@ -70,7 +64,6 @@ bool RageTextureID::operator==(const RageTextureID &rhs) const
|
||||
EQUAL(iMipMaps) &&
|
||||
EQUAL(iAlphaBits) &&
|
||||
EQUAL(iColorDepth) &&
|
||||
EQUAL(iTransparencyOnly) &&
|
||||
EQUAL(bDither) &&
|
||||
EQUAL(bStretch) &&
|
||||
EQUAL(bHotPinkColorKey);
|
||||
|
||||
@@ -26,7 +26,6 @@ struct RageTextureID
|
||||
int iMipMaps;
|
||||
int iAlphaBits;
|
||||
int iColorDepth;
|
||||
int iTransparencyOnly;
|
||||
bool bDither;
|
||||
bool bStretch;
|
||||
bool bHotPinkColorKey; /* #FF00FF */
|
||||
|
||||
Reference in New Issue
Block a user