summarylogtreecommitdiffstats
path: root/ABGR8888.patch
blob: 3afa405e9208fba202b42e4d94abd674390d9527 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
diff --git a/thumbnailer_dds10.cpp b/thumbnailer_dds10.cpp
index 7d0aec4..79d5e63 100644
--- a/thumbnailer_dds10.cpp
+++ b/thumbnailer_dds10.cpp
@@ -109,6 +109,15 @@ void Convert_XRGB32(uchar* line_dst, const uchar* line_src, std::size_t width)
         line_dst[4 * j + 3] = 0xff;
     }
 }
+void Convert_ABGR32(uchar* line_dst, const uchar* line_src, std::size_t width)
+{
+    for (std::size_t j = 0; j < width; ++j) {
+        line_dst[4 * j + 0] = line_src[4 * j + 2];
+        line_dst[4 * j + 1] = line_src[4 * j + 1];
+        line_dst[4 * j + 2] = line_src[4 * j + 0];
+        line_dst[4 * j + 3] = line_src[4 * j + 3];
+    }
+}
 
 // Compressed format ///////////////////////////////////////////////////////////
 #define FOURCC(a, b, c, d) ((a) | ((b) << 8) | ((c) << 16) | ((d) << 24))
@@ -183,7 +192,7 @@ constexpr struct {
     // /* D3DFMT_A1R5G5B5    */ {DDS_RGBA,      16, 0x7c00, 0x03e0, 0x001f, 0x8000},
     // /* D3DFMT_G16R16      */ {DDS_RGBA,      32, 0x0000ffff, 0xffff0000, 0x0, 0x0},
     /* D3DFMT_A8R8G8B8    */ {DDS_RGBA,      32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000, QImage::Format_ARGB32, Convert_NOOP32},
-    // /* D3DFMT_A8B8G8R8    */ {DDS_RGBA,      32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000, },
+    /* D3DFMT_A8B8G8R8    */ {DDS_RGBA,      32, 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000, QImage::Format_ARGB32, Convert_ABGR32},
     // /* D3DFMT_A2R10G10B10 */ {DDS_RGBA,      32, 0x3ff00000, 0x000ffc00, 0x000003ff, 0xc0000000, },
     // /* D3DFMT_A2B10G10R10 */ {DDS_RGBA,      32, 0x000003ff, 0x000ffc00, 0x3ff00000, 0xc0000000, },