| 117 | } |
| 118 | |
| 119 | ILboolean iLoadIffInternal(void) |
| 120 | { |
| 121 | iff_chunk chunkInfo; |
| 122 | |
| 123 | // -- Header info. |
| 124 | ILuint width, height; |
| 125 | ILuint flags, compress; |
| 126 | ILushort tiles; |
| 127 | |
| 128 | ILenum format; |
| 129 | ILubyte bpp; |
| 130 | |
| 131 | ILboolean tileImageDataFound; |
| 132 | |
| 133 | // -- Initialize the top of the chunk stack. |
| 134 | chunkDepth = -1; |
| 135 | |
| 136 | // -- File should begin with a FOR4 chunk of type CIMG |
| 137 | chunkInfo = iff_begin_read_chunk(); |
| 138 | if (chunkInfo.chunkType != IFF_TAG_CIMG) { |
| 139 | ilSetError(IL_ILLEGAL_FILE_VALUE); |
| 140 | return IL_FALSE; |
| 141 | } |
| 142 | |
| 143 | |
| 144 | /* |
| 145 | * Read the image header |
| 146 | * OK, we have a FOR4 of type CIMG, look for the following tags |
| 147 | * FVER |
| 148 | * TBHD bitmap header, definition of size, etc. |
| 149 | * AUTH |
| 150 | * DATE |
| 151 | */ |
| 152 | while (1) { |
| 153 | |
| 154 | chunkInfo = iff_begin_read_chunk(); |
| 155 | |
| 156 | // -- Right now, the only info we need about the image is in TBHD |
| 157 | // -- so search this level until we find it. |
| 158 | if( chunkInfo.tag == IFF_TAG_TBHD ) { |
| 159 | // -- Header chunk found |
| 160 | width = GetBigUInt(); |
| 161 | height = GetBigUInt(); |
| 162 | GetBigShort(); // -- Don't support |
| 163 | GetBigShort(); // -- Don't support |
| 164 | flags = GetBigUInt(); |
| 165 | GetBigShort(); // -- Don't support |
| 166 | tiles = GetBigUShort(); |
| 167 | compress = GetBigUInt(); |
| 168 | |
| 169 | iff_end_read_chunk(); |
| 170 | |
| 171 | if( compress > 1 ) { |
| 172 | ilSetError(IL_ILLEGAL_FILE_VALUE); |
| 173 | return IL_FALSE; |
| 174 | } |
| 175 | break; |
| 176 | } else |
no test coverage detected