From 6a5881bac90e9423712c8c708e875b2f9e94bc74 Mon Sep 17 00:00:00 2001 From: Harvey Harrison Date: Tue, 9 Oct 2012 22:53:36 -0700 Subject: j3dcore: push some local variables down into the loops they are used in Signed-off-by: Harvey Harrison --- .../javax/media/j3d/Shape3DCompileRetained.java | 38 ++++++++++------------ 1 file changed, 18 insertions(+), 20 deletions(-) (limited to 'src/classes') diff --git a/src/classes/share/javax/media/j3d/Shape3DCompileRetained.java b/src/classes/share/javax/media/j3d/Shape3DCompileRetained.java index d1d615d..56c1fea 100644 --- a/src/classes/share/javax/media/j3d/Shape3DCompileRetained.java +++ b/src/classes/share/javax/media/j3d/Shape3DCompileRetained.java @@ -48,8 +48,6 @@ ArrayList> geometryInfo = null; Shape3DCompileRetained(Shape3DRetained[] shapes, int nShapes, int compileFlags) { int i, j; - Shape3DRetained shape; - GeometryArrayRetained geo; // Merged list, only merged if geometry is mergeable ArrayList[] mergedList = new ArrayList[GeometryRetained.GEO_TYPE_GEOMETRYARRAY + 1]; // Sorted list of separate geometry by geoType @@ -85,7 +83,7 @@ ArrayList> geometryInfo = null; geometryInfo = new ArrayList>(); for (i = 0; i < nShapes; i++) { - shape = shapes[i]; + Shape3DRetained shape = shapes[i]; ((Shape3D)shape.source).id = i; shape.source.retained = this; srcList[i] = shape.source; @@ -95,27 +93,27 @@ ArrayList> geometryInfo = null; // Put it in a separate list sorted by geo_type // Have to handle shape.isPickable - for (j = 0; j < shape.geometryList.size(); j++) { - geo = (GeometryArrayRetained)shape.geometryList.get(j); - if (geo != null) { - if (shape.willRemainOpaque(geo.geoType) && geo.isMergeable()) { - if (mergedList[geo.geoType] == null) { - mergedList[geo.geoType] = new ArrayList(); + for (j = 0; j < shape.geometryList.size(); j++) { + GeometryArrayRetained geo = (GeometryArrayRetained)shape.geometryList.get(j); + if (geo == null) + continue; + + if (shape.willRemainOpaque(geo.geoType) && geo.isMergeable()) { + if (mergedList[geo.geoType] == null) { + mergedList[geo.geoType] = new ArrayList(); + } + mergedList[geo.geoType].add(geo); } - mergedList[geo.geoType].add(geo); - } - else { - // Keep a sorted list based on geoType; - if (separateList[geo.geoType] == null) { - separateList[geo.geoType] = new ArrayList(); + else { + // Keep a sorted list based on geoType; + if (separateList[geo.geoType] == null) { + separateList[geo.geoType] = new ArrayList(); + } + // add it to the geometryList separately + separateList[geo.geoType].add(geo); } - // add it to the geometryList separately - separateList[geo.geoType].add(geo); - } } - } - // Point to the geometryList's source, so the // retained side will be garbage collected if ((compileFlags & CompileState.GEOMETRY_READ) != 0) { -- cgit v1.2.3