mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-03 11:35:29 -04:00
Indicate support for lossless to ImageIO
This commit is contained in:
parent
7c4487be04
commit
cda34b704b
@ -75,10 +75,8 @@ public final class WebPImageReaderSpi extends ImageReaderSpiBase {
|
||||
int chunk = stream.readInt();
|
||||
|
||||
switch (chunk) {
|
||||
// TODO. Support lossless
|
||||
// case WebP.CHUNK_VP8L:
|
||||
case WebP.CHUNK_VP8L:
|
||||
case WebP.CHUNK_VP8X:
|
||||
return containsSupportedChunk(stream, chunk);
|
||||
case WebP.CHUNK_VP8_:
|
||||
return true;
|
||||
default:
|
||||
@ -91,30 +89,6 @@ public final class WebPImageReaderSpi extends ImageReaderSpiBase {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean containsSupportedChunk(ImageInputStream stream, int chunk) throws IOException {
|
||||
// Temporary: Seek for VP8_, either first or second (after ICCP), or inside ANMF...
|
||||
try {
|
||||
while (chunk != WebP.CHUNK_VP8L && chunk != WebP.CHUNK_ALPH) {
|
||||
long length = stream.readUnsignedInt();
|
||||
stream.seek(stream.getStreamPosition() + length);
|
||||
chunk = stream.readInt();
|
||||
|
||||
// Look inside ANMF chunks...
|
||||
if (chunk == WebP.CHUNK_ANMF) {
|
||||
stream.seek(stream.getStreamPosition() + 4 + 16);
|
||||
chunk = stream.readInt();
|
||||
}
|
||||
|
||||
if (chunk == WebP.CHUNK_VP8_) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (EOFException ignore) {}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImageReader createReaderInstance(final Object extension) {
|
||||
return new WebPImageReader(this);
|
||||
|
Loading…
x
Reference in New Issue
Block a user