Color (RGB Monitor): speed up 'Pure CPU MHz (video update)'. (PR #730)

This commit is contained in:
Andrea 2019-11-28 22:06:34 +00:00 committed by TomCh
parent dd274bc000
commit 6af3b0b028

View File

@ -495,8 +495,7 @@ static void CopyMixedSource(int x, int y, int sx, int sy, bgra_t *pVideoAddress)
{
_ASSERT( colormixbuffer[h] < (sizeof(PalIndex2RGB)/sizeof(PalIndex2RGB[0])) );
const RGBQUAD& rRGB = PalIndex2RGB[ colormixbuffer[h] ];
const UINT32 rgb = (((UINT32)rRGB.rgbRed)<<16) | (((UINT32)rRGB.rgbGreen)<<8) | ((UINT32)rRGB.rgbBlue);
*(pDst+nBytes) = rgb;
*(pDst+nBytes) = *reinterpret_cast<const UINT32 *>(&rRGB);
}
pDst -= frameBufferWidth;
@ -512,28 +511,27 @@ static void CopySource(int w, int h, int sx, int sy, bgra_t *pVideoAddress, cons
UINT32* pDst = (UINT32*) pVideoAddress;
const BYTE* const pSrc = g_aSourceStartofLine[ sy ] + sx;
const bool bIsHalfScanLines = IsVideoStyle(VS_HALF_SCANLINES);
const UINT frameBufferWidth = GetFrameBufferWidth();
while (h--)
{
int nBytes = w;
while (nBytes)
if (bIsHalfScanLines && !(h & 1))
{
--nBytes;
if (IsVideoStyle(VS_HALF_SCANLINES) && !(h & 1))
{
// 50% Half Scan Line clears every odd scanline (and SHIFT+PrintScreen saves only the even rows)
*(pDst+nBytes) = 0;
}
else
// 50% Half Scan Line clears every odd scanline (and SHIFT+PrintScreen saves only the even rows)
std::fill(pDst, pDst + w, 0);
}
else
{
for (int nBytes=0; nBytes<w; ++nBytes)
{
_ASSERT( *(pSrc+nBytes+nSrcAdjustment) < (sizeof(PalIndex2RGB)/sizeof(PalIndex2RGB[0])) );
const RGBQUAD& rRGB = PalIndex2RGB[ *(pSrc+nBytes+nSrcAdjustment) ];
const UINT32 rgb = (((UINT32)rRGB.rgbRed)<<16) | (((UINT32)rRGB.rgbGreen)<<8) | ((UINT32)rRGB.rgbBlue);
*(pDst+nBytes) = rgb;
*(pDst+nBytes) = *reinterpret_cast<const UINT32 *>(&rRGB);
}
}
pDst -= GetFrameBufferWidth();
pDst -= frameBufferWidth;
}
}