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

Function CopyMixedSource

source/RGBMonitor.cpp:510–551  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

508}
509
510static void CopyMixedSource(int x, int y, int sx, int sy, bgra_t *pVideoAddress)
511{
512 const BYTE* const pSrc = g_aSourceStartofLine[ sy ] + sx;
513
514 const int matx = x*14;
515 const int maty = HGR_MATRIX_YOFFSET + y;
516 const bool isSWMIXED = GetVideo().VideoGetSWMIXED();
517
518 // transfer 14 pixels (i.e. the visible part of an apple hgr-byte) from row to pixelmatrix
519 for (int nBytes=13; nBytes>=0; nBytes--)
520 {
521 hgrpixelmatrix[matx+nBytes][maty] = *(pSrc+nBytes);
522 }
523
524 const bool bIsHalfScanLines = GetVideo().IsVideoStyle(VS_HALF_SCANLINES);
525 const UINT frameBufferWidth = GetVideo().GetFrameBufferWidth();
526
527 for (int nBytes=13; nBytes>=0; nBytes--)
528 {
529 // color mixing between adjacent scanlines at current x position
530 MixColorsVertical(matx+nBytes, maty, isSWMIXED); //Post: colormixbuffer[]
531
532 UINT32* pDst = (UINT32*) pVideoAddress;
533
534 for (int h=HGR_MATRIX_YOFFSET; h<=HGR_MATRIX_YOFFSET+1; h++)
535 {
536 if (bIsHalfScanLines && (h & 1))
537 {
538 // 50% Half Scan Line clears every odd scanline (and SHIFT+PrintScreen saves only the even rows)
539 *(pDst+nBytes) = OPAQUE_BLACK;
540 }
541 else
542 {
543 _ASSERT( colormixbuffer[h] < (sizeof(PaletteRGB_NTSC)/sizeof(PaletteRGB_NTSC[0])) );
544 const RGBQUAD& rRGB = g_pPaletteRGB[ colormixbuffer[h] ];
545 *(pDst+nBytes) = *reinterpret_cast<const UINT32 *>(&rRGB);
546 }
547
548 pDst -= frameBufferWidth;
549 }
550 }
551}
552
553//===========================================================================
554

Callers 1

UpdateHiResCellFunction · 0.85

Calls 4

MixColorsVerticalFunction · 0.85
VideoGetSWMIXEDMethod · 0.80
IsVideoStyleMethod · 0.80
GetFrameBufferWidthMethod · 0.80

Tested by

no test coverage detected