- do not store useless reference to image in TextureAtlas
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9050 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
b0b3f1b55e
commit
1d742f1d07
@ -437,14 +437,14 @@ public class TextureAtlas {
|
|||||||
|
|
||||||
public TextureAtlasTile location;
|
public TextureAtlasTile location;
|
||||||
public Node child[];
|
public Node child[];
|
||||||
public Image image;
|
public boolean occupied;
|
||||||
|
|
||||||
public Node(int x, int y, int width, int height) {
|
public Node(int x, int y, int width, int height) {
|
||||||
location = new TextureAtlasTile(x, y, width, height);
|
location = new TextureAtlasTile(x, y, width, height);
|
||||||
child = new Node[2];
|
child = new Node[2];
|
||||||
child[0] = null;
|
child[0] = null;
|
||||||
child[1] = null;
|
child[1] = null;
|
||||||
image = null;
|
occupied = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLeaf() {
|
public boolean isLeaf() {
|
||||||
@ -462,7 +462,7 @@ public class TextureAtlas {
|
|||||||
|
|
||||||
return child[1].insert(image);
|
return child[1].insert(image);
|
||||||
} else {
|
} else {
|
||||||
if (this.image != null) {
|
if (occupied) {
|
||||||
return null; // occupied
|
return null; // occupied
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -471,7 +471,7 @@ public class TextureAtlas {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (image.getWidth() == location.getWidth() && image.getHeight() == location.getHeight()) {
|
if (image.getWidth() == location.getWidth() && image.getHeight() == location.getHeight()) {
|
||||||
this.image = image; // perfect fit
|
occupied = true; // perfect fit
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user