~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to source/blender/imbuf/intern/dds/DirectDrawSurface.cpp

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
280
280
                DXGI_FORMAT_B8G8R8A8_UNORM = 87,
281
281
                DXGI_FORMAT_B8G8R8X8_UNORM = 88,
282
282
 
283
 
        DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM = 89,
284
 
        DXGI_FORMAT_B8G8R8A8_TYPELESS = 90,
285
 
        DXGI_FORMAT_B8G8R8A8_UNORM_SRGB = 91,
286
 
        DXGI_FORMAT_B8G8R8X8_TYPELESS = 92,
287
 
        DXGI_FORMAT_B8G8R8X8_UNORM_SRGB = 93,
288
 
 
289
 
        DXGI_FORMAT_BC6H_TYPELESS = 94,
290
 
        DXGI_FORMAT_BC6H_UF16 = 95,
291
 
        DXGI_FORMAT_BC6H_SF16 = 96,
292
 
 
293
 
        DXGI_FORMAT_BC7_TYPELESS = 97,
294
 
        DXGI_FORMAT_BC7_UNORM = 98,
295
 
        DXGI_FORMAT_BC7_UNORM_SRGB = 99,
 
283
                DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM = 89,
 
284
                DXGI_FORMAT_B8G8R8A8_TYPELESS = 90,
 
285
                DXGI_FORMAT_B8G8R8A8_UNORM_SRGB = 91,
 
286
                DXGI_FORMAT_B8G8R8X8_TYPELESS = 92,
 
287
                DXGI_FORMAT_B8G8R8X8_UNORM_SRGB = 93,
 
288
 
 
289
                DXGI_FORMAT_BC6H_TYPELESS = 94,
 
290
                DXGI_FORMAT_BC6H_UF16 = 95,
 
291
                DXGI_FORMAT_BC6H_SF16 = 96,
 
292
 
 
293
                DXGI_FORMAT_BC7_TYPELESS = 97,
 
294
                DXGI_FORMAT_BC7_UNORM = 98,
 
295
                DXGI_FORMAT_BC7_UNORM_SRGB = 99,
296
296
        };
297
297
 
298
298
        enum D3D10_RESOURCE_DIMENSION
305
305
        };
306
306
 
307
307
 
308
 
        const char * getDxgiFormatString(DXGI_FORMAT dxgiFormat)
 
308
        static const char * getDxgiFormatString(DXGI_FORMAT dxgiFormat)
