MCPcopy Create free account
hub / github.com/DentonW/DevIL / iLoadIffInternal

Function iLoadIffInternal

DevIL/src-IL/src/il_iff.cpp:119–290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117}
118
119ILboolean 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

Callers 2

ilLoadIffFFunction · 0.85
ilLoadIffLFunction · 0.85

Calls 10

iff_begin_read_chunkFunction · 0.85
ilSetErrorFunction · 0.85
GetBigUIntFunction · 0.85
GetBigShortFunction · 0.85
GetBigUShortFunction · 0.85
iff_end_read_chunkFunction · 0.85
iff_read_dataFunction · 0.85
iff_decompress_tile_rleFunction · 0.85
iffReadUncompressedTileFunction · 0.85
ilFixImageFunction · 0.85

Tested by

no test coverage detected