Order the bytes in a multi-byte XBM image correctly. Patch by: me
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/imaging/trunk@1780710 13f79535-47bb-0310-9956-ffa450edef68 Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/7aa76295 Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/7aa76295 Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/7aa76295 Branch: refs/heads/master Commit: 7aa76295c10a7b7da3b142f7c52b9dd3e2339e8c Parents: b33463d Author: Damjan Jovanovic <[email protected]> Authored: Sat Jan 28 15:49:02 2017 +0000 Committer: Damjan Jovanovic <[email protected]> Committed: Sat Jan 28 15:49:02 2017 +0000 ---------------------------------------------------------------------- .../org/apache/commons/imaging/formats/xbm/XbmImageParser.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/7aa76295/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java b/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java index c9c9b1c..757a314 100644 --- a/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/xbm/XbmImageParser.java @@ -259,10 +259,8 @@ public class XbmImageParser extends ImageParser { final int value = Integer.parseInt(token.substring(2), 16); final int flipped = Integer.reverse(value) >>> (32 - inputWidth); if (inputWidth == 16) { + imageData[i++] = (byte) (flipped >>> 8); if ((x + 8) < xbmHeader.width) { - imageData[i++] = (byte) (flipped >>> 8); - imageData[i++] = (byte) flipped; - } else { imageData[i++] = (byte) flipped; } } else {
