Skip to content
Snippets Groups Projects
Commit b108c65e authored by Luboš Horáček's avatar Luboš Horáček
Browse files

#27 Disposing pixmaps after use

parent 9a4d7363
Branches
Tags
No related merge requests found
core/assets/common/game/kidnapping/gfx/overlay.png

86 B

core/assets/common/screen/form/gfx/avatar/overlay.png

86 B

core/assets/common/screen/gamemenu/gfx/overlay.png

86 B

core/assets/common/screen/panorama/gfx/newspaper/overlay.png

86 B

......@@ -6,8 +6,6 @@ import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.NinePatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import net.dermetfan.utils.Pair;
import java.util.HashMap;
import java.util.Map;
......@@ -19,7 +17,7 @@ public class ApplicationAtlasManager extends TablexiaAtlasManager implements IAp
private static ApplicationAtlasManager instance;
private Map<Color, Pair<Pixmap, Texture>> colorMap = new HashMap<Color, Pair<Pixmap, Texture>>();// TODO dispose with application!
private Map<Color, Texture> colorMap = new HashMap<Color, Texture>();// TODO dispose with application!
private ApplicationAtlasManager() {
}
......@@ -34,9 +32,8 @@ public class ApplicationAtlasManager extends TablexiaAtlasManager implements IAp
@Override
public synchronized void dispose() {
super.dispose();
for (Pair<Pixmap, Texture> pair : colorMap.values()) {
pair.getValue().dispose();
pair.getKey().dispose();
for (Texture texture : colorMap.values()) {
texture.dispose();
}
instance = null;
}
......@@ -95,9 +92,9 @@ public class ApplicationAtlasManager extends TablexiaAtlasManager implements IAp
p.setColor(color);
p.drawPixel(0, 0);
Texture texture = new Texture(p);
Pair<Pixmap, Texture> pair = new Pair<Pixmap, Texture>(p, texture);
colorMap.put(color, pair);
p.dispose();
colorMap.put(color, texture);
}
return colorMap.get(color).getValue();
return colorMap.get(color);
}
}
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment