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

Function iCheckDds

DevIL/src-IL/src/il_dds.cpp:153–167  ·  view source on GitHub ↗

Internal function used to check if the HEADER is a valid .dds header.

Source from the content-addressed store, hash-verified

151
152// Internal function used to check if the HEADER is a valid .dds header.
153ILboolean iCheckDds(DDSHEAD *Head)
154{
155 if (strncmp((const char*)Head->Signature, "DDS ", 4))
156 return IL_FALSE;
157 //note that if Size1 is "DDS " this is not a valid dds file according
158 //to the file spec. Some broken tool out there seems to produce files
159 //with this value in the size field, so we support reading them...
160 if (Head->Size1 != 124 && Head->Size1 != IL_MAKEFOURCC('D', 'D', 'S', ' '))
161 return IL_FALSE;
162 if (Head->Size2 != 32)
163 return IL_FALSE;
164 if (Head->Width == 0 || Head->Height == 0)
165 return IL_FALSE;
166 return IL_TRUE;
167}
168
169
170//! Reads a .dds file

Callers 2

iIsValidDdsFunction · 0.85
iLoadDdsInternalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected