xmlgraphics-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sstei...@apache.org
Subject svn commit: r1598620 - /xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/PreloaderJPEG.java
Date Fri, 30 May 2014 14:52:57 GMT
Author: ssteiner
Date: Fri May 30 14:52:56 2014
New Revision: 1598620

URL: http://svn.apache.org/r1598620
Log:
XGC-91 JPEG is squashed

Modified:
    xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/PreloaderJPEG.java

Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/PreloaderJPEG.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/PreloaderJPEG.java?rev=1598620&r1=1598619&r2=1598620&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/PreloaderJPEG.java
(original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/impl/PreloaderJPEG.java
Fri May 30 14:52:56 2014
@@ -89,17 +89,19 @@ public class PreloaderJPEG extends Abstr
                     int densityUnits = in.read();
                     int xdensity = in.readUnsignedShort();
                     int ydensity = in.readUnsignedShort();
-                    if (densityUnits == 2) {
-                        //dots per centimeter
-                        size.setResolution(
-                                xdensity * UnitConv.IN2CM,
-                                ydensity * UnitConv.IN2CM);
-                    } else if (densityUnits == 1) {
-                        //dots per inch
-                        size.setResolution(xdensity, ydensity);
-                    } else {
-                        //resolution not specified
-                        size.setResolution(context.getSourceResolution());
+                    if (size.getDpiHorizontal() == 0) {
+                        if (densityUnits == 2) {
+                            //dots per centimeter
+                            size.setResolution(
+                                    xdensity * UnitConv.IN2CM,
+                                    ydensity * UnitConv.IN2CM);
+                        } else if (densityUnits == 1) {
+                            //dots per inch
+                            size.setResolution(xdensity, ydensity);
+                        } else {
+                            //resolution not specified
+                            size.setResolution(context.getSourceResolution());
+                        }
                     }
                     if (size.getWidthPx() != 0) {
                         size.calcSizeFromPixels();



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org


Mime
View raw message