private void paintInternal(Graphics2D g) {

        if (smoothPosition != null) {
            {
                Point position = getMapPosition();
                Painter painter = new Painter(this, getZoom());
                painter.paint(g, position, null);
            }
            Point position = new Point(smoothPosition.x, smoothPosition.y);
            Painter painter = new Painter(this, getZoom() + smoothOffset);
            painter.setScale(smoothScale);
            
            float t = (float) (animation == null ? 1f : 1 - animation.getFactor());
            painter.setTransparency(t);
            painter.paint(g, position, smoothPivot);
            if (animation != null && animation.getType() == AnimationType.ZOOM_IN) {
                int cx = smoothPivot.x, cy = smoothPivot.y;
                drawScaledRect(g, cx, cy, animation.getFactor(), 1 + animation.getFactor());
            } else if (animation != null && animation.getType() == AnimationType.ZOOM_OUT) {
                int cx = smoothPivot.x, cy = smoothPivot.y;
                drawScaledRect(g, cx, cy, animation.getFactor(), 2 - animation.getFactor());
            }
        }

        if (smoothPosition == null) {
            Point position = getMapPosition();
            Painter painter = new Painter(this, getZoom());
            painter.paint(g, position, null);
        }
        
        /** DO NOT REMOVE THIS CASE
         *	Since width/height of the panel initially is 0 before its painted,
         *	it appears to have the size "0". What was thought to be the center, 
         *	actually becomes the top left corner of the map. This case fixes that problem.
         * 	Though one should care for the possibility of an eternity loop as the maps
         * 	width and height are REALLY 0. This is also handled by checking if size is legit.
         **/
        if (centerPosition.equals(mapPosition) && legitMapSize()) {
        	setCenterPosition(centerPosition); 
        	paintInternal(g); /* calls itself, DANGEROUS. Could end up in eternal loop if setCenterPosition is buggy. */
        }
    }