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:
@@ -118,6 +118,16 @@ public class RegionManager
|
||||
return (_dirty.size() > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns our unmerged list of dirty regions. <em>Do not</em> modify the returned list. It's
|
||||
* just for peeking. Unlike {@link #getDirtyRegions}, this does not clear out the list of dirty
|
||||
* regions and prepare for the next frame.
|
||||
*/
|
||||
public List<Rectangle> peekDirtyRegions ()
|
||||
{
|
||||
return _dirty;
|
||||
}
|
||||
|
||||
/**
|
||||
* Merges all outstanding dirty regions into a single list of rectangles and returns that to
|
||||
* the caller. Interally, the list of accumulated dirty regions is cleared out and prepared for
|
||||
|
||||
Reference in New Issue
Block a user