From 5c03adbb72d84694e0102f57b8b2ea1d767342ca Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Sun, 27 Apr 2003 07:33:15 +0000 Subject: [PATCH] Added support for temporarily disabling image and tile cache flushing. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2483 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../com/threerings/media/image/ImageManager.java | 13 ++++++++++++- src/java/com/threerings/media/tile/TileSet.java | 15 ++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/java/com/threerings/media/image/ImageManager.java b/src/java/com/threerings/media/image/ImageManager.java index 8bfd95f21..40d9eede8 100644 --- a/src/java/com/threerings/media/image/ImageManager.java +++ b/src/java/com/threerings/media/image/ImageManager.java @@ -1,5 +1,5 @@ // -// $Id: ImageManager.java,v 1.51 2003/04/27 06:33:11 mdb Exp $ +// $Id: ImageManager.java,v 1.52 2003/04/27 07:33:15 mdb Exp $ package com.threerings.media.image; @@ -111,6 +111,17 @@ public class ImageManager } } + /** + * Used to disable the flushing of cached images temporarily. If one + * wishes to avoid garbage collection for a short period of time, they + * may disable image flushing during that period. A call to {@link + * System#gc} is probably a good idea once flushing is reenabled. + */ + public void setCanFlushCache (boolean enabled) + { + _ccache.setCanFlush(enabled); + } + /** * Creates a buffered image, optimized for display on our graphics * device. diff --git a/src/java/com/threerings/media/tile/TileSet.java b/src/java/com/threerings/media/tile/TileSet.java index 6dc2269b6..662ac061a 100644 --- a/src/java/com/threerings/media/tile/TileSet.java +++ b/src/java/com/threerings/media/tile/TileSet.java @@ -1,5 +1,5 @@ // -// $Id: TileSet.java,v 1.47 2003/04/25 18:21:49 mdb Exp $ +// $Id: TileSet.java,v 1.48 2003/04/27 07:33:15 mdb Exp $ package com.threerings.media.tile; @@ -326,6 +326,19 @@ public abstract class TileSet return buf.append("]").toString(); } + /** + * Used to disable the flushing of cached tiles temporarily. If one + * wishes to avoid garbage collection for a short period of time, they + * may disable tile flushing during that period. A call to {@link + * System#gc} is probably a good idea once flushing is reenabled. + */ + public static void setCanFlushCache (boolean enabled) + { + if (_tiles != null) { + _tiles.setCanFlush(enabled); + } + } + /** * Derived classes can override this, calling * super.toString(buf) and then appending additional