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:
@@ -82,7 +82,7 @@ public class MediaPanel extends JComponent
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
addObscurerDirtyRegions();
|
||||
addObscurerDirtyRegions(true);
|
||||
|
||||
// if we have no invalid rects, there's no need to repaint
|
||||
if (!_metamgr.getRegionManager().haveDirtyRegions()) {
|
||||
@@ -386,15 +386,17 @@ public class MediaPanel extends JComponent
|
||||
/**
|
||||
* Add dirty regions for all our obscurers.
|
||||
*/
|
||||
protected void addObscurerDirtyRegions ()
|
||||
protected void addObscurerDirtyRegions (boolean changedOnly)
|
||||
{
|
||||
if (_obscurerList != null) {
|
||||
for (Obscurer obscurer : _obscurerList) {
|
||||
|
||||
Rectangle obscured = obscurer.getObscured();
|
||||
Point pt = new Point(obscured.x, obscured.y);
|
||||
SwingUtilities.convertPointFromScreen(pt, this);
|
||||
addObscurerDirtyRegion(new Rectangle(pt.x, pt.y, obscured.width, obscured.height));
|
||||
Rectangle obscured = obscurer.getObscured(changedOnly);
|
||||
if (obscured != null) {
|
||||
Point pt = new Point(obscured.x, obscured.y);
|
||||
SwingUtilities.convertPointFromScreen(pt, this);
|
||||
addObscurerDirtyRegion(
|
||||
new Rectangle(pt.x, pt.y, obscured.width, obscured.height));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,6 +287,8 @@ public class VirtualMediaPanel extends MediaPanel
|
||||
// booch everything
|
||||
_vbounds.x = _nx; _vbounds.y = _ny;
|
||||
|
||||
addObscurerDirtyRegions(false);
|
||||
|
||||
// let derived classes react if they so desire
|
||||
viewLocationDidChange(dx, dy);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user