I would store m_pPalette->getARGBData()[m_pSprites[iSprite].pData[iY * iWidth + iX]] in two different locals, to make this a lot more readable.