Pre: nSrcAdjustment: for 160-color images, src is +1 compared to dst
| 554 | |
| 555 | // Pre: nSrcAdjustment: for 160-color images, src is +1 compared to dst |
| 556 | static void CopySource(int w, int h, int sx, int sy, bgra_t *pVideoAddress, const int nSrcAdjustment = 0) |
| 557 | { |
| 558 | UINT32* pDst = (UINT32*) pVideoAddress; |
| 559 | const BYTE* const pSrc = g_aSourceStartofLine[ sy ] + sx; |
| 560 | |
| 561 | const bool bIsHalfScanLines = GetVideo().IsVideoStyle(VS_HALF_SCANLINES); |
| 562 | const UINT frameBufferWidth = GetVideo().GetFrameBufferWidth(); |
| 563 | |
| 564 | while (h--) |
| 565 | { |
| 566 | if (bIsHalfScanLines && !(h & 1)) |
| 567 | { |
| 568 | // 50% Half Scan Line clears every odd scanline (and SHIFT+PrintScreen saves only the even rows) |
| 569 | std::fill(pDst, pDst + w, OPAQUE_BLACK); |
| 570 | } |
| 571 | else |
| 572 | { |
| 573 | for (int nBytes=0; nBytes<w; ++nBytes) |
| 574 | { |
| 575 | _ASSERT( *(pSrc+nBytes+nSrcAdjustment) < (sizeof(PaletteRGB_NTSC)/sizeof(PaletteRGB_NTSC[0])) ); |
| 576 | const RGBQUAD& rRGB = g_pPaletteRGB[ *(pSrc+nBytes+nSrcAdjustment) ]; |
| 577 | *(pDst+nBytes) = *reinterpret_cast<const UINT32 *>(&rRGB); |
| 578 | } |
| 579 | } |
| 580 | |
| 581 | pDst -= frameBufferWidth; |
| 582 | } |
| 583 | } |
| 584 | |
| 585 | //=========================================================================== |
| 586 |
no test coverage detected