From 091da2ee9b35a0a0d95b14c9b3e77ff3ecbe797a Mon Sep 17 00:00:00 2001 From: jfrijters Date: Tue, 13 Aug 2013 11:25:21 +0000 Subject: Unforked com/sun/imageio/plugins/jpeg/JPEGImageReaderSpi.java and com/sun/imageio/plugins/jpeg/JPEGImageWriterSpi.java. --- openjdk/allsources.lst | 4 +- .../imageio/plugins/jpeg/JPEGImageReaderSpi.java | 112 ------------------- .../imageio/plugins/jpeg/JPEGImageWriterSpi.java | 119 --------------------- 3 files changed, 2 insertions(+), 233 deletions(-) delete mode 100644 openjdk/com/sun/imageio/plugins/jpeg/JPEGImageReaderSpi.java delete mode 100644 openjdk/com/sun/imageio/plugins/jpeg/JPEGImageWriterSpi.java (limited to 'openjdk') diff --git a/openjdk/allsources.lst b/openjdk/allsources.lst index 46f01df7..7401541e 100644 --- a/openjdk/allsources.lst +++ b/openjdk/allsources.lst @@ -31,9 +31,7 @@ ../classpath/sun/misc/Ref.java AssemblyInfo.java com/sun/imageio/plugins/jpeg/JPEGImageReader.java -com/sun/imageio/plugins/jpeg/JPEGImageReaderSpi.java com/sun/imageio/plugins/jpeg/JPEGImageWriter.java -com/sun/imageio/plugins/jpeg/JPEGImageWriterSpi.java com/sun/management/OperatingSystem.java gnu/java/awt/Buffers.java gnu/java/awt/color/CieXyzConverter.java @@ -7462,6 +7460,8 @@ sun/security/jgss/wrapper/SunNativeProvider.java @OPENJDK7@/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFWritableImageMetadata.java @OPENJDK7@/jdk/src/share/classes/com/sun/imageio/plugins/gif/GIFWritableStreamMetadata.java @OPENJDK7@/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEG.java +@OPENJDK7@/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReaderSpi.java +@OPENJDK7@/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriterSpi.java @OPENJDK7@/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java @OPENJDK7@/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageReaderSpi.java @OPENJDK7@/jdk/src/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java diff --git a/openjdk/com/sun/imageio/plugins/jpeg/JPEGImageReaderSpi.java b/openjdk/com/sun/imageio/plugins/jpeg/JPEGImageReaderSpi.java deleted file mode 100644 index 3b6c2e74..00000000 --- a/openjdk/com/sun/imageio/plugins/jpeg/JPEGImageReaderSpi.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.imageio.plugins.jpeg; - -import java.util.Locale; -import javax.imageio.spi.ImageReaderSpi; -import javax.imageio.stream.ImageInputStream; -import javax.imageio.spi.IIORegistry; -import javax.imageio.spi.ServiceRegistry; -import java.io.IOException; -import javax.imageio.ImageReader; -import javax.imageio.IIOException; - -public class JPEGImageReaderSpi extends ImageReaderSpi { - - private static String [] writerSpiNames = - {"com.sun.imageio.plugins.jpeg.JPEGImageWriterSpi"}; - - private boolean registered = false; - - public JPEGImageReaderSpi() { - super(JPEG.vendor, - JPEG.version, - JPEG.names, - JPEG.suffixes, - JPEG.MIMETypes, - "com.sun.imageio.plugins.jpeg.JPEGImageReader", - new Class[] { ImageInputStream.class }, - writerSpiNames, - true, - JPEG.nativeStreamMetadataFormatName, - JPEG.nativeStreamMetadataFormatClassName, - null, null, - true, - JPEG.nativeImageMetadataFormatName, - JPEG.nativeImageMetadataFormatClassName, - null, null - ); - } - - public void onRegistration(ServiceRegistry registry, - Class category) { - if (registered) { - return; - } - /* - try { - java.security.AccessController.doPrivileged( - new sun.security.action.LoadLibraryAction("jpeg")); - // Stuff it all into one lib for first pass - //java.security.AccessController.doPrivileged( - //new sun.security.action.LoadLibraryAction("imageioIJG")); - } catch (Throwable e) { // Fail on any Throwable - // if it can't be loaded, deregister and return - registry.deregisterServiceProvider(this); - return; - } - */ - - registered = true; - } - - public String getDescription(Locale locale) { - return "Standard JPEG Image Reader"; - } - - public boolean canDecodeInput(Object source) throws IOException { - if (!(source instanceof ImageInputStream)) { - return false; - } - ImageInputStream iis = (ImageInputStream) source; - iis.mark(); - // If the first two bytes are a JPEG SOI marker, it's probably - // a JPEG file. If they aren't, it definitely isn't a JPEG file. - int byte1 = iis.read(); - int byte2 = iis.read(); - iis.reset(); - if ((byte1 == 0xFF) && (byte2 == JPEG.SOI)) { - return true; - } - return false; - } - - public ImageReader createReaderInstance(Object extension) - throws IIOException { - return new JPEGImageReader(this); - } - -} diff --git a/openjdk/com/sun/imageio/plugins/jpeg/JPEGImageWriterSpi.java b/openjdk/com/sun/imageio/plugins/jpeg/JPEGImageWriterSpi.java deleted file mode 100644 index ef3a1ea1..00000000 --- a/openjdk/com/sun/imageio/plugins/jpeg/JPEGImageWriterSpi.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.imageio.plugins.jpeg; - -import javax.imageio.spi.ImageWriterSpi; -import javax.imageio.spi.ServiceRegistry; -import javax.imageio.spi.IIORegistry; -import javax.imageio.stream.ImageOutputStream; -import javax.imageio.ImageWriter; -import javax.imageio.ImageTypeSpecifier; -import javax.imageio.IIOException; - -import java.awt.image.ColorModel; -import java.awt.image.IndexColorModel; -import java.awt.image.SampleModel; -import java.util.Locale; - -public class JPEGImageWriterSpi extends ImageWriterSpi { - - private static String [] readerSpiNames = - {"com.sun.imageio.plugins.jpeg.JPEGImageReaderSpi"}; - - private boolean registered = false; - - public JPEGImageWriterSpi() { - super(JPEG.vendor, - JPEG.version, - JPEG.names, - JPEG.suffixes, - JPEG.MIMETypes, - "com.sun.imageio.plugins.jpeg.JPEGImageWriter", - new Class[] { ImageOutputStream.class }, - readerSpiNames, - true, - JPEG.nativeStreamMetadataFormatName, - JPEG.nativeStreamMetadataFormatClassName, - null, null, - true, - JPEG.nativeImageMetadataFormatName, - JPEG.nativeImageMetadataFormatClassName, - null, null - ); - } - - public String getDescription(Locale locale) { - return "Standard JPEG Image Writer (not implemented)"; - } - - public void onRegistration(ServiceRegistry registry, - Class category) { - if (registered) { - return; - } - /* - try { - java.security.AccessController.doPrivileged( - new sun.security.action.LoadLibraryAction("jpeg")); - } catch (Throwable e) { // Fail on any Throwable - // if it can't be loaded, deregister and return - registry.deregisterServiceProvider(this); - return; - } - */ - - registered = true; - } - - public boolean isFormatLossless() { - return false; - } - - public boolean canEncodeImage(ImageTypeSpecifier type) { - SampleModel sampleModel = type.getSampleModel(); - - // Find the maximum bit depth across all channels - int[] sampleSize = sampleModel.getSampleSize(); - int bitDepth = sampleSize[0]; - for (int i = 1; i < sampleSize.length; i++) { - if (sampleSize[i] > bitDepth) { - bitDepth = sampleSize[i]; - } - } - - // 4450894: Ensure bitDepth is between 1 and 8 - if (bitDepth < 1 || bitDepth > 8) { - return false; - } - - return true; - } - - public ImageWriter createWriterInstance(Object extension) - throws IIOException { - return new JPEGImageWriter(this); - } -} -- cgit v1.2.3