Index: trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java	(revision 1235)
+++ trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java	(revision 1236)
@@ -79,5 +79,5 @@
         Point p = nc.getPoint(n.eastNorth);
         if ((p.x < 0) || (p.y < 0) || (p.x > nc.getWidth()) || (p.y > nc.getHeight())) return;
-        
+
         IconElemStyle nodeStyle = (IconElemStyle)styles.get(n);
         if (nodeStyle != null && isZoomOk(nodeStyle))
@@ -100,13 +100,8 @@
 
         // check, if the way is visible at all
-        Polygon polygon = new Polygon();
-        for (Node n : w.nodes)
-        {
-            Point p = nc.getPoint(n.eastNorth);
-            polygon.addPoint(p.x,p.y);
-        }
+        Polygon polygon = getPolygon(w);
         if(!isPolygonVisible(polygon))
             return;
-        
+
         ElemStyle wayStyle = styles.get(w);
 
@@ -125,5 +120,5 @@
                 l = ((AreaElemStyle)wayStyle).line;
                 if (fillAreas)
-                    drawWayAsArea(w, areacolor);
+                    drawArea(polygon, w.selected ? selectedColor : areacolor);
             }
         }
@@ -342,5 +337,5 @@
                 drawWay((Way)osm, ((AreaElemStyle)style).line, selectedColor, true);
                 if(area)
-                    drawWayAsArea((Way)osm, areaselected ? selectedColor
+                    drawArea(getPolygon((Way)osm), areaselected ? selectedColor
                     : ((AreaElemStyle)style).color);
             }
@@ -580,10 +575,6 @@
                 for (PolyData pd : poly)
                 {
-                    Color color = (pd.way.selected || r.selected) ? selectedColor
-                    : ((AreaElemStyle)wayStyle).color;
-                    g.setColor(new Color( color.getRed(), color.getGreen(),
-                    color.getBlue(), fillAlpha));
-
-                    g.fillPolygon(pd.get());
+                    drawArea(pd.get(), (pd.way.selected || r.selected) ? selectedColor
+                    : ((AreaElemStyle)wayStyle).color);
                 }
             }
@@ -653,5 +644,5 @@
     }
 
-    protected void drawWayAsArea(Way w, Color color)
+    protected Polygon getPolygon(Way w)
     {
         Polygon polygon = new Polygon();
@@ -662,9 +653,11 @@
             polygon.addPoint(p.x,p.y);
         }
-
-        Color mycolor = w.selected ? selectedColor : color;
+        return polygon;
+    }
+
+    protected void drawArea(Polygon polygon, Color color)
+    {
         // set the opacity (alpha) level of the filled polygon
-        g.setColor(new Color( mycolor.getRed(), mycolor.getGreen(), mycolor.getBlue(), fillAlpha));
-
+        g.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), fillAlpha));
         g.fillPolygon(polygon);
     }
@@ -814,9 +807,9 @@
         alreadyDrawnAreas = new LinkedList<Way>();
         selectedCall = false;
-        
+
         // update the style name, just in case the user changed it in the meantime
         styles.updateStyleName();
-        
-        if(profiler) 
+
+        if(profiler)
         {
             System.out.format("Prepare  : %4dms\n", (java.lang.System.currentTimeMillis()-profilerLast));
@@ -838,5 +831,5 @@
             }
 
-            if(profiler) 
+            if(profiler)
             {
                 System.out.format("Relations: %4dms, n=%d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN);
Index: trunk/src/org/openstreetmap/josm/data/osm/visitor/SimplePaintVisitor.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/visitor/SimplePaintVisitor.java	(revision 1235)
+++ trunk/src/org/openstreetmap/josm/data/osm/visitor/SimplePaintVisitor.java	(revision 1236)
@@ -360,12 +360,12 @@
     protected boolean isPolygonVisible(Polygon polygon) {
         Rectangle bounds = polygon.getBounds();
-		if (bounds.x > nc.getWidth()) return false;
-		else if (bounds.y > nc.getHeight()) return false;
-		else if (bounds.x + polygon.getBounds().width < 0) return false;
-		else if (bounds.y + polygon.getBounds().height < 0) return false;
-        
+        if (bounds.x > nc.getWidth()) return false;
+        else if (bounds.y > nc.getHeight()) return false;
+        else if (bounds.x + bounds.width < 0) return false;
+        else if (bounds.y + bounds.height < 0) return false;
+
         return true;
     }
-        
+
     public void setGraphics(Graphics g) {
         this.g = g;
