From 8bff333dd81cc6e3a0f8576de12483a3bac6b3ed Mon Sep 17 00:00:00 2001 From: Dave Hoover Date: Wed, 24 Jan 2007 21:34:51 +0000 Subject: [PATCH] Fix dirty coords for our overlay so it all lines up and works. Yay! And some tabs -> spaces while I was there. git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@123 ed5b42cb-e716-0410-a449-f6a68f950b19 --- .../media/ActiveRepaintManager.java | 32 +++++++++---------- .../com/threerings/media/MediaOverlay.java | 3 +- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/java/com/threerings/media/ActiveRepaintManager.java b/src/java/com/threerings/media/ActiveRepaintManager.java index 4fad74a9..695edabc 100644 --- a/src/java/com/threerings/media/ActiveRepaintManager.java +++ b/src/java/com/threerings/media/ActiveRepaintManager.java @@ -107,13 +107,13 @@ public class ActiveRepaintManager extends RepaintManager // make sure that the component is actually in a window or applet // that is showing - if (getRoot(vroot) == null) { + if (getRoot(vroot) == null) { if (DEBUG) { Log.info("Skipping rootless component [comp=" + toString(comp) + ", vroot=" + toString(vroot) + "]."); } - return; - } + return; + } // add the invalid component to our list and we'll validate it on the next frame if (!ListUtil.containsRef(_invalid, vroot)) { @@ -142,12 +142,12 @@ public class ActiveRepaintManager extends RepaintManager } // if this component is already dirty, simply expand their existing dirty rectangle - Rectangle drect = (Rectangle)_dirty.get(comp); - if (drect != null) { + Rectangle drect = (Rectangle)_dirty.get(comp); + if (drect != null) { drect.add(x, y); drect.add(x+width, y+height); - return; - } + return; + } // make sure this component has a valid root if (getRoot(comp) == null) { @@ -171,7 +171,7 @@ public class ActiveRepaintManager extends RepaintManager */ protected Component getRoot (Component comp) { - for (Component c = comp; c != null; c = c.getParent()) { + for (Component c = comp; c != null; c = c.getParent()) { boolean hidden = !c.isDisplayable(); // on the mac, the JRootPane is invalidated before it is visible and is never again // invalidated or repainted, so we punt and allow all invisible components to be @@ -179,25 +179,25 @@ public class ActiveRepaintManager extends RepaintManager if (!RunAnywhere.isMacOS()) { hidden |= !c.isVisible(); } - if (hidden) { - return null; - } + if (hidden) { + return null; + } if (c instanceof Window || c instanceof Applet) { - return c; - } - } + return c; + } + } return null; } // documentation inherited public synchronized Rectangle getDirtyRegion (JComponent comp) { - Rectangle drect = (Rectangle)_dirty.get(comp); + Rectangle drect = (Rectangle)_dirty.get(comp); // copy the rectangle if we found one, otherwise create an empty rectangle because we don't // want them leaving empty handed return (drect == null) ? new Rectangle(0, 0, 0, 0) : new Rectangle(drect); } - + // documentation inherited public synchronized void markCompletelyClean (JComponent comp) { diff --git a/src/java/com/threerings/media/MediaOverlay.java b/src/java/com/threerings/media/MediaOverlay.java index 6465adf7..13200deb 100644 --- a/src/java/com/threerings/media/MediaOverlay.java +++ b/src/java/com/threerings/media/MediaOverlay.java @@ -135,7 +135,8 @@ public class MediaOverlay _dirty = _metamgr.getRegionManager().getDirtyRegions(); for (int ii = 0; ii < _dirty.length; ii++) { Rectangle dirty = _dirty[ii]; - repmgr.addDirtyRegion(root, dirty.x, dirty.y, dirty.width, dirty.height); + repmgr.addDirtyRegion(root, dirty.x - root.getX(), dirty.y - root.getY(), + dirty.width, dirty.height); } } }