-added a way to reduce the alpha channel on pngs

-removed 24 pngs from the download country selection, using the
internal wiiflow alpha reducer from now on for that (saves 127kb)
This commit is contained in:
fix94.1 2013-01-19 12:33:52 +00:00
parent 0a7c9bd78d
commit b96e14f30e
27 changed files with 44 additions and 50 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

View File

@ -435,7 +435,7 @@ TexErr STexture::fromJPG(TexData &dest, const u8 *buffer, const u32 buffer_size,
return TE_OK;
}
TexErr STexture::fromPNG(TexData &dest, const u8 *buffer, u8 f, u32 minMipSize, u32 maxMipSize)
TexErr STexture::fromPNG(TexData &dest, const u8 *buffer, u8 f, u32 minMipSize, u32 maxMipSize, bool reduce_alpha)
{
Cleanup(dest);
u8 maxLODTmp = 0;
@ -583,9 +583,24 @@ TexErr STexture::fromPNG(TexData &dest, const u8 *buffer, u8 f, u32 minMipSize,
PNGU_ReleaseImageContext(ctx);
}
DCFlushRange(dest.data, dest.dataSize);
_reduceAlpha(dest, reduce_alpha);
return TE_OK;
}
void STexture::_reduceAlpha(TexData &dest, bool reduce_alpha)
{
if(dest.format != GX_TF_RGBA8 || reduce_alpha == false)
return;
for(u32 y = 0; y < dest.height; ++y)
{
for(u32 x = 0; x < dest.width; ++x)
{
dest.data[coordsRGBA8(x, y, dest.width)] /= 2;
}
}
DCFlushRange(dest.data, dest.dataSize);
}
void STexture::_resize(u8 *dst, u32 dstWidth, u32 dstHeight, const u8 *src, u32 srcWidth, u32 srcHeight)
{
float wc = (float)srcWidth / (float)dstWidth;

View File

@ -31,11 +31,12 @@ public:
// Get from PNG, if not found from JPG
TexErr fromImageFile(TexData &dest, const char *filename, u8 f = -1, u32 minMipSize = 0, u32 maxMipSize = 0);
// This function doesn't use MEM2 if the PNG is loaded from memory and there's no mip mapping
TexErr fromPNG(TexData &dest, const u8 *buffer, u8 f = -1, u32 minMipSize = 0, u32 maxMipSize = 0);
TexErr fromPNG(TexData &dest, const u8 *buffer, u8 f = -1, u32 minMipSize = 0, u32 maxMipSize = 0, bool reduce_alpha = false);
TexErr fromJPG(TexData &dest, const u8 *buffer, const u32 buffer_size, u8 f = -1, u32 minMipSize = 0, u32 maxMipSize = 0);
/* Just for THP */
TexErr fromTHP(TexData &dest, const u8 *buffer, u32 w, u32 h);
private:
void _reduceAlpha(TexData &dest, bool reduce_alpha);
void _resize(u8 *dst, u32 dstWidth, u32 dstHeight, const u8 *src, u32 srcWidth, u32 srcHeight);
void _resizeD2x2(u8 *dst, const u8 *src, u32 srcWidth, u32 srcHeight);
u8 *_genMipMaps(u8 *src, u32 width, u32 height, u8 maxLOD, u32 lod0Width, u32 lod0Height);

View File

@ -61,52 +61,28 @@ extern const u8 pbarcenters_png[];
extern const u8 pbarrights_png[];
extern const u8 butauon_png[];
extern const u8 butauons_png[];
extern const u8 butauoff_png[];
extern const u8 butauoffs_png[];
extern const u8 butenon_png[];
extern const u8 butenons_png[];
extern const u8 butenoff_png[];
extern const u8 butenoffs_png[];
extern const u8 butjaon_png[];
extern const u8 butjaons_png[];
extern const u8 butjaoff_png[];
extern const u8 butjaoffs_png[];
extern const u8 butfron_png[];
extern const u8 butfrons_png[];
extern const u8 butfroff_png[];
extern const u8 butfroffs_png[];
extern const u8 butdeon_png[];
extern const u8 butdeons_png[];
extern const u8 butdeoff_png[];
extern const u8 butdeoffs_png[];
extern const u8 buteson_png[];
extern const u8 butesons_png[];
extern const u8 butesoff_png[];
extern const u8 butesoffs_png[];
extern const u8 butiton_png[];
extern const u8 butitons_png[];
extern const u8 butitoff_png[];
extern const u8 butitoffs_png[];
extern const u8 butnlon_png[];
extern const u8 butnlons_png[];
extern const u8 butnloff_png[];
extern const u8 butnloffs_png[];
extern const u8 butpton_png[];
extern const u8 butptons_png[];
extern const u8 butptoff_png[];
extern const u8 butptoffs_png[];
extern const u8 butruon_png[];
extern const u8 butruons_png[];
extern const u8 butruoff_png[];
extern const u8 butruoffs_png[];
extern const u8 butkoon_png[];
extern const u8 butkoons_png[];
extern const u8 butkooff_png[];
extern const u8 butkooffs_png[];
extern const u8 butzhcnon_png[];
extern const u8 butzhcnons_png[];
extern const u8 butzhcnoff_png[];
extern const u8 butzhcnoffs_png[];
extern const u8 checkbox_png[];
extern const u8 checkboxs_png[];
extern const u8 checkboxhid_png[];
@ -1018,114 +994,116 @@ void CMenu::_buildMenus(void)
TexHandle.fromPNG(theme.btnTexCSH, buthscenter_png);
theme.btnTexCSH = _texture("GENERAL", "button_texture_hlcenter_selected", theme.btnTexCSH);
/* Language Buttons */
TexHandle.fromPNG(theme.btnAUOn, butauon_png);
theme.btnAUOn = _texture("GENERAL", "button_au_on", theme.btnAUOn);
TexHandle.fromPNG(theme.btnAUOns, butauons_png);
theme.btnAUOns = _texture("GENERAL", "button_au_on_selected", theme.btnAUOns);
TexHandle.fromPNG(theme.btnAUOff, butauoff_png);
TexHandle.fromPNG(theme.btnAUOff, butauon_png, GX_TF_RGBA8, 0, 0, true);
theme.btnAUOff = _texture("GENERAL", "button_au_off", theme.btnAUOff);
TexHandle.fromPNG(theme.btnAUOffs, butauoffs_png);
TexHandle.fromPNG(theme.btnAUOffs, butauons_png, GX_TF_RGBA8, 0, 0, true);
theme.btnAUOffs = _texture("GENERAL", "button_au_off_selected", theme.btnAUOffs);
TexHandle.fromPNG(theme.btnENOn, butenon_png);
theme.btnENOn = _texture("GENERAL", "button_en_on", theme.btnENOn);
TexHandle.fromPNG(theme.btnENOns, butenons_png);
theme.btnENOns = _texture("GENERAL", "button_en_on_selected", theme.btnENOns);
TexHandle.fromPNG(theme.btnENOff, butenoff_png);
TexHandle.fromPNG(theme.btnENOff, butenon_png, GX_TF_RGBA8, 0, 0, true);
theme.btnENOff = _texture("GENERAL", "button_en_off", theme.btnENOff);
TexHandle.fromPNG(theme.btnENOffs, butenoffs_png);
TexHandle.fromPNG(theme.btnENOffs, butenons_png, GX_TF_RGBA8, 0, 0, true);
theme.btnENOffs = _texture("GENERAL", "button_en_off_selected", theme.btnENOffs);
TexHandle.fromPNG(theme.btnJAOn, butjaon_png);
theme.btnJAOn = _texture("GENERAL", "button_ja_on", theme.btnJAOn);
TexHandle.fromPNG(theme.btnJAOns, butjaons_png);
theme.btnJAOns = _texture("GENERAL", "button_ja_on_selected", theme.btnJAOns);
TexHandle.fromPNG(theme.btnJAOff, butjaoff_png);
TexHandle.fromPNG(theme.btnJAOff, butjaon_png, GX_TF_RGBA8, 0, 0, true);
theme.btnJAOff = _texture("GENERAL", "button_ja_off", theme.btnJAOff);
TexHandle.fromPNG(theme.btnJAOffs, butjaoffs_png);
TexHandle.fromPNG(theme.btnJAOffs, butjaons_png, GX_TF_RGBA8, 0, 0, true);
theme.btnJAOffs = _texture("GENERAL", "button_ja_off_selected", theme.btnJAOffs);
TexHandle.fromPNG(theme.btnFROn, butfron_png);
theme.btnFROn = _texture("GENERAL", "button_fr_on", theme.btnFROn);
TexHandle.fromPNG(theme.btnFROns, butfrons_png);
theme.btnFROns = _texture("GENERAL", "button_fr_on_selected", theme.btnFROns);
TexHandle.fromPNG(theme.btnFROff, butfroff_png);
TexHandle.fromPNG(theme.btnFROff, butfron_png, GX_TF_RGBA8, 0, 0, true);
theme.btnFROff = _texture("GENERAL", "button_fr_off", theme.btnFROff);
TexHandle.fromPNG(theme.btnFROffs, butfroffs_png);
TexHandle.fromPNG(theme.btnFROffs, butfrons_png, GX_TF_RGBA8, 0, 0, true);
theme.btnFROffs = _texture("GENERAL", "button_fr_off_selected", theme.btnFROffs);
TexHandle.fromPNG(theme.btnDEOn, butdeon_png);
theme.btnDEOn = _texture("GENERAL", "button_de_on", theme.btnDEOn);
TexHandle.fromPNG(theme.btnDEOns, butdeons_png);
theme.btnDEOns = _texture("GENERAL", "button_de_on_selected", theme.btnDEOns);
TexHandle.fromPNG(theme.btnDEOff, butdeoff_png);
TexHandle.fromPNG(theme.btnDEOff, butdeon_png, GX_TF_RGBA8, 0, 0, true);
theme.btnDEOff = _texture("GENERAL", "button_de_off", theme.btnDEOff);
TexHandle.fromPNG(theme.btnDEOffs, butdeoffs_png);
TexHandle.fromPNG(theme.btnDEOffs, butdeons_png, GX_TF_RGBA8, 0, 0, true);
theme.btnDEOffs = _texture("GENERAL", "button_de_off_selected", theme.btnDEOffs);
TexHandle.fromPNG(theme.btnESOn, buteson_png);
theme.btnESOn = _texture("GENERAL", "button_es_on", theme.btnESOn);
TexHandle.fromPNG(theme.btnESOns, butesons_png);
theme.btnESOns = _texture("GENERAL", "button_es_on_selected", theme.btnESOns);
TexHandle.fromPNG(theme.btnESOff, butesoff_png);
TexHandle.fromPNG(theme.btnESOff, buteson_png, GX_TF_RGBA8, 0, 0, true);
theme.btnESOff = _texture("GENERAL", "button_es_off", theme.btnESOff);
TexHandle.fromPNG(theme.btnESOffs, butesoffs_png);
TexHandle.fromPNG(theme.btnESOffs, butesons_png, GX_TF_RGBA8, 0, 0, true);
theme.btnESOffs = _texture("GENERAL", "button_es_off_selected", theme.btnESOffs);
TexHandle.fromPNG(theme.btnITOn, butiton_png);
theme.btnITOn = _texture("GENERAL", "button_it_on", theme.btnITOn);
TexHandle.fromPNG(theme.btnITOns, butitons_png);
theme.btnITOns = _texture("GENERAL", "button_it_on_selected", theme.btnITOns);
TexHandle.fromPNG(theme.btnITOff, butitoff_png);
TexHandle.fromPNG(theme.btnITOff, butiton_png, GX_TF_RGBA8, 0, 0, true);
theme.btnITOff = _texture("GENERAL", "button_it_off", theme.btnITOff);
TexHandle.fromPNG(theme.btnITOffs, butitoffs_png);
TexHandle.fromPNG(theme.btnITOffs, butitons_png, GX_TF_RGBA8, 0, 0, true);
theme.btnITOffs = _texture("GENERAL", "button_it_off_selected", theme.btnITOffs);
TexHandle.fromPNG(theme.btnNLOn, butnlon_png);
theme.btnNLOn = _texture("GENERAL", "button_nl_on", theme.btnNLOn);
TexHandle.fromPNG(theme.btnNLOns, butnlons_png);
theme.btnNLOns = _texture("GENERAL", "button_nl_on_selected", theme.btnNLOns);
TexHandle.fromPNG(theme.btnNLOff, butnloff_png);
TexHandle.fromPNG(theme.btnNLOff, butnlon_png, GX_TF_RGBA8, 0, 0, true);
theme.btnNLOff = _texture("GENERAL", "button_nl_off", theme.btnNLOff);
TexHandle.fromPNG(theme.btnNLOffs, butnloffs_png);
TexHandle.fromPNG(theme.btnNLOffs, butnlons_png, GX_TF_RGBA8, 0, 0, true);
theme.btnNLOffs = _texture("GENERAL", "button_nl_off_selected", theme.btnNLOffs);
TexHandle.fromPNG(theme.btnPTOn, butpton_png);
theme.btnPTOn = _texture("GENERAL", "button_pt_on", theme.btnPTOn);
TexHandle.fromPNG(theme.btnPTOns, butptons_png);
theme.btnPTOns = _texture("GENERAL", "button_pt_on_selected", theme.btnPTOns);
TexHandle.fromPNG(theme.btnPTOff, butptoff_png);
TexHandle.fromPNG(theme.btnPTOff, butpton_png, GX_TF_RGBA8, 0, 0, true);
theme.btnPTOff = _texture("GENERAL", "button_pt_off", theme.btnPTOff);
TexHandle.fromPNG(theme.btnPTOffs, butptoffs_png);
TexHandle.fromPNG(theme.btnPTOffs, butptons_png, GX_TF_RGBA8, 0, 0, true);
theme.btnPTOffs = _texture("GENERAL", "button_pt_off_selected", theme.btnPTOffs);
TexHandle.fromPNG(theme.btnRUOn, butruon_png);
theme.btnRUOn = _texture("GENERAL", "button_ru_on", theme.btnRUOn);
TexHandle.fromPNG(theme.btnRUOns, butruons_png);
theme.btnRUOns = _texture("GENERAL", "button_ru_on_selected", theme.btnRUOns);
TexHandle.fromPNG(theme.btnRUOff, butruoff_png);
TexHandle.fromPNG(theme.btnRUOff, butruon_png, GX_TF_RGBA8, 0, 0, true);
theme.btnRUOff = _texture("GENERAL", "button_ru_off", theme.btnRUOff);
TexHandle.fromPNG(theme.btnRUOffs, butruoffs_png);
TexHandle.fromPNG(theme.btnRUOffs, butruons_png, GX_TF_RGBA8, 0, 0, true);
theme.btnRUOffs = _texture("GENERAL", "button_ru_off_selected", theme.btnRUOffs);
TexHandle.fromPNG(theme.btnKOOn, butkoon_png);
theme.btnKOOn = _texture("GENERAL", "button_ko_on", theme.btnKOOn);
TexHandle.fromPNG(theme.btnKOOns, butkoons_png);
theme.btnKOOns = _texture("GENERAL", "button_ko_on_selected", theme.btnKOOns);
TexHandle.fromPNG(theme.btnKOOff, butkooff_png);
TexHandle.fromPNG(theme.btnKOOff, butkoon_png, GX_TF_RGBA8, 0, 0, true);
theme.btnKOOff = _texture("GENERAL", "button_ko_off", theme.btnKOOff);
TexHandle.fromPNG(theme.btnKOOffs, butkooffs_png);
TexHandle.fromPNG(theme.btnKOOffs, butkoons_png, GX_TF_RGBA8, 0, 0, true);
theme.btnKOOffs = _texture("GENERAL", "button_ko_off_selected", theme.btnKOOffs);
TexHandle.fromPNG(theme.btnZHCNOn, butzhcnon_png);
theme.btnZHCNOn = _texture("GENERAL", "button_zhcn_on", theme.btnZHCNOn);
TexHandle.fromPNG(theme.btnZHCNOns, butzhcnons_png);
theme.btnZHCNOns = _texture("GENERAL", "button_zhcn_on_selected", theme.btnZHCNOns);
TexHandle.fromPNG(theme.btnZHCNOff, butzhcnoff_png);
TexHandle.fromPNG(theme.btnZHCNOff, butzhcnon_png, GX_TF_RGBA8, 0, 0, true);
theme.btnZHCNOff = _texture("GENERAL", "button_zhcn_off", theme.btnZHCNOff);
TexHandle.fromPNG(theme.btnZHCNOffs, butzhcnoffs_png);
TexHandle.fromPNG(theme.btnZHCNOffs, butzhcnons_png, GX_TF_RGBA8, 0, 0, true);
theme.btnZHCNOffs = _texture("GENERAL", "button_zhcn_off_selected", theme.btnZHCNOffs);
/* Default textures */
TexHandle.fromPNG(theme.checkboxoff, checkbox_png);
theme.checkboxoff = _texture("GENERAL", "checkbox_off", theme.checkboxoff);
TexHandle.fromPNG(theme.checkboxoffs, checkbox_png);