MCPcopy Create free account
hub / github.com/AppleWin/AppleWin / CopySource

Function CopySource

source/RGBMonitor.cpp:556–583  ·  view source on GitHub ↗

Pre: nSrcAdjustment: for 160-color images, src is +1 compared to dst

Source from the content-addressed store, hash-verified

554
555// Pre: nSrcAdjustment: for 160-color images, src is +1 compared to dst
556static 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

Callers 5

UpdateHiResCellFunction · 0.85
UpdateDHiResCellFunction · 0.85
UpdateDHiRes160CellFunction · 0.85
UpdateLoResCellFunction · 0.85
UpdateDLoResCellFunction · 0.85

Calls 2

IsVideoStyleMethod · 0.80
GetFrameBufferWidthMethod · 0.80

Tested by

no test coverage detected