1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-15 01:24:45 +02:00

Get rid of CSDL_Ext::colorSetAlpha

This commit is contained in:
AlexVinS
2015-09-02 18:49:29 +03:00
parent e80c8d16a6
commit b512005d38
6 changed files with 12 additions and 14 deletions

View File

@ -70,7 +70,7 @@ SDL_Surface * BitmapHandler::loadH3PCX(ui8 * pcx, size_t size)
tp.r = pcx[it++]; tp.r = pcx[it++];
tp.g = pcx[it++]; tp.g = pcx[it++];
tp.b = pcx[it++]; tp.b = pcx[it++];
CSDL_Ext::colorSetAlpha(tp,SDL_ALPHA_OPAQUE); tp.a = SDL_ALPHA_OPAQUE;
ret->format->palette->colors[i] = tp; ret->format->palette->colors[i] = tp;
} }
} }
@ -142,7 +142,7 @@ SDL_Surface * BitmapHandler::loadBitmapFromDir(std::string path, std::string fna
{ {
//set correct value for alpha\unused channel //set correct value for alpha\unused channel
for (int i=0; i < ret->format->palette->ncolors; i++) for (int i=0; i < ret->format->palette->ncolors; i++)
CSDL_Ext::colorSetAlpha(ret->format->palette->colors[i],SDL_ALPHA_OPAQUE); ret->format->palette->colors[i].a = SDL_ALPHA_OPAQUE;
} }
} }
else else

View File

@ -67,7 +67,7 @@ void CDefHandler::openFromMemory(ui8 *table, const std::string & name)
palette[it].r = de.palette[it].R; palette[it].r = de.palette[it].R;
palette[it].g = de.palette[it].G; palette[it].g = de.palette[it].G;
palette[it].b = de.palette[it].B; palette[it].b = de.palette[it].B;
CSDL_Ext::colorSetAlpha(palette[it],SDL_ALPHA_OPAQUE); palette[it].a = SDL_ALPHA_OPAQUE;
} }
// The SDefEntryBlock starts just after the SDefEntry // The SDefEntryBlock starts just after the SDefEntry

View File

@ -58,7 +58,7 @@ void Graphics::loadPaletteAndColors()
col.r = pals[startPoint++]; col.r = pals[startPoint++];
col.g = pals[startPoint++]; col.g = pals[startPoint++];
col.b = pals[startPoint++]; col.b = pals[startPoint++];
CSDL_Ext::colorSetAlpha(col,SDL_ALPHA_OPAQUE); col.a = SDL_ALPHA_OPAQUE;
startPoint++; startPoint++;
playerColorPalette[i] = col; playerColorPalette[i] = col;
} }
@ -74,7 +74,7 @@ void Graphics::loadPaletteAndColors()
neutralColorPalette[i].g = reader.readUInt8(); neutralColorPalette[i].g = reader.readUInt8();
neutralColorPalette[i].b = reader.readUInt8(); neutralColorPalette[i].b = reader.readUInt8();
reader.readUInt8(); // this is "flags" entry, not alpha reader.readUInt8(); // this is "flags" entry, not alpha
CSDL_Ext::colorSetAlpha(neutralColorPalette[i], SDL_ALPHA_OPAQUE); neutralColorPalette[i].a = SDL_ALPHA_OPAQUE;
} }
//colors initialization //colors initialization
SDL_Color colors[] = { SDL_Color colors[] = {
@ -92,8 +92,11 @@ void Graphics::loadPaletteAndColors()
{ {
playerColors[i] = colors[i]; playerColors[i] = colors[i];
} }
neutralColor->r = 0x84; neutralColor->g = 0x84; neutralColor->b = 0x84; //gray //gray
CSDL_Ext::colorSetAlpha(*neutralColor,SDL_ALPHA_OPAQUE); neutralColor->r = 0x84;
neutralColor->g = 0x84;
neutralColor->b = 0x84;
neutralColor->a = SDL_ALPHA_OPAQUE;
} }
void Graphics::initializeBattleGraphics() void Graphics::initializeBattleGraphics()

View File

@ -178,7 +178,7 @@ CCreatureAnimation::CCreatureAnimation(std::string name, TSpeedController contro
elem.r = reader.readUInt8(); elem.r = reader.readUInt8();
elem.g = reader.readUInt8(); elem.g = reader.readUInt8();
elem.b = reader.readUInt8(); elem.b = reader.readUInt8();
CSDL_Ext::colorSetAlpha(elem,0); elem.a = SDL_ALPHA_OPAQUE;
} }
for (int i=0; i<totalBlocks; i++) for (int i=0; i<totalBlocks; i++)

View File

@ -158,7 +158,7 @@ CDefFile::CDefFile(std::string Name):
palette[i].r = data[it++]; palette[i].r = data[it++];
palette[i].g = data[it++]; palette[i].g = data[it++];
palette[i].b = data[it++]; palette[i].b = data[it++];
CSDL_Ext::colorSetAlpha(palette[i],255); palette[i].a = SDL_ALPHA_OPAQUE;
} }
if (type == 71 || type == 64)//Buttons/buildings don't have shadows\semi-transparency if (type == 71 || type == 64)//Buttons/buildings don't have shadows\semi-transparency
memset(palette, 0, sizeof(SDL_Color)*2); memset(palette, 0, sizeof(SDL_Color)*2);

View File

@ -59,11 +59,6 @@ inline bool isShiftKeyDown()
} }
namespace CSDL_Ext namespace CSDL_Ext
{ {
//todo: remove
STRONG_INLINE void colorSetAlpha(SDL_Color & color, Uint8 alpha)
{
color.a = alpha;
}
//todo: should this better be assignment operator? //todo: should this better be assignment operator?
STRONG_INLINE void colorAssign(SDL_Color & dest, const SDL_Color & source) STRONG_INLINE void colorAssign(SDL_Color & dest, const SDL_Color & source)
{ {