Changeset 13723 in josm
 Timestamp:
 20180510T22:25:39+02:00 (3 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r13653 r13723 167 167 * @since 10358 168 168 */ 169 SPLASH_LOGO(128, 12 9),169 SPLASH_LOGO(128, 128), 170 170 /** 171 171 * About dialog logo size 172 172 * @since 10358 173 173 */ 174 ABOUT_LOGO(256, 25 8),174 ABOUT_LOGO(256, 256), 175 175 /** 176 176 * Status line logo size … … 1566 1566 Logging.trace("createImageFromSvg: {0} {1}", svg.getXMLBase(), dim); 1567 1567 } 1568 float sourceWidth = svg.getWidth(); 1569 float sourceHeight = svg.getHeight(); 1570 int realWidth = Math.round(GuiSizesHelper.getSizeDpiAdjusted(sourceWidth)); 1571 int realHeight = Math.round(GuiSizesHelper.getSizeDpiAdjusted(sourceHeight)); 1572 Double scaleX, scaleY; 1573 if (dim.width != 1) { 1568 final float sourceWidth = svg.getWidth(); 1569 final float sourceHeight = svg.getHeight(); 1570 final int realWidth; 1571 final int realHeight; 1572 if (dim.width >= 0) { 1574 1573 realWidth = dim.width; 1575 scaleX = (double) realWidth / sourceWidth; 1576 if (dim.height == 1) { 1577 scaleY = scaleX; 1578 realHeight = (int) Math.round(sourceHeight * scaleY); 1574 if (dim.height >= 0) { 1575 realHeight = dim.height; 1579 1576 } else { 1580 realHeight = dim.height; 1581 scaleY = (double) realHeight / sourceHeight; 1582 } 1583 } else if (dim.height != 1) { 1577 realHeight = Math.round(sourceHeight * realWidth / sourceWidth); 1578 } 1579 } else if (dim.height >= 0) { 1584 1580 realHeight = dim.height; 1585 scaleX = scaleY = (double) realHeight / sourceHeight; 1586 realWidth = (int) Math.round(sourceWidth * scaleX); 1581 realWidth = Math.round(sourceWidth * realHeight / sourceHeight); 1587 1582 } else { 1588 scaleX = scaleY = (double) realHeight / sourceHeight; 1589 } 1583 realWidth = Math.round(GuiSizesHelper.getSizeDpiAdjusted(sourceWidth)); 1584 realHeight = Math.round(GuiSizesHelper.getSizeDpiAdjusted(sourceHeight)); 1585 } 1586 final Double scaleX = (double) realWidth / sourceWidth; 1587 final Double scaleY = (double) realHeight / sourceHeight; 1590 1588 1591 1589 if (realWidth == 0  realHeight == 0) {
Note: See TracChangeset
for help on using the changeset viewer.