Skip to content

Commit fe9bb94

Browse files
walbourn_cpwalbourn_cp
walbourn_cp
authored and
walbourn_cp
committed
DirectXTex: fixed color order for 24bpp legacy DDS file expansions
1 parent 37a8035 commit fe9bb94

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

DirectXTex/DirectXTexDDS.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -689,9 +689,10 @@ static bool _LegacyExpandScanline( _Out_bytecap_(outSize) LPVOID pDestination, s
689689

690690
for( size_t ocount = 0, icount = 0; ((icount < inSize) && (ocount < outSize)); icount += 3, ocount += 4 )
691691
{
692-
uint32_t t1 = *sPtr;
692+
// 24bpp Direct3D 9 files are actually BGR, so need to swizzle as well
693+
uint32_t t1 = ( *(sPtr) << 16 );
693694
uint32_t t2 = ( *(sPtr+1) << 8 );
694-
uint32_t t3 = ( *(sPtr+2) << 16 );
695+
uint32_t t3 = *(sPtr+2);
695696

696697
*(dPtr++) = t1 | t2 | t3 | 0xff000000;
697698
sPtr += 3;

0 commit comments

Comments
 (0)