Ticket #2752: wmsmem.diff

File wmsmem.diff, 1.1 KB (added by Upliner, 17 years ago)

Patch to lower WMSPlugin memory usage

  • src/wmsplugin/GeorefImage.java

     
    8787        }
    8888
    8989        boolean alphaChannel = Main.pref.getBoolean("wmsplugin.alpha_channel");
     90        int maxres = Main.pref.getInteger("wmsplugin.reimg_res",1000);
    9091        // We don't need this, as simply saving the image to RGB instead of ARGB removes alpha
    9192        // But we do get a black instead of white background.
    9293        //Image ppImg = image;
     
    106107            // Storing images this large in memory will certainly hang up JOSM. Luckily
    107108            // traditional rendering is as fast at these zoom levels, so it's no loss.
    108109            // Also prevent caching if we're out of memory soon
    109             if(width > 10000 || height > 10000 || width*height*3 > freeMem) {
     110            if(width > maxres || height > maxres || width*height*3 > freeMem) {
    110111                fallbackDraw(g, image, minPt, maxPt);
    111112            } else {
    112113                // We haven't got a saved resized copy, so resize and cache it