Changeset 13400 in josm for trunk/src


Ignore:
Timestamp:
2018-02-10T01:40:02+01:00 (6 years ago)
Author:
Don-vip
Message:

sonar - fb-contrib:PDP_POORLY_DEFINED_PARAMETER - Method defines parameters more abstractly than needed to function properly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MapView.java

    r13173 r13400  
    490490
    491491        try {
    492             drawMapContent(g);
     492            drawMapContent((Graphics2D) g);
    493493        } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) {
    494494            throw BugReport.intercept(e).put("visibleLayers", layerManager::getVisibleLayersInZOrder)
     
    498498    }
    499499
    500     private void drawMapContent(Graphics g) {
     500    private void drawMapContent(Graphics2D g) {
    501501        // In HiDPI-mode, the Graphics g will have a transform that scales
    502502        // everything by a factor of 2.0 or so. At the same time, the value returned
     
    509509        // (Otherwise, we would upscale a small buffer image and the result would be
    510510        // blurry, with 2x2 pixel blocks.)
    511         Graphics2D gg = (Graphics2D) g;
    512         AffineTransform trOrig = gg.getTransform();
    513         double uiScaleX = gg.getTransform().getScaleX();
    514         double uiScaleY = gg.getTransform().getScaleY();
     511        AffineTransform trOrig = g.getTransform();
     512        double uiScaleX = g.getTransform().getScaleX();
     513        double uiScaleY = g.getTransform().getScaleY();
    515514        // width/height in full-resolution screen pixels
    516515        int width = (int) Math.round(getWidth() * uiScaleX);
     
    615614
    616615        try {
    617             gg.setTransform(new AffineTransform(1, 0, 0, 1, trOrig.getTranslateX(), trOrig.getTranslateY()));
    618             gg.drawImage(offscreenBuffer, 0, 0, null);
     616            g.setTransform(new AffineTransform(1, 0, 0, 1, trOrig.getTranslateX(), trOrig.getTranslateY()));
     617            g.drawImage(offscreenBuffer, 0, 0, null);
    619618        } catch (ClassCastException e) {
    620619            // See #11002 and duplicate tickets. On Linux with Java >= 8 Many users face this error here:
     
    643642            Logging.error(e);
    644643        } finally {
    645             gg.setTransform(trOrig);
     644            g.setTransform(trOrig);
    646645        }
    647646    }
Note: See TracChangeset for help on using the changeset viewer.