Changeset 17828 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2021-04-26T20:42:29+02:00 (4 years ago)
Author:
simon04
Message:

see #20659 - Image viewer: apply filters when loading, not when rendering

This fixes:

  • ineffective colorfulness filter
  • performance when panning/zooming
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageDisplay.java

    r17793 r17828  
    6060    /** The image currently displayed */
    6161    private transient BufferedImage image;
     62
     63    /** The image currently displayed after applying {@link #imageProcessor} */
     64    private transient BufferedImage processedImage;
    6265
    6366    /**
     
    380383
    381384                        ImageDisplay.this.image = img;
     385                        updateProcessedImage();
    382386                        // This will clear the loading info box
    383387                        ImageDisplay.this.oldEntry = ImageDisplay.this.entry;
     
    745749            if (entry == null) {
    746750                image = null;
     751                updateProcessedImage();
    747752                this.oldEntry = null;
    748753            }
     
    778783    @Override
    779784    public void filterChanged() {
     785        updateProcessedImage();
    780786        repaint();
     787    }
     788
     789    private void updateProcessedImage() {
     790        processedImage = image == null ? null : imageProcessor.process(image);
    781791    }
    782792
     
    790800
    791801        synchronized (this) {
    792             image = this.image;
     802            image = this.processedImage;
    793803            entry = this.entry;
    794804            oldEntry = this.oldEntry;
     
    840850            }
    841851
    842             if (image != null) {
    843                 image = imageProcessor.process(image);
    844             }
    845 
    846852            g.drawImage(image,
    847853                    target.x, target.y, target.x + target.width, target.y + target.height,
Note: See TracChangeset for help on using the changeset viewer.