Removed some debug logging; tried the buffer strategy approach which won't
work because we're not painting everything on every frame, but left the commented out alternative rendering code in there in case we want to fiddle with it at a later date (or provide support for buffer strategies for applications that do want to paint everything). git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1306 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: FrameManager.java,v 1.4 2002/04/27 18:59:27 mdb Exp $
|
// $Id: FrameManager.java,v 1.5 2002/04/27 22:39:45 mdb Exp $
|
||||||
|
|
||||||
package com.threerings.media;
|
package com.threerings.media;
|
||||||
|
|
||||||
@@ -246,11 +246,11 @@ public class FrameManager
|
|||||||
*/
|
*/
|
||||||
protected void paintParticipants (long tickStamp)
|
protected void paintParticipants (long tickStamp)
|
||||||
{
|
{
|
||||||
// create our buffer strategy if we don't already have one
|
// // create our buffer strategy if we don't already have one
|
||||||
if (_bufstrat == null) {
|
// if (_bufstrat == null) {
|
||||||
_frame.createBufferStrategy(2);
|
// _frame.createBufferStrategy(2);
|
||||||
_bufstrat = _frame.getBufferStrategy();
|
// _bufstrat = _frame.getBufferStrategy();
|
||||||
}
|
// }
|
||||||
|
|
||||||
// create our off-screen buffer if necessary
|
// create our off-screen buffer if necessary
|
||||||
GraphicsConfiguration gc = _frame.getGraphicsConfiguration();
|
GraphicsConfiguration gc = _frame.getGraphicsConfiguration();
|
||||||
@@ -271,10 +271,10 @@ public class FrameManager
|
|||||||
|
|
||||||
Rectangle bounds = new Rectangle();
|
Rectangle bounds = new Rectangle();
|
||||||
Graphics g = null, fg = null;
|
Graphics g = null, fg = null;
|
||||||
Insets fi = _frame.getInsets();
|
|
||||||
try {
|
try {
|
||||||
g = _backimg.getGraphics();
|
g = _backimg.getGraphics();
|
||||||
fg = _frame.getGraphics();
|
fg = _frame.getGraphics();
|
||||||
|
// g = _bufstrat.getDrawGraphics();
|
||||||
|
|
||||||
// if the image wasn't A-OK, we need to rerender the
|
// if the image wasn't A-OK, we need to rerender the
|
||||||
// whole business rather than just the dirty parts
|
// whole business rather than just the dirty parts
|
||||||
@@ -314,18 +314,11 @@ public class FrameManager
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// render this participant
|
// render this participant
|
||||||
// Log.info("Rendering [comp=" + pcomp.getClass().getName() +
|
|
||||||
// ", bounds=" + StringUtil.toString(bounds) + "].");
|
|
||||||
|
|
||||||
g.setClip(bounds);
|
g.setClip(bounds);
|
||||||
g.translate(bounds.x, bounds.y);
|
g.translate(bounds.x, bounds.y);
|
||||||
pcomp.paint(g);
|
pcomp.paint(g);
|
||||||
g.translate(-bounds.x, -bounds.y);
|
g.translate(-bounds.x, -bounds.y);
|
||||||
|
|
||||||
// // copy the off-screen buffer on-screen
|
|
||||||
// fg.setClip(bounds);
|
|
||||||
// fg.drawImage(_backimg, 0, 0, null);
|
|
||||||
|
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
String ptos = StringUtil.safeToString(part);
|
String ptos = StringUtil.safeToString(part);
|
||||||
Log.warning("Frame participant choked during paint " +
|
Log.warning("Frame participant choked during paint " +
|
||||||
@@ -334,9 +327,8 @@ public class FrameManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log.info("insets: " + fi + ", fb: " + _frame.getBounds());
|
|
||||||
// _frame.paint(g);
|
|
||||||
fg.drawImage(_backimg, 0, 0, null);
|
fg.drawImage(_backimg, 0, 0, null);
|
||||||
|
// _bufstrat.show();
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
if (g != null) {
|
if (g != null) {
|
||||||
@@ -348,22 +340,6 @@ public class FrameManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
} while (_backimg.contentsLost());
|
} while (_backimg.contentsLost());
|
||||||
|
|
||||||
// Graphics g = null;
|
|
||||||
// try {
|
|
||||||
// g = _bufstrat.getDrawGraphics();
|
|
||||||
// _frame.paint(g);
|
|
||||||
// _bufstrat.show();
|
|
||||||
|
|
||||||
// } catch (Throwable t) {
|
|
||||||
// Log.warning("Frame rendering choked.");
|
|
||||||
// Log.logStackTrace(t);
|
|
||||||
|
|
||||||
// } finally {
|
|
||||||
// if (g != null) {
|
|
||||||
// g.dispose();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// documentation inherited
|
// documentation inherited
|
||||||
@@ -473,8 +449,8 @@ public class FrameManager
|
|||||||
/** Our custom repaint manager. */
|
/** Our custom repaint manager. */
|
||||||
protected FrameRepaintManager _remgr;
|
protected FrameRepaintManager _remgr;
|
||||||
|
|
||||||
/** The buffer strategy used to do our rendering. */
|
// /** The buffer strategy used to do our rendering. */
|
||||||
protected BufferStrategy _bufstrat;
|
// protected BufferStrategy _bufstrat;
|
||||||
|
|
||||||
/** The image used to render off-screen. */
|
/** The image used to render off-screen. */
|
||||||
protected VolatileImage _backimg;
|
protected VolatileImage _backimg;
|
||||||
|
|||||||
Reference in New Issue
Block a user