Index: trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java	(revision 1272)
+++ trunk/src/org/openstreetmap/josm/data/osm/visitor/MapPaintVisitor.java	(revision 1273)
@@ -29,4 +29,5 @@
 import org.openstreetmap.josm.data.osm.visitor.SimplePaintVisitor;
 import org.openstreetmap.josm.data.coor.LatLon;
+import org.openstreetmap.josm.data.coor.EastNorth;
 import org.openstreetmap.josm.gui.mappaint.AreaElemStyle;
 import org.openstreetmap.josm.gui.mappaint.ElemStyle;
@@ -59,4 +60,6 @@
     private static int paintid = 0;
     private static int viewid = 0;
+    private EastNorth minEN;
+    private EastNorth maxEN;
 
     protected int profilerVisibleNodes;
@@ -114,6 +117,8 @@
     public void visit(Node n) {
         // check, if the node is visible at all
-        Point p = nc.getPoint(n.eastNorth);
-        if ((p.x < 0) || (p.y < 0) || (p.x > nc.getWidth()) || (p.y > nc.getHeight()))
+        if((n.eastNorth.east()  > maxEN.east() ) ||
+           (n.eastNorth.north() > maxEN.north()) ||
+           (n.eastNorth.east()  < minEN.east() ) ||
+           (n.eastNorth.north() < minEN.north()))
         {
             n.mappaintVisibleCode = viewid;
@@ -149,6 +154,21 @@
 
         // check, if the way is visible at all
-        Polygon polygon = getPolygon(w);
-        if(!isPolygonVisible(polygon))
+        double minx = 10000;
+        double maxx = -10000;
+        double miny = 10000;
+        double maxy = -10000;
+
+        for (Node n : w.nodes)
+        {
+            if(n.eastNorth.east() > maxx) maxx = n.eastNorth.east();
+            if(n.eastNorth.north() > maxy) maxy = n.eastNorth.north();
+            if(n.eastNorth.east() < minx) minx = n.eastNorth.east();
+            if(n.eastNorth.north() < miny) miny = n.eastNorth.north();
+        }
+        
+        if ((minx > maxEN.east()) ||
+            (miny > maxEN.north()) ||
+            (maxx < minEN.east()) ||
+            (maxy < minEN.north()))
         {
             w.mappaintVisibleCode = viewid;
@@ -190,5 +210,5 @@
                 {
                     profilerVisibleAreas++;
-                    drawArea(polygon, w.selected ? selectedColor : ((AreaElemStyle)wayStyle).color);
+                    drawArea(w, w.selected ? selectedColor : ((AreaElemStyle)wayStyle).color);
                     if(!w.isClosed())
                         w.putError(tr("Area style way is not closed."), true);
@@ -409,5 +429,5 @@
                 drawWay((Way)osm, ((AreaElemStyle)style).line, selectedColor, true);
                 if(area)
-                    drawArea(getPolygon((Way)osm), areaselected ? selectedColor
+                    drawArea((Way)osm, areaselected ? selectedColor
                     : ((AreaElemStyle)style).color);
             }
@@ -650,5 +670,5 @@
                     if(isPolygonVisible(pd.get()))
                     {
-                        drawArea(pd.get(), (pd.way.selected || r.selected) ? selectedColor
+                        drawArea(pd.way, (pd.way.selected || r.selected) ? selectedColor
                         : ((AreaElemStyle)wayStyle).color);
                         visible = true;
@@ -741,6 +761,8 @@
     }
 
-    protected void drawArea(Polygon polygon, Color color)
+    protected void drawArea(Way w, Color color)
     {
+        Polygon polygon = getPolygon(w);
+        
         // set the opacity (alpha) level of the filled polygon
         g.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), fillAlpha));
@@ -872,10 +894,10 @@
     }
 
-    /*public void getColors()
+    public void getColors()
     {
         super.getColors();
         untaggedColor = Main.pref.getColor(marktr("untagged"),Color.GRAY);
         textColor = Main.pref.getColor (marktr("text"), Color.WHITE);
-    }*/
+    }
 
     // Shows areas before non-areas
@@ -910,4 +932,7 @@
         String currentLocale = Locale.getDefault().getLanguage();
         regionalNameOrder = Main.pref.get("mappaint.nameOrder", "name:"+currentLocale+";name;int_name;ref;operator;brand").split(";");
+        minEN = nc.getEastNorth(0,nc.getHeight()-1);
+        maxEN = nc.getEastNorth(nc.getWidth()-1,0);
+        
 
         selectedCall = false;
