The revamp that made me nervous about our rendering performance but turned
out to be not at all related. Out with the wacky system of events that require the observers to instanceof to the high heavens. Now we just call sensible methods directly on the observers who care and not on those who don't. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2503 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: AbstractMedia.java,v 1.8 2003/01/18 22:25:21 mdb Exp $
|
||||
// $Id: AbstractMedia.java,v 1.9 2003/04/30 00:43:54 mdb Exp $
|
||||
|
||||
package com.threerings.media;
|
||||
|
||||
@@ -169,6 +169,22 @@ public abstract class AbstractMedia
|
||||
return _renderOrder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Queues the supplied notification up to be dispatched to this
|
||||
* abstract media's observers.
|
||||
*/
|
||||
public void queueNotification (ObserverList.ObserverOp amop)
|
||||
{
|
||||
if (_observers != null) {
|
||||
if (_mgr != null) {
|
||||
_mgr.queueNotification(_observers, amop);
|
||||
} else {
|
||||
Log.warning("Have no manager, dropping notification " +
|
||||
"[media=" + this + ", op=" + amop + "].");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the media.
|
||||
*/
|
||||
|
||||
@@ -1,20 +1,17 @@
|
||||
//
|
||||
// $Id: AbstractMediaManager.java,v 1.8 2003/04/15 21:27:22 mdb Exp $
|
||||
// $Id: AbstractMediaManager.java,v 1.9 2003/04/30 00:43:54 mdb Exp $
|
||||
|
||||
package com.threerings.media;
|
||||
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.Shape;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
|
||||
import com.samskivert.util.ListUtil;
|
||||
import com.samskivert.util.ObserverList.ObserverOp;
|
||||
import com.samskivert.util.ObserverList;
|
||||
import com.samskivert.util.SortableArrayList;
|
||||
import com.samskivert.util.StringUtil;
|
||||
import com.samskivert.util.Tuple;
|
||||
|
||||
/**
|
||||
@@ -208,31 +205,26 @@ public abstract class AbstractMediaManager
|
||||
}
|
||||
|
||||
/**
|
||||
* Queues the event for dispatching after we've ticked all
|
||||
* the media.
|
||||
* Queues the notification for dispatching after we've ticked all the
|
||||
* media.
|
||||
*/
|
||||
public void queueNotification (ObserverList observers, Object event)
|
||||
public void queueNotification (ObserverList observers, ObserverOp event)
|
||||
{
|
||||
_notify.add(new Tuple(observers, event));
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatches all queued events.
|
||||
* Dispatches all queued media notifications.
|
||||
*/
|
||||
protected void dispatchNotifications ()
|
||||
{
|
||||
for (int ii=0, nn=_notify.size(); ii < nn; ii++) {
|
||||
Tuple tuple = (Tuple)_notify.remove(0);
|
||||
dispatchEvent((ObserverList)tuple.left, tuple.right);
|
||||
for (int ii = 0, nn = _notify.size(); ii < nn; ii++) {
|
||||
Tuple tuple = (Tuple)_notify.get(ii);
|
||||
((ObserverList)tuple.left).apply((ObserverOp)tuple.right);
|
||||
}
|
||||
_notify.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatches the specified event to the specified observers.
|
||||
*/
|
||||
protected abstract void dispatchEvent (
|
||||
ObserverList observers, Object event);
|
||||
|
||||
/** The region manager. */
|
||||
protected RegionManager _remgr;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user