src/share/classes/sun/awt/image/PNGImageDecoder.java

Print this page
rev 9830 : 8039642: Fix raw and unchecked warnings in sun.awt.*
Reviewed-by: darcy, prr


  51     private static final int hISTChunk = 0x68495354;
  52     private static final int IDATChunk = 0x49444154;
  53     private static final int IENDChunk = 0x49454E44;
  54     private static final int IHDRChunk = 0x49484452;
  55     private static final int PLTEChunk = 0x504C5445;
  56     private static final int pHYsChunk = 0x70485973;
  57     private static final int sBITChunk = 0x73424954;
  58     private static final int tEXtChunk = 0x74455874;
  59     private static final int tIMEChunk = 0x74494D45;
  60     private static final int tRNSChunk = 0x74524E53;
  61     private static final int zTXtChunk = 0x7A545874;
  62 
  63     private int width;
  64     private int height;
  65     private int bitDepth;
  66     private int colorType;
  67     private int compressionMethod;
  68     private int filterMethod;
  69     private int interlaceMethod;
  70     private int gamma = 100000;
  71     private java.util.Hashtable properties;
  72   /* this is not needed
  73     ImageConsumer target;
  74     */
  75     private ColorModel cm;
  76     private byte[] red_map, green_map, blue_map, alpha_map;
  77     private int transparentPixel = -1;
  78     private byte[]  transparentPixel_16 = null; // we need 6 bytes to store 16bpp value
  79     private static ColorModel greyModels[] = new ColorModel[4];
  80   /* this is not needed
  81      PNGImageDecoder next;
  82      */
  83 
  84     private void property(String key,Object value) {
  85         if(value==null) return;
  86         if(properties==null) properties=new java.util.Hashtable();
  87         properties.put(key,value);
  88     }
  89     private void property(String key,float value) {
  90         property(key,new Float(value));
  91     }
  92     private final void pngassert(boolean b) throws IOException {
  93         if(!b) {
  94             PNGException e = new PNGException("Broken file");
  95             e.printStackTrace();
  96             throw e;
  97         }
  98     }
  99     protected boolean handleChunk(int key, byte[] buf, int st, int len)
 100         throws IOException {
 101         switch(key) {
 102             case bKGDChunk:
 103                 Color c = null;
 104                 switch(colorType) {
 105                     case COLOR:
 106                     case COLOR|ALPHA:




  51     private static final int hISTChunk = 0x68495354;
  52     private static final int IDATChunk = 0x49444154;
  53     private static final int IENDChunk = 0x49454E44;
  54     private static final int IHDRChunk = 0x49484452;
  55     private static final int PLTEChunk = 0x504C5445;
  56     private static final int pHYsChunk = 0x70485973;
  57     private static final int sBITChunk = 0x73424954;
  58     private static final int tEXtChunk = 0x74455874;
  59     private static final int tIMEChunk = 0x74494D45;
  60     private static final int tRNSChunk = 0x74524E53;
  61     private static final int zTXtChunk = 0x7A545874;
  62 
  63     private int width;
  64     private int height;
  65     private int bitDepth;
  66     private int colorType;
  67     private int compressionMethod;
  68     private int filterMethod;
  69     private int interlaceMethod;
  70     private int gamma = 100000;
  71     private java.util.Hashtable<String, Object> properties;
  72   /* this is not needed
  73     ImageConsumer target;
  74     */
  75     private ColorModel cm;
  76     private byte[] red_map, green_map, blue_map, alpha_map;
  77     private int transparentPixel = -1;
  78     private byte[]  transparentPixel_16 = null; // we need 6 bytes to store 16bpp value
  79     private static ColorModel greyModels[] = new ColorModel[4];
  80   /* this is not needed
  81      PNGImageDecoder next;
  82      */
  83 
  84     private void property(String key,Object value) {
  85         if(value==null) return;
  86         if(properties==null) properties=new java.util.Hashtable<>();
  87         properties.put(key,value);
  88     }
  89     private void property(String key,float value) {
  90         property(key,new Float(value));
  91     }
  92     private final void pngassert(boolean b) throws IOException {
  93         if(!b) {
  94             PNGException e = new PNGException("Broken file");
  95             e.printStackTrace();
  96             throw e;
  97         }
  98     }
  99     protected boolean handleChunk(int key, byte[] buf, int st, int len)
 100         throws IOException {
 101         switch(key) {
 102             case bKGDChunk:
 103                 Color c = null;
 104                 switch(colorType) {
 105                     case COLOR:
 106                     case COLOR|ALPHA: