mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Avoid creating a new color object just to set a color.
This commit is contained in:
parent
fdc73cae67
commit
d1d108952b
@ -158,7 +158,7 @@ public class SkeletonJson {
|
|||||||
data.skinRequired = boneMap.getBoolean("skin", false);
|
data.skinRequired = boneMap.getBoolean("skin", false);
|
||||||
|
|
||||||
String color = boneMap.getString("color", null);
|
String color = boneMap.getString("color", null);
|
||||||
if (color != null) data.getColor().set(Color.valueOf(color));
|
if (color != null) Color.valueOf(color, data.getColor());
|
||||||
|
|
||||||
skeletonData.bones.add(data);
|
skeletonData.bones.add(data);
|
||||||
}
|
}
|
||||||
@ -172,7 +172,7 @@ public class SkeletonJson {
|
|||||||
SlotData data = new SlotData(skeletonData.slots.size, slotName, boneData);
|
SlotData data = new SlotData(skeletonData.slots.size, slotName, boneData);
|
||||||
|
|
||||||
String color = slotMap.getString("color", null);
|
String color = slotMap.getString("color", null);
|
||||||
if (color != null) data.getColor().set(Color.valueOf(color));
|
if (color != null) Color.valueOf(color, data.getColor());
|
||||||
|
|
||||||
String dark = slotMap.getString("dark", null);
|
String dark = slotMap.getString("dark", null);
|
||||||
if (dark != null) data.setDarkColor(Color.valueOf(dark));
|
if (dark != null) data.setDarkColor(Color.valueOf(dark));
|
||||||
@ -375,7 +375,7 @@ public class SkeletonJson {
|
|||||||
region.setHeight(map.getFloat("height") * scale);
|
region.setHeight(map.getFloat("height") * scale);
|
||||||
|
|
||||||
String color = map.getString("color", null);
|
String color = map.getString("color", null);
|
||||||
if (color != null) region.getColor().set(Color.valueOf(color));
|
if (color != null) Color.valueOf(color, region.getColor());
|
||||||
|
|
||||||
region.updateOffset();
|
region.updateOffset();
|
||||||
return region;
|
return region;
|
||||||
@ -386,7 +386,7 @@ public class SkeletonJson {
|
|||||||
readVertices(map, box, map.getInt("vertexCount") << 1);
|
readVertices(map, box, map.getInt("vertexCount") << 1);
|
||||||
|
|
||||||
String color = map.getString("color", null);
|
String color = map.getString("color", null);
|
||||||
if (color != null) box.getColor().set(Color.valueOf(color));
|
if (color != null) Color.valueOf(color, box.getColor());
|
||||||
return box;
|
return box;
|
||||||
}
|
}
|
||||||
case mesh:
|
case mesh:
|
||||||
@ -397,7 +397,7 @@ public class SkeletonJson {
|
|||||||
mesh.setPath(path);
|
mesh.setPath(path);
|
||||||
|
|
||||||
String color = map.getString("color", null);
|
String color = map.getString("color", null);
|
||||||
if (color != null) mesh.getColor().set(Color.valueOf(color));
|
if (color != null) Color.valueOf(color, mesh.getColor());
|
||||||
|
|
||||||
mesh.setWidth(map.getFloat("width", 0) * scale);
|
mesh.setWidth(map.getFloat("width", 0) * scale);
|
||||||
mesh.setHeight(map.getFloat("height", 0) * scale);
|
mesh.setHeight(map.getFloat("height", 0) * scale);
|
||||||
@ -435,7 +435,7 @@ public class SkeletonJson {
|
|||||||
path.setLengths(lengths);
|
path.setLengths(lengths);
|
||||||
|
|
||||||
String color = map.getString("color", null);
|
String color = map.getString("color", null);
|
||||||
if (color != null) path.getColor().set(Color.valueOf(color));
|
if (color != null) Color.valueOf(color, path.getColor());
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
case point: {
|
case point: {
|
||||||
@ -446,7 +446,7 @@ public class SkeletonJson {
|
|||||||
point.setRotation(map.getFloat("rotation", 0));
|
point.setRotation(map.getFloat("rotation", 0));
|
||||||
|
|
||||||
String color = map.getString("color", null);
|
String color = map.getString("color", null);
|
||||||
if (color != null) point.getColor().set(Color.valueOf(color));
|
if (color != null) Color.valueOf(color, point.getColor());
|
||||||
return point;
|
return point;
|
||||||
}
|
}
|
||||||
case clipping: {
|
case clipping: {
|
||||||
@ -463,7 +463,7 @@ public class SkeletonJson {
|
|||||||
readVertices(map, clip, map.getInt("vertexCount") << 1);
|
readVertices(map, clip, map.getInt("vertexCount") << 1);
|
||||||
|
|
||||||
String color = map.getString("color", null);
|
String color = map.getString("color", null);
|
||||||
if (color != null) clip.getColor().set(Color.valueOf(color));
|
if (color != null) Color.valueOf(color, clip.getColor());
|
||||||
return clip;
|
return clip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user