mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
[Common] Abstract out the decode5A3Image and decodeCI8Image functions in BannerLoaderGC, BannerLoaderWii, and GCMemcard into ColorUtil.cpp. Makes for less copied code and remains functionally the same.
This commit is contained in:
@ -55,7 +55,7 @@ std::vector<u32> CBannerLoaderGC::GetBanner(int* pWidth, int* pHeight)
|
||||
std::vector<u32> Buffer;
|
||||
Buffer.resize(DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT);
|
||||
auto const pBanner = (DVDBanner*)m_pBannerFile;
|
||||
decode5A3image(&Buffer[0], pBanner->image, DVD_BANNER_WIDTH, DVD_BANNER_HEIGHT);
|
||||
ColorUtil::decode5A3image(&Buffer[0], pBanner->image, DVD_BANNER_WIDTH, DVD_BANNER_HEIGHT);
|
||||
*pWidth = DVD_BANNER_WIDTH;
|
||||
*pHeight = DVD_BANNER_HEIGHT;
|
||||
return Buffer;
|
||||
@ -163,25 +163,6 @@ std::vector<std::string> CBannerLoaderGC::GetDescriptions()
|
||||
return descriptions;
|
||||
}
|
||||
|
||||
|
||||
void CBannerLoaderGC::decode5A3image(u32* dst, u16* src, int width, int height)
|
||||
{
|
||||
for (int y = 0; y < height; y += 4)
|
||||
{
|
||||
for (int x = 0; x < width; x += 4)
|
||||
{
|
||||
for (int iy = 0; iy < 4; iy++, src += 4)
|
||||
{
|
||||
for (int ix = 0; ix < 4; ix++)
|
||||
{
|
||||
u32 RGBA = ColorUtil::Decode5A3(Common::swap16(src[ix]));
|
||||
dst[(y + iy) * width + (x + ix)] = RGBA;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CBannerLoaderGC::BANNER_TYPE CBannerLoaderGC::getBannerType()
|
||||
{
|
||||
u32 bannerSignature = *(u32*)m_pBannerFile;
|
||||
|
Reference in New Issue
Block a user