Index: src/org/openstreetmap/josm/tools/ImageProvider.java
===================================================================
--- src/org/openstreetmap/josm/tools/ImageProvider.java	(Revision 4941)
+++ src/org/openstreetmap/josm/tools/ImageProvider.java	(Arbeitskopie)
@@ -84,12 +84,6 @@
         OTHER   // everything else, e.g. png, gif (must be supported by Java)
     }
 
-    public static enum SanitizeMode {
-        OFF,                // never sanitize the image
-        ALWAYS,             // always copy to a new BufferedImage
-        MAKE_BUFFEREDIMAGE  // make sure the returned image is instance of BufferedImage
-    }
-
     protected Collection<String> dirs;
     protected String id;
     protected String subdir;
@@ -99,7 +93,6 @@
     protected int height = -1;
     protected int maxWidth = -1;
     protected int maxHeight = -1;
-    protected SanitizeMode sanitize;
     protected boolean optional;
 
     private static SVGUniverse svgUniverse;
@@ -207,14 +200,6 @@
     }
 
     /**
-     * Set true, if the image should be repainted to a new BufferedImage in order to work around certain issues.
-     */
-    public ImageProvider setSanitize(SanitizeMode sanitize) {
-        this.sanitize = sanitize;
-        return this;
-    }
-
-    /**
      * The image URL comes from user data and the image may be missing.
      *
      * Set true, if JOSM should *not* throw a RuntimeException in case the image cannot be located.
@@ -239,9 +224,9 @@
             }
         }
         if (maxWidth != -1 || maxHeight != -1)
-            return ir.getImageIconBounded(new Dimension(maxWidth, maxHeight), sanitize);
+            return ir.getImageIconBounded(new Dimension(maxWidth, maxHeight));
         else
-            return ir.getImageIcon(new Dimension(width, height), sanitize);
+            return ir.getImageIcon(new Dimension(width, height));
     }
 
     /**
@@ -291,10 +276,9 @@
                             : URLDecoder.decode(data, "utf-8").getBytes();
                     if (mediatype != null && mediatype.contains("image/svg+xml")) {
                         URI uri = getSvgUniverse().loadSVG(new StringReader(new String(bytes)), name);
-                        SVGDiagram svg = getSvgUniverse().getDiagram(uri);
-                        return new ImageResource(svg);
+                        return new ImageResource(getSvgUniverse().getDiagram(uri));
                     } else {
-                        return new ImageResource(new ImageIcon(bytes).getImage(), true);
+                        return new ImageResource(new ImageIcon(bytes).getImage());
                     }
                 }
             }
@@ -405,7 +389,7 @@
                     try {
                         img = ImageIO.read(is.getFile().toURI().toURL());
                     } catch (IOException e) {}
-                    return img == null ? null : new ImageResource(img, true);
+                    return img == null ? null : new ImageResource(img);
                 default:
                     throw new AssertionError();
             }
@@ -474,7 +458,7 @@
                             try {
                                 img = ImageIO.read(new ByteArrayInputStream(buf));
                             } catch (IOException e) {}
-                            return img == null ? null : new ImageResource(img, false);
+                            return img == null ? null : new ImageResource(img);
                         default:
                             throw new AssertionError();
                     }
@@ -508,7 +492,7 @@
                 try {
                     img = ImageIO.read(path);
                 } catch (IOException e) {}
-                return img == null ? null : new ImageResource(img, true);
+                return img == null ? null : new ImageResource(img);
             default:
                 throw new AssertionError();
         }
@@ -766,15 +750,6 @@
         return get("data", type.getAPIName());
     }
 
-    public static BufferedImage sanitize(Image img) {
-        (new ImageIcon(img)).getImage(); // load competely
-        int width = img.getWidth(null);
-        int height = img.getHeight(null);
-        BufferedImage result = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
-        result.getGraphics().drawImage(img, 0, 0, null);
-        return result;
-    }
-
     public static Image createImageFromSvg(SVGDiagram svg, Dimension dim) {
         float realWidth = svg.getWidth();
         float realHeight = svg.getHeight();
Index: src/org/openstreetmap/josm/tools/ImageResource.java
===================================================================
--- src/org/openstreetmap/josm/tools/ImageResource.java	(Revision 4941)
+++ src/org/openstreetmap/josm/tools/ImageResource.java	(Arbeitskopie)
@@ -9,8 +9,6 @@
 import java.util.HashMap;
 import javax.swing.ImageIcon;
 
-import org.openstreetmap.josm.tools.ImageProvider.SanitizeMode;
-
 /**
  * Holds data for one particular image.
  * It can be backed by a svg or raster image.
@@ -23,27 +21,13 @@
     /**
      * Caches the image data for resized versions of the same image.
      */
