diff options
author | Harvey Harrison <[email protected]> | 2012-01-12 20:07:16 -0800 |
---|---|---|
committer | Harvey Harrison <[email protected]> | 2012-01-12 20:07:16 -0800 |
commit | d8c07b990e6eafef62a7f6194bdd89bd4e4920b6 (patch) | |
tree | 32261d934eb5a3e2fbe6ccc0e126d745a981d0c0 | |
parent | 3bd82be0371e40390abc5509cb2a7d6e3a055a12 (diff) |
j3dcore: move an early-return case as early as possible in locked section in GeometryAtom
In all paths, if the RenderAtom is not scoped to the given View, we return null
and do not adjust the renderAtoms array. Make this clear with an early return.
Signed-off-by: Harvey Harrison <[email protected]>
-rw-r--r-- | src/classes/share/javax/media/j3d/GeometryAtom.java | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/src/classes/share/javax/media/j3d/GeometryAtom.java b/src/classes/share/javax/media/j3d/GeometryAtom.java index d49040d..f9ed4ca 100644 --- a/src/classes/share/javax/media/j3d/GeometryAtom.java +++ b/src/classes/share/javax/media/j3d/GeometryAtom.java @@ -160,19 +160,14 @@ class GeometryAtom extends Object implements BHLeafInterface, NnuId { */ RenderAtom getRenderAtom(View view) { RenderAtom ra; - int index; - // If renderAtom is not scoped to this view, don't even - // bother creating the renderAtom - synchronized (lockObj) { - index = view.viewIndex; - if (index >= renderAtoms.length) { + // If renderAtom is not scoped to this view, don't even + // bother creating the renderAtom, just return + if (source.viewList != null && !source.viewList.contains(view)) + return null; - // If creating a new RenderAtom, but this ga is not scoped - // to this view, then just return .. - if (source.viewList != null && - !source.viewList.contains(view)) - return null; + int index = view.viewIndex; + if (index >= renderAtoms.length) { RenderAtom[] newList = new RenderAtom[index+1]; for (int i = 0; i < renderAtoms.length; i++) { newList[i] = renderAtoms[i]; @@ -208,12 +203,6 @@ class GeometryAtom extends Object implements BHLeafInterface, NnuId { renderAtoms = newList; } else { if (renderAtoms[index] == null) { - // If creating a new RenderAtom, but this ga is not scoped - // to this view, then just return .. - if (source.viewList != null && - !source.viewList.contains(view)) - return null; - ra = new RenderAtom(); renderAtoms[index] = ra; renderAtoms[index].geometryAtom = this; |