mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
Consolidate the three implementations of Decode5A3 found in Core into one. Fix some warnings.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2364 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -20,6 +20,7 @@
|
||||
// HyperIris: need clean code
|
||||
#include "../../Core/Src/ConfigManager.h"
|
||||
|
||||
#include "ColorUtil.h"
|
||||
#include "BannerLoaderGC.h"
|
||||
|
||||
namespace DiscIO
|
||||
@ -28,22 +29,6 @@ CBannerLoaderGC::CBannerLoaderGC(DiscIO::IFileSystem& _rFileSystem)
|
||||
: m_pBannerFile(NULL),
|
||||
m_IsValid(false)
|
||||
{
|
||||
// build LUT Table
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
lut3to8[i] = (i * 255) / 7;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
lut4to8[i] = (i * 255) / 15;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 32; i++)
|
||||
{
|
||||
lut5to8[i] = (i * 255) / 31;
|
||||
}
|
||||
|
||||
// load the opening.bnr
|
||||
size_t FileSize = (size_t) _rFileSystem.GetFileSize("opening.bnr");
|
||||
|
||||
@ -216,33 +201,6 @@ CBannerLoaderGC::GetDescription(std::string* _rDescription)
|
||||
}
|
||||
|
||||
|
||||
u32
|
||||
CBannerLoaderGC::decode5A3(u16 val)
|
||||
{
|
||||
u32 bannerBGColor = 0x00000000;
|
||||
|
||||
int r, g, b, a;
|
||||
|
||||
if ((val & 0x8000))
|
||||
{
|
||||
r = lut5to8[(val >> 10) & 0x1f];
|
||||
g = lut5to8[(val >> 5) & 0x1f];
|
||||
b = lut5to8[(val) & 0x1f];
|
||||
a = 0xFF;
|
||||
}
|
||||
else
|
||||
{
|
||||
a = lut3to8[(val >> 12) & 0x7];
|
||||
r = (lut4to8[(val >> 8) & 0xf] * a + (bannerBGColor & 0xFF) * (255 - a)) / 255;
|
||||
g = (lut4to8[(val >> 4) & 0xf] * a + ((bannerBGColor >> 8) & 0xFF) * (255 - a)) / 255;
|
||||
b = (lut4to8[(val) & 0xf] * a + ((bannerBGColor >> 16) & 0xFF) * (255 - a)) / 255;
|
||||
a = 0xFF;
|
||||
}
|
||||
|
||||
return((a << 24) | (r << 16) | (g << 8) | b);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CBannerLoaderGC::decode5A3image(u32* dst, u16* src, int width, int height)
|
||||
{
|
||||
@ -254,7 +212,7 @@ CBannerLoaderGC::decode5A3image(u32* dst, u16* src, int width, int height)
|
||||
{
|
||||
for (int ix = 0; ix < 4; ix++)
|
||||
{
|
||||
u32 RGBA = decode5A3(Common::swap16(src[ix]));
|
||||
u32 RGBA = ColorUtil::Decode5A3(Common::swap16(src[ix]));
|
||||
dst[(y + iy) * width + (x + ix)] = RGBA;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user