-    private HashMap<Dimension, ImageWrapper> imgCache = new HashMap<Dimension, ImageWrapper>();
+    private HashMap<Dimension, Image> imgCache = new HashMap<Dimension, Image>();
     private SVGDiagram svg;
     public static final Dimension DEFAULT_DIMENSION = new Dimension(-1, -1);
  
-    /**
-     * remember whether the image has been sanitized
-     */
-    private static class ImageWrapper {
-        Image img;
-        boolean sanitized;
-
-        public ImageWrapper(Image img, boolean sanitized) {
-            CheckParameterUtil.ensureParameterNotNull(img);
-            this.img = img;
-            this.sanitized = sanitized;
-        }
-    }
-    
-    public ImageResource(Image img, boolean sanitized) {
+    public ImageResource(Image img) {
         CheckParameterUtil.ensureParameterNotNull(img);
-        imgCache.put(DEFAULT_DIMENSION, new ImageWrapper(img, sanitized));
+        imgCache.put(DEFAULT_DIMENSION, img);
     }
 
     public ImageResource(SVGDiagram svg) {
@@ -52,7 +36,7 @@
     }
 
     public ImageIcon getImageIcon() {
-        return getImageIcon(DEFAULT_DIMENSION, SanitizeMode.OFF);
+        return getImageIcon(DEFAULT_DIMENSION);
     }
 
     /**
@@ -60,46 +44,32 @@
      * @param   dim The requested dimensions. Use (-1,-1) for the original size
      *          and (width, -1) to set the width, but otherwise scale the image
      *          proportionally.
-     * @param sanitize Whether the returned image should be copied to a BufferedImage
-     *          to avoid certain problem with native image formats.
      */
-    public ImageIcon getImageIcon(Dimension dim, SanitizeMode sanitize) {
+    public ImageIcon getImageIcon(Dimension dim) {
         if (dim.width < -1 || dim.width == 0 || dim.height < -1 || dim.height == 0)
             throw new IllegalArgumentException();
-        ImageWrapper iw = imgCache.get(dim);
-        if (iw != null) {
-            if (!iw.sanitized) {
-                if (sanitize == SanitizeMode.ALWAYS || (sanitize == SanitizeMode.MAKE_BUFFEREDIMAGE && !(iw.img instanceof BufferedImage))) {
-                    iw.img = ImageProvider.sanitize(iw.img);
-                    iw.sanitized = true;
-                }
-            }
-            return new ImageIcon(iw.img);
+        Image img = imgCache.get(dim);
+        if (img != null) {
+            return new ImageIcon(img);
         }
         if (svg != null) {
-            Image img = ImageProvider.createImageFromSvg(svg, dim);
-            imgCache.put(dim, new ImageWrapper(img, true));
+            img = ImageProvider.createImageFromSvg(svg, dim);
+            imgCache.put(dim, img);
             return new ImageIcon(img);
         } else {
-            ImageWrapper base = imgCache.get(DEFAULT_DIMENSION);
+            Image base = imgCache.get(DEFAULT_DIMENSION);
             if (base == null) throw new AssertionError();
             
             int width = dim.width;
             int height = dim.height;
-            ImageIcon icon = new ImageIcon(base.img);
+            ImageIcon icon = new ImageIcon(base);
             if (width == -1) {
                 width = icon.getIconWidth() * height / icon.getIconHeight();
             } else if (height == -1) {
                 height = icon.getIconHeight() * width / icon.getIconWidth();
             }
-            Image img;
             img = icon.getImage().getScaledInstance(width, height, Image.SCALE_SMOOTH);
-            boolean sanitized = false;
-            if (sanitize == SanitizeMode.ALWAYS || (sanitize == SanitizeMode.MAKE_BUFFEREDIMAGE && !(img instanceof BufferedImage))) {
-                img = ImageProvider.sanitize(img);
-                sanitized = true;
-            }
-            imgCache.put(dim, new ImageWrapper(img, sanitized));
+            imgCache.put(dim, img);
             return new ImageIcon(img);
         }
     }
@@ -111,7 +81,7 @@
      * @param maxSize The maximum size. One of the dimensions (widht or height) can be -1,
      * which means it is not bounded.
      */
-    public ImageIcon getImageIconBounded(Dimension maxSize, SanitizeMode sanitize) {
+    public ImageIcon getImageIconBounded(Dimension maxSize) {
         if (maxSize.width < -1 || maxSize.width == 0 || maxSize.height < -1 || maxSize.height == 0)
             throw new IllegalArgumentException();
         float realWidth;
@@ -120,9 +90,9 @@
             realWidth = svg.getWidth();
             realHeight = svg.getHeight();
         } else {
-            ImageWrapper base = imgCache.get(DEFAULT_DIMENSION);
+            Image base = imgCache.get(DEFAULT_DIMENSION);
             if (base == null) throw new AssertionError();
-            ImageIcon icon = new ImageIcon(base.img);
+            ImageIcon icon = new ImageIcon(base);
             realWidth = icon.getIconWidth();
             realHeight = icon.getIconHeight();
         }
@@ -137,15 +107,15 @@
         }
 
         if (maxWidth == -1 && maxHeight == -1)
-            return getImageIcon(DEFAULT_DIMENSION, sanitize);
+            return getImageIcon(DEFAULT_DIMENSION);
         else if (maxWidth == -1)
-            return getImageIcon(new Dimension(-1, maxHeight), sanitize);
+            return getImageIcon(new Dimension(-1, maxHeight));
         else if (maxHeight == -1)
-            return getImageIcon(new Dimension(maxWidth, -1), sanitize);
+            return getImageIcon(new Dimension(maxWidth, -1));
         else
             if (realWidth / maxWidth > realHeight / maxHeight)
-                return getImageIcon(new Dimension(maxWidth, -1), sanitize);
+                return getImageIcon(new Dimension(maxWidth, -1));
             else
-                return getImageIcon(new Dimension(-1, maxHeight), sanitize);
+                return getImageIcon(new Dimension(-1, maxHeight));
    }
 }
Index: src/org/openstreetmap/josm/gui/mappaint/AreaElemStyle.java
===================================================================
--- src/org/openstreetmap/josm/gui/mappaint/AreaElemStyle.java	(Revision 4941)
+++ src/org/openstreetmap/josm/gui/mappaint/AreaElemStyle.java	(Arbeitskopie)
@@ -17,7 +17,6 @@
 import org.openstreetmap.josm.data.osm.visitor.paint.PaintColors;
 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.IconReference;
 import org.openstreetmap.josm.tools.CheckParameterUtil;
-import org.openstreetmap.josm.tools.ImageProvider.SanitizeMode;
 import org.openstreetmap.josm.tools.Utils;
 
 public class AreaElemStyle extends ElemStyle
@@ -44,7 +43,7 @@
 
         IconReference iconRef = c.get("fill-image", null, IconReference.class);
         if (iconRef != null) {
-            ImageIcon icon = MapPaintStyles.getIcon(iconRef, -1, -1, SanitizeMode.MAKE_BUFFEREDIMAGE);
+            ImageIcon icon = MapPaintStyles.getIcon(iconRef, -1, -1);
             if (icon != null) {
                 if (!(icon.getImage() instanceof BufferedImage))
                     throw new RuntimeException();
Index: src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
===================================================================
--- src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java	(Revision 4941)
+++ src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java	(Arbeitskopie)
@@ -26,7 +26,6 @@
 import org.openstreetmap.josm.gui.progress.ProgressMonitor;
 import org.openstreetmap.josm.io.MirroredInputStream;
 import org.openstreetmap.josm.tools.ImageProvider;
-import org.openstreetmap.josm.tools.ImageProvider.SanitizeMode;
 
 /**
  * This class manages the ElemStyles instance. The object you get with
@@ -88,10 +87,6 @@
     }
 
     public static ImageIcon getIcon(IconReference ref, int width, int height) {
-        return getIcon(ref, width, height, SanitizeMode.OFF);
-    }
-
-    public static ImageIcon getIcon(IconReference ref, int width, int height, SanitizeMode sanitize) {
         final String namespace = ref.source.getPrefName();
         ImageIcon i = new ImageProvider(ref.iconName)
                 .setDirs(getIconSourceDirs(ref.source))
@@ -99,7 +94,6 @@
                 .setArchive(ref.source.zipIcons)
                 .setWidth(width)
                 .setHeight(height)
-                .setSanitize(sanitize)
                 .setOptional(true).get();
         if(i == null)
         {
@@ -109,10 +103,6 @@
         return i;
     }
 
-    public static ImageIcon getNoIcon_Icon(StyleSource source) {
-        return getNoIcon_Icon(source, SanitizeMode.OFF);
-    }
-
     /**
      * No icon with the given name was found, show a dummy icon instead
      * @return the icon misc/no_icon.png, in descending priority:
@@ -121,12 +111,11 @@
      *   - josm's default icon
      *  can be null if the defaults are turned off by user
      */
-    public static ImageIcon getNoIcon_Icon(StyleSource source, SanitizeMode sanitize) {
+    public static ImageIcon getNoIcon_Icon(StyleSource source) {
         return new ImageProvider("misc/no_icon.png")
                 .setDirs(getIconSourceDirs(source))
                 .setId("mappaint."+source.getPrefName())
                 .setArchive(source.zipIcons)
-                .setSanitize(sanitize)
                 .setOptional(true).get();
     }
 
