Skip to content

Commit

Permalink
Removed Math.ceil calls to avoid rounding errors.
Browse files Browse the repository at this point in the history
Let the browser implicitly cast calculated image dimensions from
floating point values to integer values.
  • Loading branch information
blueimp committed Jul 27, 2014
1 parent 000deb7 commit 9ec892b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions js/load-image.js
@@ -1,5 +1,5 @@
/*
* JavaScript Load Image 1.9.0
* JavaScript Load Image 1.9.1
* https://github.com/blueimp/JavaScript-Load-Image
*
* Copyright 2011, Sebastian Tschan
Expand Down Expand Up @@ -148,8 +148,8 @@
(minHeight || destHeight) / destHeight
);
if (scale > 1) {
destWidth = Math.ceil(destWidth * scale);
destHeight = Math.ceil(destHeight * scale);
destWidth = destWidth * scale;
destHeight = destHeight * scale;
}
},
scaleDown = function () {
Expand All @@ -158,8 +158,8 @@
(maxHeight || destHeight) / destHeight
);
if (scale < 1) {
destWidth = Math.ceil(destWidth * scale);
destHeight = Math.ceil(destHeight * scale);
destWidth = destWidth * scale;
destHeight = destHeight * scale;
}
};
if (useCanvas) {
Expand Down

0 comments on commit 9ec892b

Please sign in to comment.