equal
deleted
inserted
replaced
21 typedef uint8_t uint8; |
21 typedef uint8_t uint8; |
22 typedef uint32_t uint32; |
22 typedef uint32_t uint32; |
23 #endif |
23 #endif |
24 |
24 |
25 #define STATICARRAYLEN(x) ( (sizeof ((x))) / (sizeof ((x)[0])) ) |
25 #define STATICARRAYLEN(x) ( (sizeof ((x))) / (sizeof ((x)[0])) ) |
26 |
|
27 |
26 |
28 #define DDS_MAGIC 0x20534444 // 'DDS ' in littleendian. |
27 #define DDS_MAGIC 0x20534444 // 'DDS ' in littleendian. |
29 #define DDS_HEADERSIZE 124 |
28 #define DDS_HEADERSIZE 124 |
30 #define DDS_PIXFMTSIZE 32 |
29 #define DDS_PIXFMTSIZE 32 |
31 #define DDSD_CAPS 0x1 |
30 #define DDSD_CAPS 0x1 |
35 #define DDSD_FMT 0x1000 |
34 #define DDSD_FMT 0x1000 |
36 #define DDSD_MIPMAPCOUNT 0x20000 |
35 #define DDSD_MIPMAPCOUNT 0x20000 |
37 #define DDSD_LINEARSIZE 0x80000 |
36 #define DDSD_LINEARSIZE 0x80000 |
38 #define DDSD_DEPTH 0x800000 |
37 #define DDSD_DEPTH 0x800000 |
39 #define DDSD_REQ (DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_FMT) |
38 #define DDSD_REQ (DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_FMT) |
|
39 #define DDSCAPS_ALPHA 0x2 |
40 #define DDSCAPS_COMPLEX 0x8 |
40 #define DDSCAPS_COMPLEX 0x8 |
41 #define DDSCAPS_MIPMAP 0x400000 |
41 #define DDSCAPS_MIPMAP 0x400000 |
42 #define DDSCAPS_TEXTURE 0x1000 |
42 #define DDSCAPS_TEXTURE 0x1000 |
43 #define DDPF_ALPHAPIXELS 0x1 |
43 #define DDPF_ALPHAPIXELS 0x1 |
44 #define DDPF_ALPHA 0x2 |
44 #define DDPF_ALPHA 0x2 |
142 header->dwReserved2 = readui32(ptr, len); |
142 header->dwReserved2 = readui32(ptr, len); |
143 |
143 |
144 width = header->dwWidth; |
144 width = header->dwWidth; |
145 height = header->dwHeight; |
145 height = header->dwHeight; |
146 |
146 |
|
147 header->dwCaps &= ~DDSCAPS_ALPHA; // we'll get this from the pixel format. |
|
148 |
147 if (header->dwSize != DDS_HEADERSIZE) // header size must be 124. |
149 if (header->dwSize != DDS_HEADERSIZE) // header size must be 124. |
148 return 0; |
150 return 0; |
149 else if (header->ddspf.dwSize != DDS_PIXFMTSIZE) // size must be 32. |
151 else if (header->ddspf.dwSize != DDS_PIXFMTSIZE) // size must be 32. |
150 return 0; |
152 return 0; |
151 else if ((header->dwFlags & DDSD_REQ) != DDSD_REQ) // must have these bits. |
153 else if ((header->dwFlags & DDSD_REQ) != DDSD_REQ) // must have these bits. |