[tiled] r691 - in trunk: . src/tiled/mapeditor src/tiled/mapeditor/plugin

svn@biggeruniverse.com svn at biggeruniverse.com
Tue Aug 15 04:26:13 PDT 2006


Author: bjorn
Date: 2006-07-29 06:50:36 -0500 (Sat, 29 Jul 2006)
New Revision: 691

Modified:
   trunk/CHANGES
   trunk/src/tiled/mapeditor/MapEditor.java
   trunk/src/tiled/mapeditor/plugin/PluginClassLoader.java
Log:
When an out of memory error occurs while saving the map as image, report it.

Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES	2006-07-15 18:30:59 UTC (rev 690)
+++ trunk/CHANGES	2006-07-29 11:50:36 UTC (rev 691)
@@ -3,11 +3,16 @@
 * Added support for tile instance properties (by Christian Henz)
 * Added ability to create stamp brushes from the tile palette
 * Embedded the tile palette
+* Report out of memory error when saving map as image
+
+0.6.1 - July 15th, 2006
+
 * Fixed creation of one-tile gaps between tilesets on saving (Christian Henz)
 * Fixed failing to default to map format by extention when plugins are loaded
 * Fixed active marquee not being reset on loading a map
 * Fixed layer duplicates to not share layer properties with the original
 * Fixed width of tile button changing between selecting a tile and no tile
+* Fixed the add-tile button being disabled in the case of empty tilesets
 
 0.6.0 - June 23rd, 2006
 

Modified: trunk/src/tiled/mapeditor/MapEditor.java
===================================================================
--- trunk/src/tiled/mapeditor/MapEditor.java	2006-07-15 18:30:59 UTC (rev 690)
+++ trunk/src/tiled/mapeditor/MapEditor.java	2006-07-29 11:50:36 UTC (rev 691)
@@ -1829,21 +1829,30 @@
             myView.setMode(MapView.PF_NOSPECIAL, true);
             myView.setZoom(mapView.getZoom());
             Dimension d = myView.getPreferredSize();
-            BufferedImage i = new BufferedImage(d.width, d.height,
-                                                BufferedImage.TYPE_INT_ARGB);
-            Graphics2D g = i.createGraphics();
-            g.setClip(0, 0, d.width, d.height);
-            myView.paint(g);
 
-            String format = filename.substring(filename.lastIndexOf('.') + 1);
+            try {
+                BufferedImage i = new BufferedImage(d.width, d.height,
+                                                    BufferedImage.TYPE_INT_ARGB);
+                Graphics2D g = i.createGraphics();
+                g.setClip(0, 0, d.width, d.height);
+                myView.paint(g);
 
-            try {
-                ImageIO.write(i, format, new File(filename));
-            } catch (IOException e) {
-                e.printStackTrace();
+                String format = filename.substring(filename.lastIndexOf('.') + 1);
+
+                try {
+                    ImageIO.write(i, format, new File(filename));
+                } catch (IOException e) {
+                    e.printStackTrace();
+                    JOptionPane.showMessageDialog(appFrame,
+                                                  "Error while saving " + filename + ": " + e.toString(),
+                                                  "Error while saving map image",
+                                                  JOptionPane.ERROR_MESSAGE);
+                }
+            } catch (OutOfMemoryError memoryError) {
                 JOptionPane.showMessageDialog(appFrame,
-                                              "Error while saving " + filename + ": " + e.toString(),
-                                              "Error while saving map image",
+                                              "Out of memory while creating image. Try increasing\n" +
+                                                      "your maximum heap size or zooming out a bit.",
+                                              "Out of memory",
                                               JOptionPane.ERROR_MESSAGE);
             }
         }

Modified: trunk/src/tiled/mapeditor/plugin/PluginClassLoader.java
===================================================================
--- trunk/src/tiled/mapeditor/plugin/PluginClassLoader.java	2006-07-15 18:30:59 UTC (rev 690)
+++ trunk/src/tiled/mapeditor/plugin/PluginClassLoader.java	2006-07-29 11:50:36 UTC (rev 691)
@@ -40,7 +40,7 @@
     private Vector readers, writers;
     private Hashtable readerFormats, writerFormats;
     private static PluginClassLoader instance;
-    
+
     public PluginClassLoader() {
         super(new URL[0]);
         plugins = new Vector();
@@ -65,7 +65,7 @@
         }
         return instance;
     }
-    
+
     public void readPlugins(String base, JFrame parent) throws Exception {
         String baseURL = base;
         ProgressMonitor monitor;




More information about the tiled-commit mailing list