Index: trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintMenu.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintMenu.java	(revision 8096)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintMenu.java	(revision 8097)
@@ -34,5 +34,5 @@
 
         public MapPaintAction(StyleSource style) {
-            super(style.getDisplayString(), style.getIcon(),
+            super(style.getDisplayString(), style.getIconProvider(),
                     tr("Select the map painting styles"), null, true, "mappaint/" + style.getDisplayString(), true);
             this.button = new StayOpenCheckBoxMenuItem(this);
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java	(revision 8096)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java	(revision 8097)
@@ -102,14 +102,41 @@
     }
 
-    public static ImageIcon getIcon(IconReference ref, int width, int height) {
+    /**
+     * Image provider for icon. Note that this is a provider only. A @link{ImageProvider#get()} call may still
+     * fail!
+     *
+     * @param ref reference to the requested icon
+     * @param test if <code>true</code> than the icon is request is tested
+     * @return image provider for icon (can be <code>null</code> when <code>test</code> is <code>true</code>).
+     * @since 8097
+     * @see #getIcon(IconReference, int,int)
+     */
+    public static ImageProvider getIconProvider(IconReference ref, boolean test) {
         final String namespace = ref.source.getPrefName();
-        ImageIcon i = new ImageProvider(ref.iconName)
+        ImageProvider i = new ImageProvider(ref.iconName)
                 .setDirs(getIconSourceDirs(ref.source))
                 .setId("mappaint."+namespace)
                 .setArchive(ref.source.zipIcons)
                 .setInArchiveDir(ref.source.getZipEntryDirName())
-                .setWidth(width)
-                .setHeight(height)
-                .setOptional(true).get();
+                .setOptional(true);
+        if (test && i.get() == null) {
+            Main.warn("Mappaint style \""+namespace+"\" ("+ref.source.getDisplayString()+") icon \"" + ref.iconName + "\" not found.");
+            return null;
+        }
+        return i;
+    }
+
+    /**
+     * Return scaled icon.
+     *
+     * @param ref reference to the requested icon
+     * @param width icon width or -1 for autoscale
+     * @param height icon height or -1 for autoscale
+     * @return image icon or <code>null</code>.
+     * @see #getIconProvider(IconReference, boolean)
+     */
+    public static ImageIcon getIcon(IconReference ref, int width, int height) {
+        final String namespace = ref.source.getPrefName();
+        ImageIcon i = getIconProvider(ref, false).setWidth(width).setHeight(height).get();
         if (i == null) {
             Main.warn("Mappaint style \""+namespace+"\" ("+ref.source.getDisplayString()+") icon \"" + ref.iconName + "\" not found.");
Index: trunk/src/org/openstreetmap/josm/gui/mappaint/StyleSource.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/mappaint/StyleSource.java	(revision 8096)
+++ trunk/src/org/openstreetmap/josm/gui/mappaint/StyleSource.java	(revision 8097)
@@ -21,4 +21,5 @@
 import org.openstreetmap.josm.gui.preferences.SourceEntry;
 import org.openstreetmap.josm.io.CachedFile;
+import org.openstreetmap.josm.tools.ImageOverlay;
 import org.openstreetmap.josm.tools.ImageProvider;
 import org.openstreetmap.josm.tools.Utils;
@@ -35,5 +36,9 @@
     public File zipIcons;
 
-    private ImageIcon imageIcon;
+    /** image provider returning the icon for this style */
+    private ImageProvider imageIconProvider;
+
+    /** image provider returning the default icon */
+    private static ImageProvider defaultIconProvider;
 
     /******
@@ -41,5 +46,4 @@
      * of the source file.
      */
-
     public String icon;
 
@@ -115,40 +119,74 @@
     }
 
+    /**
+     * Initialize the class.
+     */
     protected void init() {
         errors.clear();
-        imageIcon = null;
+        imageIconProvider = null;
         icon = null;
     }
 
-    private static ImageIcon defaultIcon;
-
-    private static ImageIcon getDefaultIcon() {
-        if (defaultIcon == null) {
-            defaultIcon = ImageProvider.get("dialogs/mappaint", "pencil");
+    /**
+     * Image provider for default icon.
+     *
+     * @return image provider for default styles icon
+     * @since 8097
+     * @see #getIconProvider()
+     */
+    private static ImageProvider getDefaultIconProvider() {
+        if (defaultIconProvider == null) {
+            defaultIconProvider = new ImageProvider("dialogs/mappaint", "pencil");
         }
-        return defaultIcon;
-    }
-
-    protected ImageIcon getSourceIcon() {
-        if (imageIcon == null) {
+        return defaultIconProvider;
+    }
+
+    /**
+     * Image provider for source icon. Uses default icon, when not else available.
+     *
+     * @return image provider for styles icon
+     * @since 8097
+     * @see #getIconProvider()
+     */
+    protected ImageProvider getSourceIconProvider() {
+        if (imageIconProvider == null) {
             if (icon != null) {
-                imageIcon = MapPaintStyles.getIcon(new IconReference(icon, this), -1, -1);
+                imageIconProvider = MapPaintStyles.getIconProvider(new IconReference(icon, this), true);
             }
-            if (imageIcon == null) {
-                imageIcon = getDefaultIcon();
+            if (imageIconProvider == null) {
+                imageIconProvider = getDefaultIconProvider();
             }
         }
-        return imageIcon;
-    }
-
+        return imageIconProvider;
+    }
+
+    /**
+     * Image provider for source icon.
+     *
+     * @return image provider for styles icon
+     * @since 8097
+     */
+    public final ImageProvider getIconProvider() {
+        ImageProvider i = getSourceIconProvider();
+        if (!getErrors().isEmpty()) {
+            i = new ImageProvider(i).addOverlay(new ImageOverlay(new ImageProvider("dialogs/mappaint/error_small")));
+        }
+        return i;
+    }
+
+    /**
+     * Image for source icon.
+     *
+     * @return styles icon for display
+     */
     public final ImageIcon getIcon() {
-        if (getErrors().isEmpty())
-            return getSourceIcon();
-        else
-            return ImageProvider.overlay(getSourceIcon(),
-                    ImageProvider.get("dialogs/mappaint/error_small"),
-                    ImageProvider.OverlayPosition.SOUTHEAST);
-    }
-
+        return getIconProvider().setMaxSize(ImageProvider.ImageSizes.MENU).get();
+    }
+
+    /**
+     * Return text to display as ToolTip.
+     *
+     * @return tooltip text containing error status
+     */
     public String getToolTipText() {
         if (errors.isEmpty())
Index: trunk/src/org/openstreetmap/josm/tools/ImageOverlay.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/ImageOverlay.java	(revision 8096)
+++ trunk/src/org/openstreetmap/josm/tools/ImageOverlay.java	(revision 8097)
@@ -81,10 +81,7 @@
         ImageIcon overlay;
         if(width != -1 || height != -1) {
-            /* Don't modify ImageProvider, but apply maximum size, probably cloning the ImageProvider
-               would be a better approach. */
-            overlay = image.getResource().getImageIconBounded(new Dimension(width, height));
-        } else {
-            overlay = image.get();
+            image = new ImageProvider(image).resetMaxSize(new Dimension(width, height));
         }
+        overlay = image.get();
         int x, y;
         if (width == -1 && offsetLeft < 0) {
Index: trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/ImageProvider.java	(revision 8096)
+++ trunk/src/org/openstreetmap/josm/tools/ImageProvider.java	(revision 8097)
@@ -240,4 +240,26 @@
 
     /**
+     * Constructs a new {@code ImageProvider} from an existing one.
+     * @param image the existing image provider to be copied
+     * @since 8095
+     */
+    public ImageProvider(ImageProvider image) {
+        this.dirs = image.dirs;
+        this.id = image.id;
+        this.subdir = image.subdir;
+        this.name = image.name;
+        this.archive = image.archive;
+        this.inArchiveDir = image.inArchiveDir;
+        this.width = image.width;
+        this.height = image.height;
+        this.maxWidth = image.maxWidth;
+        this.maxHeight = image.maxHeight;
+        this.optional = image.optional;
+        this.suppressWarnings = image.suppressWarnings;
+        this.additionalClassLoaders = image.additionalClassLoaders;
+        this.overlayInfo = image.overlayInfo;
+    }
+
+    /**
      * Directories to look for the image.
      * @param dirs The directories to look for.
@@ -384,4 +406,27 @@
         this.maxWidth = maxSize.width;
         this.maxHeight = maxSize.height;
+        return this;
+    }
+
+    /**
+     * Limit the maximum size of the image.
+     *
+     * It will shrink the image if necessary, but keep the aspect ratio.
+     * The given width or height can be -1 which means this direction is not bounded.
+     *
+     * This function sets value using the most restrictive of the new or existing set of
+     * values.
+     *
+     * @param maxSize maximum image size
+     * @return the current object, for convenience
+     * @see #setMaxSize(Dimension)
+     */
+    public ImageProvider resetMaxSize(Dimension maxSize) {
+        if (this.maxWidth == -1 || maxSize.width < this.maxWidth) {
+            this.maxWidth = maxSize.width;
+        }
+        if (this.maxHeight == -1 || maxSize.height < this.maxHeight) {
+            this.maxHeight = maxSize.height;
+        }
         return this;
     }
