From 10e32b117f1ff835a8070cc99a3883bf9f5699e6 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Wed, 5 Oct 2005 21:57:34 +0000 Subject: [PATCH] Made getActionFrames() public. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3723 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../com/threerings/cast/CharacterManager.java | 70 +++++++++---------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/src/java/com/threerings/cast/CharacterManager.java b/src/java/com/threerings/cast/CharacterManager.java index edcc8810b..0f81ef060 100644 --- a/src/java/com/threerings/cast/CharacterManager.java +++ b/src/java/com/threerings/cast/CharacterManager.java @@ -149,6 +149,41 @@ public class CharacterManager } } + /** + * Obtains the composited animation frames for the specified action for a + * character with the specified descriptor. The resulting composited + * animation will be cached. + * + * @exception NoSuchComponentException thrown if any of the components in + * the supplied descriptor do not exist. + * @exception IllegalArgumentException thrown if any of the components + * referenced in the descriptor do not support the specified action. + */ + public ActionFrames getActionFrames ( + CharacterDescriptor descrip, String action) + throws NoSuchComponentException + { + Tuple key = new Tuple(descrip, action); + ActionFrames frames = (ActionFrames)_actionFrames.get(key); + if (frames == null) { + // this doesn't actually composite the images, but prepares an + // object to be able to do so + frames = createCompositeFrames(descrip, action); + _actionFrames.put(key, frames); + } + + // periodically report our frame image cache performance + if (!_cacheStatThrottle.throttleOp()) { + long size = getEstimatedCacheMemoryUsage(); + int[] eff = _frameCache.getTrackedEffectiveness(); + Log.debug("CharacterManager LRU [mem=" + (size / 1024) + "k" + + ", size=" + _frameCache.size() + ", hits=" + eff[0] + + ", misses=" + eff[1] + "]."); + } + + return frames; + } + /** * Informs the character manager that the action sequence for the * given character descriptor is likely to be needed in the near @@ -181,41 +216,6 @@ public class CharacterManager return (ActionSequence)_actions.get(action); } - /** - * Obtains the composited animation frames for the specified action - * for a character with the specified descriptor. The resulting - * composited animation will be cached. - * - * @exception NoSuchComponentException thrown if any of the components - * in the supplied descriptor do not exist. - * @exception IllegalArgumentException thrown if any of the components - * referenced in the descriptor do not support the specified action. - */ - protected ActionFrames getActionFrames ( - CharacterDescriptor descrip, String action) - throws NoSuchComponentException - { - Tuple key = new Tuple(descrip, action); - ActionFrames frames = (ActionFrames)_actionFrames.get(key); - if (frames == null) { - // this doesn't actually composite the images, but prepares an - // object to be able to do so - frames = createCompositeFrames(descrip, action); - _actionFrames.put(key, frames); - } - - // periodically report our frame image cache performance - if (!_cacheStatThrottle.throttleOp()) { - long size = getEstimatedCacheMemoryUsage(); - int[] eff = _frameCache.getTrackedEffectiveness(); - Log.debug("CharacterManager LRU [mem=" + (size / 1024) + "k" + - ", size=" + _frameCache.size() + ", hits=" + eff[0] + - ", misses=" + eff[1] + "]."); - } - - return frames; - } - /** * Returns the estimated memory usage in bytes for all images * currently cached by the cached action frames.