Significant sprite packing memory leak fixes
additional thanks to GlFolker for reporting issues with undisposed content icon pixmaps
This commit is contained in:
@@ -1294,6 +1294,8 @@ public class Block extends UnlockableContent implements Senseable{
|
||||
}
|
||||
}
|
||||
|
||||
Seq<Pixmap> toDispose = new Seq<>();
|
||||
|
||||
//generate paletted team regions
|
||||
if(teamRegion != null && teamRegion.found()){
|
||||
for(Team team : Team.all){
|
||||
@@ -1318,6 +1320,7 @@ public class Block extends UnlockableContent implements Senseable{
|
||||
Drawf.checkBleed(out);
|
||||
|
||||
packer.add(PageType.main, name + "-team-" + team.name, out);
|
||||
toDispose.add(out);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1337,6 +1340,7 @@ public class Block extends UnlockableContent implements Senseable{
|
||||
Pixmap out = last = Pixmaps.outline(region, outlineColor, outlineRadius);
|
||||
Drawf.checkBleed(out);
|
||||
packer.add(PageType.main, atlasRegion.name, out);
|
||||
toDispose.add(out);
|
||||
}
|
||||
|
||||
var toOutline = new Seq<TextureRegion>();
|
||||
@@ -1350,6 +1354,7 @@ public class Block extends UnlockableContent implements Senseable{
|
||||
Drawf.checkBleed(outlined);
|
||||
|
||||
packer.add(PageType.main, regionName + "-outline", outlined);
|
||||
toDispose.add(outlined);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1367,12 +1372,15 @@ public class Block extends UnlockableContent implements Senseable{
|
||||
packer.add(PageType.main, "block-" + name + "-full", base);
|
||||
|
||||
editorBase = new PixmapRegion(base);
|
||||
toDispose.add(base);
|
||||
}else{
|
||||
if(gen[0] != null) packer.add(PageType.main, "block-" + name + "-full", Core.atlas.getPixmap(gen[0]));
|
||||
editorBase = gen[0] == null ? Core.atlas.getPixmap(fullIcon) : Core.atlas.getPixmap(gen[0]);
|
||||
}
|
||||
|
||||
packer.add(PageType.editor, name + "-icon-editor", editorBase);
|
||||
|
||||
toDispose.each(Pixmap::dispose);
|
||||
}
|
||||
|
||||
public int planRotation(int rot){
|
||||
|
||||
@@ -177,6 +177,7 @@ public class Floor extends Block{
|
||||
}
|
||||
|
||||
packer.add(PageType.environment, name + "-edge", result);
|
||||
result.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -69,6 +69,8 @@ public class OreBlock extends OverlayFloor{
|
||||
packer.add(PageType.editor, "editor-block-" + name + "-full", image);
|
||||
packer.add(PageType.main, "block-" + name + "-full", image);
|
||||
}
|
||||
|
||||
image.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user