Fix memory leak?!
This commit is contained in:
parent
d7ed255e17
commit
3b367fcb8e
1 changed files with 30 additions and 21 deletions
|
@ -57,6 +57,8 @@ public class GuiModList extends GuiScreen
|
|||
private ArrayList<ModContainer> mods;
|
||||
private GuiButton configModButton;
|
||||
private GuiButton disableModButton;
|
||||
private ResourceLocation cachedLogo;
|
||||
private Dimension cachedLogoDimensions;
|
||||
|
||||
/**
|
||||
* @param mainMenu
|
||||
|
@ -156,6 +158,8 @@ public class GuiModList extends GuiScreen
|
|||
TextureManager tm = field_146297_k.func_110434_K();
|
||||
IResourcePack pack = FMLClientHandler.instance().getResourcePackFor(selectedMod.getModId());
|
||||
try
|
||||
{
|
||||
if (cachedLogo == null)
|
||||
{
|
||||
BufferedImage logo = null;
|
||||
if (pack!=null)
|
||||
|
@ -172,24 +176,28 @@ public class GuiModList extends GuiScreen
|
|||
}
|
||||
if (logo != null)
|
||||
{
|
||||
ResourceLocation rl = tm.func_110578_a("modlogo", new DynamicTexture(logo));
|
||||
this.field_146297_k.field_71446_o.func_110577_a(rl);
|
||||
Dimension dim = new Dimension(logo.getWidth(), logo.getHeight());
|
||||
double scaleX = dim.width / 200.0;
|
||||
double scaleY = dim.height / 65.0;
|
||||
cachedLogo = tm.func_110578_a("modlogo", new DynamicTexture(logo));
|
||||
cachedLogoDimensions = new Dimension(logo.getWidth(), logo.getHeight());
|
||||
}
|
||||
}
|
||||
if (cachedLogo != null)
|
||||
{
|
||||
this.field_146297_k.field_71446_o.func_110577_a(cachedLogo);
|
||||
double scaleX = cachedLogoDimensions.width / 200.0;
|
||||
double scaleY = cachedLogoDimensions.height / 65.0;
|
||||
double scale = 1.0;
|
||||
if (scaleX > 1 || scaleY > 1)
|
||||
{
|
||||
scale = 1.0 / Math.max(scaleX, scaleY);
|
||||
}
|
||||
dim.width *= scale;
|
||||
dim.height *= scale;
|
||||
cachedLogoDimensions.width *= scale;
|
||||
cachedLogoDimensions.height *= scale;
|
||||
int top = 32;
|
||||
Tessellator tess = Tessellator.field_78398_a;
|
||||
tess.func_78382_b();
|
||||
tess.func_78374_a(offset, top + dim.height, field_73735_i, 0, 1);
|
||||
tess.func_78374_a(offset + dim.width, top + dim.height, field_73735_i, 1, 1);
|
||||
tess.func_78374_a(offset + dim.width, top, field_73735_i, 1, 0);
|
||||
tess.func_78374_a(offset, top + cachedLogoDimensions.height, field_73735_i, 0, 1);
|
||||
tess.func_78374_a(offset + cachedLogoDimensions.width, top + cachedLogoDimensions.height, field_73735_i, 1, 1);
|
||||
tess.func_78374_a(offset + cachedLogoDimensions.width, top, field_73735_i, 1, 0);
|
||||
tess.func_78374_a(offset, top, field_73735_i, 0, 0);
|
||||
tess.func_78381_a();
|
||||
|
||||
|
@ -286,6 +294,7 @@ public class GuiModList extends GuiScreen
|
|||
} else {
|
||||
this.selectedMod=null;
|
||||
}
|
||||
cachedLogo = null;
|
||||
}
|
||||
|
||||
public boolean modIndexSelected(int var1)
|
||||
|
|
Loading…
Reference in a new issue