TMI-121: Clean up.

This commit is contained in:
Harald Kuhr 2015-03-22 14:25:29 +01:00
parent 449db69d27
commit 3ce0a8594f

View File

@ -117,13 +117,12 @@ final class JPEGSegmentImageInputStream extends ImageInputStreamImpl {
marker = 0xff00 | stream.readUnsignedByte(); marker = 0xff00 | stream.readUnsignedByte();
} }
// TODO: Should we just skip all app marker segments? // We are now handling all important segments ourselves, except APP1/Exif and APP14/Adobe, as these
// We are now handling all important segments ourselves boolean appSegmentMarker = isAppSegmentMarker(marker);
// TODO: Need to re-insert the APP14, and instead make sure we limit it to 16 bytes, boolean isApp14Adobe = marker == JPEG.APP14 && isAppSegmentWithId("Adobe", stream);
// OR use two delegates, one for reading image data, and one for reading metadata... boolean isApp1Exif = marker == JPEG.APP1 && isAppSegmentWithId("Exif", stream);
boolean isApp14Adobe = false;
if (isAppSegmentMarker(marker) && !(marker == JPEG.APP1 && isAppSegmentWithId("Exif", stream) if (appSegmentMarker && !(isApp1Exif || isApp14Adobe)) {
|| (isApp14Adobe = (marker == JPEG.APP14 && isAppSegmentWithId("Adobe", stream))))) {
int length = stream.readUnsignedShort(); // Length including length field itself int length = stream.readUnsignedShort(); // Length including length field itself
stream.seek(realPosition + 2 + length); // Skip marker (2) + length stream.seek(realPosition + 2 + length); // Skip marker (2) + length
} }