Not to freak out if we can't get a graphics to lay out our FPS label.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2542 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2003-05-04 23:28:18 +00:00
parent 21210eae62
commit baf4873fa6
+12 -9
View File
@@ -1,5 +1,5 @@
// //
// $Id: MediaPanel.java,v 1.36 2003/05/02 15:11:12 mdb Exp $ // $Id: MediaPanel.java,v 1.37 2003/05/04 23:28:18 mdb Exp $
package com.threerings.media; package com.threerings.media;
@@ -226,15 +226,18 @@ public class MediaPanel extends JComponent
_perfLabel.setText(perfStatus); _perfLabel.setText(perfStatus);
Graphics2D gfx = (Graphics2D)getGraphics(); Graphics2D gfx = (Graphics2D)getGraphics();
_perfLabel.layout(gfx); if (gfx != null) {
gfx.dispose(); _perfLabel.layout(gfx);
gfx.dispose();
// make sure the region we dirty contains the old and the new // make sure the region we dirty contains the old and
// text (which we ensure by never letting the rect shrink) // the new text (which we ensure by never letting the
Dimension psize = _perfLabel.getSize(); // rect shrink)
_perfRect.width = Math.max(_perfRect.width, psize.width); Dimension psize = _perfLabel.getSize();
_perfRect.height = Math.max(_perfRect.height, psize.height); _perfRect.width = Math.max(_perfRect.width, psize.width);
dirtyScreenRect(new Rectangle(_perfRect)); _perfRect.height = Math.max(_perfRect.height, psize.height);
dirtyScreenRect(new Rectangle(_perfRect));
}
} }
} }