diff --git a/source/RGBMonitor.cpp b/source/RGBMonitor.cpp index 3312b3a6..0f501456 100644 --- a/source/RGBMonitor.cpp +++ b/source/RGBMonitor.cpp @@ -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(&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(&rRGB); } } - pDst -= GetFrameBufferWidth(); + pDst -= frameBufferWidth; } }