Changeset 10303 in josm


Ignore:
Timestamp:
2016-05-30T23:37:51+02:00 (8 years ago)
Author:
Don-vip
Message:

sonar - squid:S2164 - Math should not be performed on floats

Location:
trunk/src/org/openstreetmap/josm
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java

    r10228 r10303  
    14831483                if (absoluteFix) {
    14841484                    b.moveTo(p2.x, p2.y);
    1485                     b.lineTo(2f*p1.x-p2.x, 2f*p1.y-p2.y); // bi-directional line
     1485                    b.lineTo(2d*p1.x-p2.x, 2d*p1.y-p2.y); // bi-directional line
    14861486                } else {
    14871487                    b.moveTo(p2.x, p2.y);
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/AbstractMapRenderer.java

    r10181 r10303  
    221221                    int x = (p.x+lastP.x)/2;
    222222                    int y = (p.y+lastP.y)/2;
    223                     path.moveTo((float) x-virtualNodeSize, y);
    224                     path.lineTo((float) x+virtualNodeSize, y);
    225                     path.moveTo(x, (float) y-virtualNodeSize);
    226                     path.lineTo(x, (float) y+virtualNodeSize);
     223                    path.moveTo((double) x-virtualNodeSize, y);
     224                    path.lineTo((double) x+virtualNodeSize, y);
     225                    path.moveTo(x, (double) y-virtualNodeSize);
     226                    path.lineTo(x, (double) y+virtualNodeSize);
    227227                }
    228228                lastP = p;
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java

    r10254 r10303  
    15031503                            while (dist < segmentLength) {
    15041504                                for (int i = 0; i < 2; ++i) {
    1505                                     float onewaySize = i == 0 ? 3f : 2f;
     1505                                    double onewaySize = i == 0 ? 3d : 2d;
    15061506                                    GeneralPath onewayPath = i == 0 ? onewayArrowsCasing : onewayArrows;
    15071507
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/WireframeMapRenderer.java

    r10181 r10303  
    432432                final double sy = l * (p1.y - p2.y);
    433433
    434                 path.lineTo(p2.x + (float) Math.round(cosPHI * sx - sinPHI * sy), p2.y + (float) Math.round(sinPHI * sx + cosPHI * sy));
    435                 path.moveTo(p2.x + (float) Math.round(cosPHI * sx + sinPHI * sy), p2.y + (float) Math.round(-sinPHI * sx + cosPHI * sy));
     434                path.lineTo(p2.x + (double) Math.round(cosPHI * sx - sinPHI * sy), p2.y + (double) Math.round(sinPHI * sx + cosPHI * sy));
     435                path.moveTo(p2.x + (double) Math.round(cosPHI * sx + sinPHI * sy), p2.y + (double) Math.round(-sinPHI * sx + cosPHI * sy));
    436436                path.lineTo(p2.x, p2.y);
    437437            }
  • trunk/src/org/openstreetmap/josm/gui/layer/ImageryLayer.java

    r10300 r10303  
    520520                int g = srcPixels[i + greenOffset] & 0xff;
    521521                int b = srcPixels[i + blueOffset] & 0xff;
    522                 float luminosity = r * .21f + g * .72f + b * .07f;
     522                double luminosity = r * .21d + g * .72d + b * .07d;
    523523                destPixels[i + redOffset] = mix(r, luminosity);
    524524                destPixels[i + greenOffset] = mix(g, luminosity);
     
    530530        }
    531531
    532         private byte mix(int color, float luminosity) {
     532        private byte mix(int color, double luminosity) {
    533533            int val = (int) (colorfulness * color +  (1 - colorfulness) * luminosity);
    534534            if (val < 0) {
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java

    r10217 r10303  
    484484                        new Color(trkPnt.customColoring.getRGB() & 0x00ffffff | hdopAlpha << 24, true);
    485485                    g.setColor(customColoringTransparent);
    486                     // hdop cirles
     486                    // hdop circles
    487487                    int hdopp = mv.getPoint(new LatLon(
    488488                            trkPnt.getCoor().lat(),
    489                             trkPnt.getCoor().lon() + 2*6*hdop*360/40000000d)).x - screen.x;
     489                            trkPnt.getCoor().lon() + 2d*6*hdop*360/40000000d)).x - screen.x;
    490490                    g.drawArc(screen.x-hdopp/2, screen.y-hdopp/2, hdopp, hdopp, 0, 360);
    491491                }
Note: See TracChangeset for help on using the changeset viewer.