Skip to content

Commit 440cc85

Browse files
abramcumnerXottab-DUTY
authored andcommitted
xrDXT: fix 64-bit pointer issue
1 parent 6674821 commit 440cc85

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/utils/xrDXT/Image_DXTC.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -541,14 +541,14 @@ void Image_DXTC::DecompressDXT1()
541541
for (int j = 0; j < yblocks; j++)
542542
{
543543
// 8 bytes per block
544-
pBlock = (DXTColBlock*)((DWORD)m_pCompBytes + j * xblocks * 8);
544+
pBlock = (DXTColBlock*)((DWORD_PTR)m_pCompBytes + j * xblocks * 8);
545545
for (int i = 0; i < xblocks; i++, pBlock++)
546546
{
547547
// inline func:
548548
GetColorBlockColors(pBlock, &col_0, &col_1, &col_2, &col_3, wrd);
549549
// now decode the color block into the bitmap bits
550550
// inline func:
551-
pImPos = (DWORD*)((DWORD)pBase + i * 16 + (j * 4) * m_nWidth * 4);
551+
pImPos = (DWORD*)((DWORD_PTR)pBase + i * 16 + (j * 4) * m_nWidth * 4);
552552
DecodeColorBlock(pImPos, pBlock, m_nWidth, (DWORD*)&col_0, (DWORD*)&col_1, (DWORD*)&col_2, (DWORD*)&col_3);
553553
if (false) // Set to RGB test pattern
554554
{
@@ -593,7 +593,7 @@ void Image_DXTC::DecompressDXT3()
593593
{
594594
// 8 bytes per block
595595
// 1 block for alpha, 1 block for color
596-
pBlock = (DXTColBlock*)((DWORD)m_pCompBytes + j * xblocks * 16);
596+
pBlock = (DXTColBlock*)((DWORD_PTR)m_pCompBytes + j * xblocks * 16);
597597
for (int i = 0; i < xblocks; i++, pBlock++)
598598
{
599599
// inline
@@ -604,7 +604,7 @@ void Image_DXTC::DecompressDXT3()
604604
pBlock++;
605605
GetColorBlockColors(pBlock, &col_0, &col_1, &col_2, &col_3, wrd);
606606
// Decode the color block into the bitmap bits inline func:
607-
pImPos = (DWORD*)((DWORD)pBase + i * 16 + (j * 4) * m_nWidth * 4);
607+
pImPos = (DWORD*)((DWORD_PTR)pBase + i * 16 + (j * 4) * m_nWidth * 4);
608608
DecodeColorBlock(pImPos, pBlock, m_nWidth, (DWORD*)&col_0, (DWORD*)&col_1, (DWORD*)&col_2, (DWORD*)&col_3);
609609
// Overwrite the previous alpha bits with the alpha block
610610
// info
@@ -641,7 +641,7 @@ void Image_DXTC::DecompressDXT5()
641641
{
642642
// 8 bytes per block
643643
// 1 block for alpha, 1 block for color
644-
DXTColBlock* pBlock = (DXTColBlock*)((DWORD)m_pCompBytes + j * xblocks * 16);
644+
DXTColBlock* pBlock = (DXTColBlock*)((DWORD_PTR)m_pCompBytes + j * xblocks * 16);
645645
for (int i = 0; i < xblocks; i++, pBlock++)
646646
{
647647
// inline
@@ -653,7 +653,7 @@ void Image_DXTC::DecompressDXT5()
653653
// //TRACE("pBlock: 0x%.8x\n", pBlock );
654654
GetColorBlockColors(pBlock, &col_0, &col_1, &col_2, &col_3, wrd);
655655
// Decode the color block into the bitmap bits inline func:
656-
pImPos = (DWORD*)((DWORD)pBase + i * 16 + (j * 4) * m_nWidth * 4);
656+
pImPos = (DWORD*)((DWORD_PTR)pBase + i * 16 + (j * 4) * m_nWidth * 4);
657657
DecodeColorBlock(pImPos, pBlock, m_nWidth, (DWORD*)&col_0, (DWORD*)&col_1, (DWORD*)&col_2, (DWORD*)&col_3);
658658
// Overwrite the previous alpha bits with the alpha block info
659659
DecodeAlpha3BitLinear(pImPos, pAlphaBlock, m_nWidth, alphazero);

0 commit comments

Comments
 (0)