The plot, she is thick. The Nenya framework supports a MediaOverlay that can
render sprites and animations over the top of everything in the frame: JComponents, MediaPanels anything we like. To support this, we have the MediaOverlay tell the ActiveRepaintManager when it has dirtied an area of the screen and it will mark that component as needing repainting. Peachy. However, if a component decides on its own that it needs repainting, we need to propagate that now dirty region up to the MediaOverlay so that it can repaint anything that's above the just-repainted component on the same frame tick. This also fixes a potential problem if a changed sprite dirties a component which then repaints itself but the bounds of that component overlapped some other sprite which was not going to be repainted on this tick. There were also potential problems if components were put in the JLayeredPane layers (which are "above" the normal components and MediaPanels but "below" the MediaOverlay). They too should now properly dirty regions in the overlay. It occurs to me though that if a MediaOverlay sprite is on top of a MediaPanel, the MediaPanel will probably not properly propagate its dirty region to the overlay because the MediaPanel is a frame participant, not a JComponent and its repainting is handled by the FrameManager not the ActiveRepaintManager. I may just use the sledgehammer approach and dirty in the media overlay the entire bounds of a frame participant if it paints anything on a frame rather than try to translated and propagate its underlying dirty regions up to the overlay. Oh the twisty maze of passages we've created in trying to create an active rendering system that works magically with Swing. git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@566 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -524,8 +524,8 @@ public abstract class FrameManager
|
||||
}
|
||||
}
|
||||
|
||||
// if we have a media overlay, give that a chance to propagate dirty regions to the active
|
||||
// repaint manager for areas it dirtied during this tick
|
||||
// if we have a media overlay, give that a chance to propagate its dirty regions to the
|
||||
// active repaint manager for areas it dirtied during this tick
|
||||
if (_overlay != null) {
|
||||
_overlay.propagateDirtyRegions(_repainter, _root.getRootPane());
|
||||
}
|
||||
@@ -561,6 +561,12 @@ public abstract class FrameManager
|
||||
renderLayer(g, bounds, lpane, clipped, JLayeredPane.POPUP_LAYER);
|
||||
renderLayer(g, bounds, lpane, clipped, JLayeredPane.DRAG_LAYER);
|
||||
}
|
||||
|
||||
// if we have a MediaOverlay, let it know that any sprites in this region need to be
|
||||
// repainted as the components beneath them have just been redrawn
|
||||
if (_overlay != null) {
|
||||
_overlay.addDirtyRegion(new Rectangle(bounds));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user