Obscurers can now be told to only include changed regions in their reported obscured rectangle.

git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@895 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Mike Thomas
2010-03-02 23:00:10 +00:00
parent ac407478d7
commit 5e13f471ac
2 changed files with 12 additions and 8 deletions
+10 -8
View File
@@ -82,7 +82,7 @@ public class MediaPanel extends JComponent
/** /**
* Returns the region obscured by the obscurer, in screen coords. * Returns the region obscured by the obscurer, in screen coords.
*/ */
public Rectangle getObscured (); public Rectangle getObscured (boolean changedOnly);
} }
/** /**
@@ -342,7 +342,7 @@ public class MediaPanel extends JComponent
_tickPaintPending = false; _tickPaintPending = false;
} }
addObscurerDirtyRegions(); addObscurerDirtyRegions(true);
// if we have no invalid rects, there's no need to repaint // if we have no invalid rects, there's no need to repaint
if (!_metamgr.getRegionManager().haveDirtyRegions()) { if (!_metamgr.getRegionManager().haveDirtyRegions()) {
@@ -386,15 +386,17 @@ public class MediaPanel extends JComponent
/** /**
* Add dirty regions for all our obscurers. * Add dirty regions for all our obscurers.
*/ */
protected void addObscurerDirtyRegions () protected void addObscurerDirtyRegions (boolean changedOnly)
{ {
if (_obscurerList != null) { if (_obscurerList != null) {
for (Obscurer obscurer : _obscurerList) { for (Obscurer obscurer : _obscurerList) {
Rectangle obscured = obscurer.getObscured(changedOnly);
Rectangle obscured = obscurer.getObscured(); if (obscured != null) {
Point pt = new Point(obscured.x, obscured.y); Point pt = new Point(obscured.x, obscured.y);
SwingUtilities.convertPointFromScreen(pt, this); SwingUtilities.convertPointFromScreen(pt, this);
addObscurerDirtyRegion(new Rectangle(pt.x, pt.y, obscured.width, obscured.height)); addObscurerDirtyRegion(
new Rectangle(pt.x, pt.y, obscured.width, obscured.height));
}
} }
} }
} }
@@ -287,6 +287,8 @@ public class VirtualMediaPanel extends MediaPanel
// booch everything // booch everything
_vbounds.x = _nx; _vbounds.y = _ny; _vbounds.x = _nx; _vbounds.y = _ny;
addObscurerDirtyRegions(false);
// let derived classes react if they so desire // let derived classes react if they so desire
viewLocationDidChange(dx, dy); viewLocationDidChange(dx, dy);
} }