1 // Copyright 2002 Adam Megacz, see the COPYING file for licensing [GPL]
8 /** common superclass for all platforms that use GCJ to compile a native binary */
9 public abstract class GCJ extends Platform {
11 // static references to these classes ensure that the linker will include them
12 private static Class c1 = gnu.java.locale.Calendar.class;
13 private static Class c2 = java.util.GregorianCalendar.class;
14 private static Class c3 = gnu.gcj.convert.Input_ASCII.class;
15 private static Class c4 = gnu.gcj.convert.Input_UTF8.class;
16 private static Class c5 = gnu.gcj.convert.Input_8859_1.class;
17 private static Class c6 = gnu.java.locale.LocaleInformation.class;
18 private static Class c7 = gnu.gcj.convert.Output_ASCII.class;
20 protected org.xwt.Weak _getWeak(Object o) { return new Java2Weak(o); }
21 protected native InputStream _getBuiltinInputStream();
23 private static class Java2Weak extends java.lang.ref.WeakReference implements org.xwt.Weak {
24 public Java2Weak(Object o) { super(o); }
28 protected ImageDecoder _decodeJPEG(InputStream is, String name) {
31 } catch (Exception e) {
32 Log.log(this, "Exception while decoding JPEG image " + name);
38 /** Converts an InputStream carrying a JPEG image into an ARGB int[] */
39 private static class JPEG implements ImageDecoder {
45 public final int[] getData() { return data; }
46 public final int getWidth() { return width; }
47 public final int getHeight() { return height; }
48 private JPEG(InputStream is) { this.is = is; nativeDecompress(); buffer = null; }
49 private native void nativeDecompress();