summaryrefslogtreecommitdiff
path: root/altosuilib/AltosUIMapView.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2014-06-13 21:26:33 -0700
committerKeith Packard <keithp@keithp.com>2014-06-13 21:26:33 -0700
commit9a6a3c34293eac6442f766e13ce148f595e891eb (patch)
tree7a9b05e48f8aabc43260b377c6b7b3559cd75fbd /altosuilib/AltosUIMapView.java
parent92895c87bc3d97bf4990f1feda0bd8b07da4c405 (diff)
altosuilib: Make map-cache per-window instead of global
This consumes more memory, but avoids cache conflicts between windows Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altosuilib/AltosUIMapView.java')
-rw-r--r--altosuilib/AltosUIMapView.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/altosuilib/AltosUIMapView.java b/altosuilib/AltosUIMapView.java
index efae3767..4df178e2 100644
--- a/altosuilib/AltosUIMapView.java
+++ b/altosuilib/AltosUIMapView.java
@@ -34,6 +34,8 @@ public class AltosUIMapView extends Component implements MouseMotionListener, Mo
AltosUIMapLine line = new AltosUIMapLine();
+ AltosUIMapCache cache = new AltosUIMapCache();
+
LinkedList<AltosUIMapMark> marks = new LinkedList<AltosUIMapMark>();
LinkedList<AltosUIMapZoomListener> zoom_listeners = new LinkedList<AltosUIMapZoomListener>();
@@ -368,7 +370,7 @@ public class AltosUIMapView extends Component implements MouseMotionListener, Mo
for (Point point : to_remove)
tiles.remove(point);
- AltosUIMapCache.set_cache_size(((lower_right.y - upper_left.y) / px_size + 1) * ((lower_right.x - upper_left.x) / px_size + 1));
+ cache.set_cache_size(((lower_right.y - upper_left.y) / px_size + 1) * ((lower_right.x - upper_left.x) / px_size + 1));
for (int y = upper_left.y; y <= lower_right.y; y += px_size) {
for (int x = upper_left.x; x <= lower_right.x; x += px_size) {
Point point = new Point(x, y);
@@ -394,6 +396,8 @@ public class AltosUIMapView extends Component implements MouseMotionListener, Mo
}
}
+ public AltosUIMapCache cache() { return cache; }
+
/* AltosUIMapStoreListener methods */
public void notify_store(AltosUIMapStore store, int status) {
if (load_listener != null) {