1 11 package org.eclipse.swt.internal.image; 12 13 14 import org.eclipse.swt.*; 15 16 class PngIendChunk extends PngChunk { 17 18 PngIendChunk() { 19 super(0); 20 setType(TYPE_IEND); 21 setCRC(computeCRC()); 22 } 23 24 PngIendChunk(byte[] reference){ 25 super(reference); 26 } 27 28 int getChunkType() { 29 return CHUNK_IEND; 30 } 31 32 35 void validate(PngFileReadState readState, PngIhdrChunk headerChunk) { 36 if (!readState.readIHDR 40 || (headerChunk.getMustHavePalette() && !readState.readPLTE) 41 || !readState.readIDAT 42 || readState.readIEND) 43 { 44 SWT.error(SWT.ERROR_INVALID_IMAGE); 45 } else { 46 readState.readIEND = true; 47 } 48 49 super.validate(readState, headerChunk); 50 51 if (getLength() > 0) SWT.error(SWT.ERROR_INVALID_IMAGE); 53 } 54 55 } 56 | Popular Tags |