You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by je...@apache.org on 2008/09/19 09:52:04 UTC
svn commit: r696968 -
/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/ImageSize.java
Author: jeremias
Date: Fri Sep 19 00:52:04 2008
New Revision: 696968
URL: http://svn.apache.org/viewvc?rev=696968&view=rev
Log:
Actually, there were two typos. Copy/paste, argh!
Modified:
xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/ImageSize.java
Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/ImageSize.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/ImageSize.java?rev=696968&r1=696967&r2=696968&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/ImageSize.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/image/loader/ImageSize.java Fri Sep 19 00:52:04 2008
@@ -202,13 +202,17 @@
return new Dimension(getWidthPx(), getHeightPx());
}
+ private void checkResolutionAvailable() {
+ if (this.dpiHorizontal == 0 || this.dpiVertical == 0) {
+ throw new IllegalStateException("The resolution must be set");
+ }
+ }
+
/**
* Calculates the size in millipoints based on the size in pixels and the resolution.
*/
public void calcSizeFromPixels() {
- if (this.dpiHorizontal == 0 || this.dpiVertical == 0) {
- throw new IllegalStateException("The resolution must be set");
- }
+ checkResolutionAvailable();
this.widthMpt = (int)Math.round(UnitConv.in2mpt(this.widthPx / this.dpiHorizontal));
this.heightMpt = (int)Math.round(UnitConv.in2mpt(this.heightPx / this.dpiVertical));
}
@@ -217,9 +221,7 @@
* Calculates the size in pixels based on the size in millipoints and the resolution.
*/
public void calcPixelsFromSize() {
- if (this.dpiHorizontal == 0 || this.dpiVertical == 0) {
- throw new IllegalStateException("The resolution mus be set");
- }
+ checkResolutionAvailable();
this.widthPx = (int)Math.round(UnitConv.mpt2in(this.widthMpt * this.dpiHorizontal));
this.heightPx = (int)Math.round(UnitConv.mpt2in(this.heightMpt * this.dpiVertical));
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org