Repository: commons-imaging Updated Branches: refs/heads/master c8731920f -> 071e63ed7
IMAGING-124: Tidy up IconParser Project: http://git-wip-us.apache.org/repos/asf/commons-imaging/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-imaging/commit/071e63ed Tree: http://git-wip-us.apache.org/repos/asf/commons-imaging/tree/071e63ed Diff: http://git-wip-us.apache.org/repos/asf/commons-imaging/diff/071e63ed Branch: refs/heads/master Commit: 071e63ed72e29d2394fa7db74af9a69ecd0614f0 Parents: c873192 Author: Bruno P. Kinoshita <ki...@users.noreply.github.com> Authored: Sat Aug 11 00:11:02 2018 +1200 Committer: Bruno P. Kinoshita <ki...@users.noreply.github.com> Committed: Sat Aug 11 00:11:02 2018 +1200 ---------------------------------------------------------------------- src/changes/changes.xml | 3 +++ .../imaging/formats/ico/IcoImageParser.java | 18 ++++-------------- 2 files changed, 7 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/071e63ed/src/changes/changes.xml ---------------------------------------------------------------------- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index d06dbbd..1b4b2fa 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -46,6 +46,9 @@ The <action> type attribute can be add,update,fix,remove. <body> <release version="1.0" date="TBA" description="First major release"> + <action issue="IMAGING-124" dev="kinow" type="update" due-to="Jens Kapitza"> + Tidy up IconParser + </action> <action issue="IMAGING-215" dev="kinow" type="fix"> ArrayIndexOutOfBoundsException in DhtSegment </action> http://git-wip-us.apache.org/repos/asf/commons-imaging/blob/071e63ed/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java b/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java index 238f6d3..5764de3 100644 --- a/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java +++ b/src/main/java/org/apache/commons/imaging/formats/ico/IcoImageParser.java @@ -716,15 +716,10 @@ public class IcoImageParser extends ImageParser { for (int i = 0; i < (1 << bitCount); i++) { if (i < palette.length()) { final int argb = palette.getEntry(i); - bos.write(0xff & argb); - bos.write(0xff & (argb >> 8)); - bos.write(0xff & (argb >> 16)); + bos.write3Bytes(argb); bos.write(0); } else { - bos.write(0); - bos.write(0); - bos.write(0); - bos.write(0); + bos.write4Bytes(0); } } } @@ -751,14 +746,9 @@ public class IcoImageParser extends ImageParser { final int index = palette.getPaletteIndex(rgb); bos.write(0xff & index); } else if (bitCount == 24) { - bos.write(0xff & argb); - bos.write(0xff & (argb >> 8)); - bos.write(0xff & (argb >> 16)); + bos.write3Bytes(argb); } else if (bitCount == 32) { - bos.write(0xff & argb); - bos.write(0xff & (argb >> 8)); - bos.write(0xff & (argb >> 16)); - bos.write(0xff & (argb >> 24)); + bos.write4Bytes(argb); } }