309
309
        {
310
310
#define CASE(format) case DXGI_FORMAT_##format: return #format
311
 
                switch(dxgiFormat)
 
311
                switch (dxgiFormat)
312
312
                {
313
313
                        CASE(UNKNOWN);
314
314
                        
429
429
#undef CASE
430
430
        }
431
431
        
432
 
        const char * getD3d10ResourceDimensionString(D3D10_RESOURCE_DIMENSION resourceDimension)
 
432
        static const char * getD3d10ResourceDimensionString(D3D10_RESOURCE_DIMENSION resourceDimension)
433
433
        {
434
 
                switch(resourceDimension)
 
434
                switch (resourceDimension)
435
435
                {
436
436
                        default:
437
437
                        case D3D10_RESOURCE_DIMENSION_UNKNOWN: return "UNKNOWN";
496
496
 
497
497
namespace
498
498
{
499
 
    struct FormatDescriptor
500
 
    {
501
 
        uint format;
502
 
        uint bitcount;
503
 
        uint rmask;
504
 
        uint gmask;
505
 
        uint bmask;
506
 
        uint amask;
507
 
    };
508
 
 
509
 
    static const FormatDescriptor s_d3dFormats[] =
510
 
    {
511
 
        { D3DFMT_R8G8B8,                24, 0xFF0000,   0xFF00,     0xFF,       0 },
512
 
        { D3DFMT_A8R8G8B8,              32, 0xFF0000,   0xFF00,     0xFF,       0xFF000000 },  // DXGI_FORMAT_B8G8R8A8_UNORM
513
 
        { D3DFMT_X8R8G8B8,              32, 0xFF0000,   0xFF00,     0xFF,       0 },           // DXGI_FORMAT_B8G8R8X8_UNORM
514
 
        { D3DFMT_R5G6B5,                16,     0xF800,     0x7E0,      0x1F,       0 },           // DXGI_FORMAT_B5G6R5_UNORM
515
 
        { D3DFMT_X1R5G5B5,              16, 0x7C00,     0x3E0,      0x1F,       0 },
516
 
        { D3DFMT_A1R5G5B5,              16, 0x7C00,     0x3E0,      0x1F,       0x8000 },      // DXGI_FORMAT_B5G5R5A1_UNORM
517
 
        { D3DFMT_A4R4G4B4,              16, 0xF00,      0xF0,       0xF,        0xF000 },
518
 
        { D3DFMT_R3G3B2,                8,  0xE0,       0x1C,       0x3,            0 },
519
 
        { D3DFMT_A8,                    8,  0,          0,          0,              8 },           // DXGI_FORMAT_A8_UNORM
520
 
        { D3DFMT_A8R3G3B2,              16, 0xE0,       0x1C,       0x3,        0xFF00 },
521
 
        { D3DFMT_X4R4G4B4,              16, 0xF00,      0xF0,       0xF,        0 },
522
 
        { D3DFMT_A2B10G10R10,   32, 0x3FF,      0xFFC00,    0x3FF00000, 0xC0000000 },  // DXGI_FORMAT_R10G10B10A2
523
 
        { D3DFMT_A8B8G8R8,              32, 0xFF,       0xFF00,     0xFF0000,   0xFF000000 },  // DXGI_FORMAT_R8G8B8A8_UNORM
524
 
        { D3DFMT_X8B8G8R8,              32, 0xFF,       0xFF00,     0xFF0000,   0 },
525
 
        { D3DFMT_G16R16,                32, 0xFFFF,     0xFFFF0000, 0,          0 },           // DXGI_FORMAT_R16G16_UNORM
526
 
        { D3DFMT_A2R10G10B10,   32, 0x3FF00000, 0xFFC00,    0x3FF,      0xC0000000 },
527
 
        { D3DFMT_A2B10G10R10,   32, 0x3FF,      0xFFC00,    0x3FF00000, 0xC0000000 },
528
 
 
529
 
        { D3DFMT_L8,                    8,  8,          0,          0,          0 },           // DXGI_FORMAT_R8_UNORM 
530
 
        { D3DFMT_L16,                   16, 16,         0,          0,          0 },           // DXGI_FORMAT_R16_UNORM
531
 
    };
532
 
 
533
 
    static const uint s_d3dFormatCount = sizeof(s_d3dFormats) / sizeof(s_d3dFormats[0]);
 
499
struct FormatDescriptor
 
500
{
 
501
        uint format;
 
502
        uint bitcount;
 
503
        uint rmask;
 
504
        uint gmask;
 
505
        uint bmask;
 
506
        uint amask;
 
507
};
 
508
 
 
509
static const FormatDescriptor s_d3dFormats[] =
 
510
{
 
511
        { D3DFMT_R8G8B8,        24, 0xFF0000,   0xFF00,     0xFF,       0 },
 
512
        { D3DFMT_A8R8G8B8,      32, 0xFF0000,   0xFF00,     0xFF,       0xFF000000 },  /* DXGI_FORMAT_B8G8R8A8_UNORM */
 
513
        { D3DFMT_X8R8G8B8,      32, 0xFF0000,   0xFF00,     0xFF,       0 },           /* DXGI_FORMAT_B8G8R8X8_UNORM */
 
514
        { D3DFMT_R5G6B5,        16, 0xF800,     0x7E0,      0x1F,       0 },           /* DXGI_FORMAT_B5G6R5_UNORM */
 
515
        { D3DFMT_X1R5G5B5,      16, 0x7C00,     0x3E0,      0x1F,       0 },
 
516
        { D3DFMT_A1R5G5B5,      16, 0x7C00,     0x3E0,      0x1F,       0x8000 },      /* DXGI_FORMAT_B5G5R5A1_UNORM */
 
517
        { D3DFMT_A4R4G4B4,      16, 0xF00,      0xF0,       0xF,        0xF000 },
 
518
        { D3DFMT_R3G3B2,        8,  0xE0,       0x1C,       0x3,        0 },
 
519
        { D3DFMT_A8,            8,  0,          0,          0,          8 },           /* DXGI_FORMAT_A8_UNORM */
 
520
        { D3DFMT_A8R3G3B2,      16, 0xE0,       0x1C,       0x3,        0xFF00 },
 
521
        { D3DFMT_X4R4G4B4,      16, 0xF00,      0xF0,       0xF,        0 },
 
522
        { D3DFMT_A2B10G10R10,   32, 0x3FF,      0xFFC00,    0x3FF00000, 0xC0000000 },  /* DXGI_FORMAT_R10G10B10A2 */
 
523
        { D3DFMT_A8B8G8R8,      32, 0xFF,       0xFF00,     0xFF0000,   0xFF000000 },  /* DXGI_FORMAT_R8G8B8A8_UNORM */
 
524
        { D3DFMT_X8B8G8R8,      32, 0xFF,       0xFF00,     0xFF0000,   0 },
 
525
        { D3DFMT_G16R16,        32, 0xFFFF,     0xFFFF0000, 0,          0 },           /* DXGI_FORMAT_R16G16_UNORM */
 
526
        { D3DFMT_A2R10G10B10,   32, 0x3FF00000, 0xFFC00,    0x3FF,      0xC0000000 },
 
527
        { D3DFMT_A2B10G10R10,   32, 0x3FF,      0xFFC00,    0x3FF00000, 0xC0000000 },
 
528
 
 
529
        { D3DFMT_L8,            8,  8,          0,          0,          0 },           /* DXGI_FORMAT_R8_UNORM */
 
530
        { D3DFMT_L16,           16, 16,         0,          0,          0 },           /* DXGI_FORMAT_R16_UNORM */
 
531
};
 
532
 
 
533
static const uint s_d3dFormatCount = sizeof(s_d3dFormats) / sizeof(s_d3dFormats[0]);
534
534
 
535
535
} // namespace
536
536
 
537
 
uint findD3D9Format(uint bitcount, uint rmask, uint gmask, uint bmask, uint amask)
 
537
static uint findD3D9Format(uint bitcount, uint rmask, uint gmask, uint bmask, uint amask)
538
538
{
539
 
    for (int i = 0; i < s_d3dFormatCount; i++)
540
 
        {
541
 
            if (s_d3dFormats[i].bitcount == bitcount &&
542
 
                s_d3dFormats[i].rmask == rmask &&
543
 
                s_d3dFormats[i].gmask == gmask &&
544
 
                s_d3dFormats[i].bmask == bmask &&
545
 
                s_d3dFormats[i].amask == amask)
546
 
            {
547
 
                return s_d3dFormats[i].format;
548
 
            }
549
 
        }
 
539
        for (int i = 0; i < s_d3dFormatCount; i++)
 
540
        {
 
541
                if (s_d3dFormats[i].bitcount == bitcount &&
 
542
                    s_d3dFormats[i].rmask == rmask &&
 
543
                    s_d3dFormats[i].gmask == gmask &&
 
544
                    s_d3dFormats[i].bmask == bmask &&
 
545
                    s_d3dFormats[i].amask == amask)
 
546
                {
 
547
                        return s_d3dFormats[i].format;
 
548
                }
 
549
        }
550
550
 
551
 
        return 0;
552
 
    }
 
551
        return 0;
 
552
}
553
553
 
554
554
 
555
555
 
566
566
        for (uint i = 0; i < 11; i++) this->reserved[i] = 0;
567
567
 
568
568
        // Store version information on the reserved header attributes.
569
 
    this->reserved[9] = FOURCC_NVTT;
 
569
        this->reserved[9] = FOURCC_NVTT;
570
570
        this->reserved[10] = (2 << 16) | (1 << 8) | (0);        // major.minor.revision
571
571
 
572
572
        this->pf.size = 32;
613
613
        if (count == 0 || count == 1)
614
614
        {
615
615
                this->flags &= ~DDSD_MIPMAPCOUNT;
616
 
        this->mipmapcount = 1;
 
616
                this->mipmapcount = 1;
617
617
 
618
618
                if (this->caps.caps2 == 0) {
619
619
                        this->caps.caps1 = DDSCAPS_TEXTURE;
715
715
 
716
716
        if (rmask != 0 || gmask != 0 || bmask != 0)
717
717
        {
718
 
        if (gmask == 0 && bmask == 0)
719
 
        {
720
 
            this->pf.flags = DDPF_LUMINANCE;
721
 
        }
722
 
        else
723
 
        {
724
 
                    this->pf.flags = DDPF_RGB;
725
 
        }
 
718
                if (gmask == 0 && bmask == 0)
 
719
                {
 
720
                        this->pf.flags = DDPF_LUMINANCE;
 
721
                }
 
722
                else
 
723
                {
 
724
                        this->pf.flags = DDPF_RGB;
 
725
                }
726
726
 
727
727
                if (amask != 0) {
728
728
                        this->pf.flags |= DDPF_ALPHAPIXELS;
737
737
        {
738
738
                // Compute bit count from the masks.
739
739
                uint total = rmask | gmask | bmask | amask;
740
 
                while(total != 0) {
 
740
                while (total != 0) {
741
741
                        bitcount++;
742
742
                        total >>= 1;
743
743
                }
744
744
        }
745
745
 
746
 
    // D3DX functions do not like this:
 
746
        // D3DX functions do not like this:
747
747
        this->pf.fourcc = 0; //findD3D9Format(bitcount, rmask, gmask, bmask, amask);
748
 
    /*if (this->pf.fourcc) {
749
 
        this->pf.flags |= DDPF_FOURCC;
750
 
    }*/
 
748
        /*if (this->pf.fourcc) {
 
749
                this->pf.flags |= DDPF_FOURCC;
 
750
        }*/
751
751
 
752
752
        if (!(bitcount > 0 && bitcount <= 32)) {
753
753
                printf("DDS: bad bit count, pixel format not set\n");
775
775
 
776
776
void DDSHeader::setSrgbFlag(bool b)
777
777
{
778
 
    if (b) this->pf.flags |= DDPF_SRGB;
779
 
    else this->pf.flags &= ~DDPF_SRGB;
 
778
        if (b) this->pf.flags |= DDPF_SRGB;
 
779
        else this->pf.flags &= ~DDPF_SRGB;
780
780
}
781
781
 
782
782
void DDSHeader::setHasAlphaFlag(bool b)
787
787
 
788
788
void DDSHeader::setUserVersion(int version)
789
789
{
790
 
    this->reserved[7] = FOURCC_UVER;
791
 
    this->reserved[8] = version;
 
790
        this->reserved[7] = FOURCC_UVER;
 
791
        this->reserved[8] = version;
792
792
}
793
793
 
794
794
/*
836
836
 
837
837
uint DDSHeader::signature() const
838
838
{
839
 
    return this->reserved[9];
 
839
        return this->reserved[9];
840
840
}
841
841
 
842
842
uint DDSHeader::toolVersion() const
843
843
{
844
 
    return this->reserved[10];
 
844
        return this->reserved[10];
845
845
}
846
846
 
847
847
uint DDSHeader::userVersion() const
848
848
{
849
 
    if (this->reserved[7] == FOURCC_UVER) {
850
 
        return this->reserved[8];
851
 
    }
852
 
    return 0;
 
849
        if (this->reserved[7] == FOURCC_UVER) {
 
850
                return this->reserved[8];
 
851
        }
 
852
        return 0;
853
853
}
854
854
 
855
855
bool DDSHeader::isNormalMap() const
856
856
{
857
 
    return (pf.flags & DDPF_NORMAL) != 0;
 
857
        return (pf.flags & DDPF_NORMAL) != 0;
858
858
}
859
859
 
860
860
bool DDSHeader::isSrgb() const
861
861
{
862
 
    return (pf.flags & DDPF_SRGB) != 0;
 
862
        return (pf.flags & DDPF_SRGB) != 0;
863
863
}
864
864
 
865
865
bool DDSHeader::hasAlpha() const
866
866
{
867
 
    return (pf.flags & DDPF_ALPHAPIXELS) != 0;
 
867
        return (pf.flags & DDPF_ALPHAPIXELS) != 0;
868
868
}
869
869
 
870
870
uint DDSHeader::d3d9Format() const
871
871
{
872
 
    if (pf.flags & DDPF_FOURCC) {
873
 
        return pf.fourcc;
874
 
    }
875
 
    else {
876
 
        return findD3D9Format(pf.bitcount, pf.rmask, pf.gmask, pf.bmask, pf.amask);
877
 
    }
 
872
        if (pf.flags & DDPF_FOURCC) {
 
873
                return pf.fourcc;
 
874
        }
 
875
        else {
 
876
                return findD3D9Format(pf.bitcount, pf.rmask, pf.gmask, pf.bmask, pf.amask);
 
877
        }
878
878
}
879
879
 
880
880
DirectDrawSurface::DirectDrawSurface(unsigned char *mem, uint size) : stream(mem, size), header()
949
949
                                return false;
950
950
                        }
951
951
                }
952
 
        else if ((header.pf.flags & DDPF_RGB) || (header.pf.flags & DDPF_LUMINANCE))
953
 
        {
954
 
            // All RGB and luminance formats are supported now.
 
952
                else if ((header.pf.flags & DDPF_RGB) || (header.pf.flags & DDPF_LUMINANCE))
 
953
                {
 
954
                        // All RGB and luminance formats are supported now.
955
955
                }
956
956
                else
957
957
                {
1001
1001
                        }
1002
1002
                        else
1003
1003
                        {
1004
 
                // @@ Here we could check the ALPHA_PIXELS flag, but nobody sets it. (except us?)
 
1004
                                // @@ Here we could check the ALPHA_PIXELS flag, but nobody sets it. (except us?)
1005
1005
                                return true;
1006
1006
                        }
1007
1007
                }
1016
1016
        else return 1;
1017
1017
}
1018
1018
 
 
1019
uint DirectDrawSurface::fourCC() const
 
1020
{
 
1021
        return header.pf.fourcc;
 
1022
}
1019
1023
 
1020
1024
uint DirectDrawSurface::width() const
1021
1025
{
1085
1089
 
1086
1090
void DirectDrawSurface::setUserVersion(int version)
1087
1091
{
1088
 
    header.setUserVersion(version);
 
1092
        header.setUserVersion(version);
1089
1093
}
1090
1094
 
1091
1095
void DirectDrawSurface::mipmap(Image * img, uint face, uint mipmap)
1131
1135
        }
1132
1136
}
1133
1137
 
 
1138
// It was easier to copy this function from upstream than to resync.
 
1139
// This should be removed if a resync ever occurs.
 
1140
void* DirectDrawSurface::readData(uint &rsize)
 
1141
{
 
1142
        uint header_size = 128; // sizeof(DDSHeader);
 
1143
        if (header.hasDX10Header())
 
1144
        {
 
1145
                header_size += 20; // sizeof(DDSHeader10);
 
1146
        }
 
1147
 
 
1148
        uint size = stream.size - header_size;
 
1149
        rsize = size;
 
1150
 
 
1151
        unsigned char *data = new unsigned char[size];
 
1152
 
 
1153
        stream.seek(header_size);
 
1154
        mem_read(stream, data, size);
 
1155
 
 
1156
        // Maybe check if size == rsize? assert() isn't in this scope...
 
1157
 
 
1158
        return data;
 
1159
}
 
1160
 
1134
1161
void DirectDrawSurface::readLinearImage(Image * img)
1135
1162
{
1136
1163
        
1241
1268
                block.decodeBlock(rgba);
1242
1269
        }
1243
1270
        else if (fourcc == FOURCC_DXT2 ||
1244
 
            header.pf.fourcc == FOURCC_DXT3)
 
1271
                 header.pf.fourcc == FOURCC_DXT3)
1245
1272
        {
1246
1273
                BlockDXT3 block;
1247
1274
                mem_read(stream, block);
1248
1275
                block.decodeBlock(rgba);
1249
1276
        }
1250
1277
        else if (fourcc == FOURCC_DXT4 ||
1251
 
            header.pf.fourcc == FOURCC_DXT5 ||
1252
 
            header.pf.fourcc == FOURCC_RXGB)
 
1278
                 header.pf.fourcc == FOURCC_DXT5 ||
 
1279
                 header.pf.fourcc == FOURCC_RXGB)
1253
1280
        {
1254
1281
                BlockDXT5 block;
1255
1282
                mem_read(stream, block);
1305
1332
 
1306
1333
uint DirectDrawSurface::blockSize() const
1307
1334
{
1308
 
        switch(header.pf.fourcc)
 
1335
        switch (header.pf.fourcc)
1309
1336
        {
1310
1337
                case FOURCC_DXT1:
1311
1338
                case FOURCC_ATI1:
1318
1345
                case FOURCC_ATI2:
1319
1346
                        return 16;
1320
1347
                case FOURCC_DX10:
1321
 
                        switch(header.header10.dxgiFormat)
 
1348
                        switch (header.header10.dxgiFormat)
1322
1349
                        {
1323
1350
                                case DXGI_FORMAT_BC1_TYPELESS:
1324
1351
                                case DXGI_FORMAT_BC1_UNORM:
1366
1393
        }
1367
1394
        else if (header.pf.flags & DDPF_RGB || (header.pf.flags & DDPF_LUMINANCE))
1368
1395
        {
1369
 
        uint pitch = computePitch(w, header.pf.bitcount, 8); // Asuming 8 bit alignment, which is the same D3DX expects.
1370
 
        
 
1396
                uint pitch = computePitch(w, header.pf.bitcount, 8); // Asuming 8 bit alignment, which is the same D3DX expects.
 
1397
 
1371
1398
                return pitch * h * d;
1372
1399
        }
1373
1400
        else {
1434
1461
        printf("Pixel Format:\n");
1435
1462
        printf("\tFlags: 0x%.8X\n", header.pf.flags);
1436
1463
        if (header.pf.flags & DDPF_RGB) printf("\t\tDDPF_RGB\n");
1437
 
    if (header.pf.flags & DDPF_LUMINANCE) printf("\t\tDDPF_LUMINANCE\n");
 
1464
        if (header.pf.flags & DDPF_LUMINANCE) printf("\t\tDDPF_LUMINANCE\n");
1438
1465
        if (header.pf.flags & DDPF_FOURCC) printf("\t\tDDPF_FOURCC\n");
1439
1466
        if (header.pf.flags & DDPF_ALPHAPIXELS) printf("\t\tDDPF_ALPHAPIXELS\n");
1440
1467
        if (header.pf.flags & DDPF_ALPHA) printf("\t\tDDPF_ALPHA\n");
1445
1472
        if (header.pf.flags & DDPF_ALPHAPREMULT) printf("\t\tDDPF_ALPHAPREMULT\n");
1446
1473
        if (header.pf.flags & DDPF_NORMAL) printf("\t\tDDPF_NORMAL\n");
1447
1474
        
1448
 
    if (header.pf.fourcc != 0) { 
1449
 
        // Display fourcc code even when DDPF_FOURCC flag not set.
1450
 
        printf("\tFourCC: '%c%c%c%c' (0x%.8X)\n",
1451
 
                        ((header.pf.fourcc >> 0) & 0xFF),
1452
 
                        ((header.pf.fourcc >> 8) & 0xFF),
1453
 
                        ((header.pf.fourcc >> 16) & 0xFF),
1454
 
            ((header.pf.fourcc >> 24) & 0xFF), 
1455
 
            header.pf.fourcc);
1456
 
    }
 
1475
        if (header.pf.fourcc != 0) {
 
1476
                // Display fourcc code even when DDPF_FOURCC flag not set.
 
1477
                printf("\tFourCC: '%c%c%c%c' (0x%.8X)\n",
 
1478
                       ((header.pf.fourcc >> 0) & 0xFF),
 
1479
                       ((header.pf.fourcc >> 8) & 0xFF),
 
1480
                       ((header.pf.fourcc >> 16) & 0xFF),
 
1481
                       ((header.pf.fourcc >> 24) & 0xFF),
 
1482
                       header.pf.fourcc);
 
1483
        }
1457
1484
 
1458
 
    if ((header.pf.flags & DDPF_FOURCC) && (header.pf.bitcount != 0))
 
1485
        if ((header.pf.flags & DDPF_FOURCC) && (header.pf.bitcount != 0))
1459
1486
        {
1460
 
        printf("\tSwizzle: '%c%c%c%c' (0x%.8X)\n", 
1461
 
                        (header.pf.bitcount >> 0) & 0xFF,
1462
 
                        (header.pf.bitcount >> 8) & 0xFF,
1463
 
                        (header.pf.bitcount >> 16) & 0xFF,
1464
 
            (header.pf.bitcount >> 24) & 0xFF,
1465
 
            header.pf.bitcount);
 
1487
                printf("\tSwizzle: '%c%c%c%c' (0x%.8X)\n",
 
1488
                       (header.pf.bitcount >> 0) & 0xFF,
 
1489
                       (header.pf.bitcount >> 8) & 0xFF,
 
1490
                       (header.pf.bitcount >> 16) & 0xFF,
 
1491
                       (header.pf.bitcount >> 24) & 0xFF,
 
1492
                       header.pf.bitcount);
1466
1493
        }
1467
1494
        else
1468
1495
        {
1507
1534
                printf("\tMisc flag: %u\n", header.header10.miscFlag);
1508
1535
                printf("\tArray size: %u\n", header.header10.arraySize);
1509
1536
        }
1510
 
        
1511
 
    if (header.reserved[9] == FOURCC_NVTT)
 
1537
 
 
1538
        if (header.reserved[9] == FOURCC_NVTT)
1512
1539
        {
1513
1540
                int major = (header.reserved[10] >> 16) & 0xFF;
1514
1541
                int minor = (header.reserved[10] >> 8) & 0xFF;
1518
1545
                printf("\tNVIDIA Texture Tools %d.%d.%d\n", major, minor, revision);
1519
1546
        }
1520
1547
 
1521
 
    if (header.reserved[7] == FOURCC_UVER)
1522
 
    {
1523
 
        printf("User Version: %u\n", header.reserved[8]);
1524
 
    }
 
1548
        if (header.reserved[7] == FOURCC_UVER)
 
1549
        {
 
1550
                printf("User Version: %u\n", header.reserved[8]);
 
1551
        }
1525
1552
}
1526
1553